@typescript-deploys/pr-build 5.5.0-pr-58243-49 → 5.5.0-pr-58396-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.es2015.iterable.d.ts +67 -67
- package/lib/lib.es2018.asynciterable.d.ts +5 -5
- package/lib/lib.es2020.bigint.d.ts +8 -8
- package/lib/lib.es2020.string.d.ts +1 -1
- package/lib/lib.es2020.symbol.wellknown.d.ts +1 -1
- package/lib/lib.es2022.intl.d.ts +1 -1
- package/lib/tsc.js +496 -400
- package/lib/typescript.js +1577 -577
- package/package.json +1 -1
package/lib/typescript.js
CHANGED
|
@@ -302,6 +302,7 @@ __export(typescript_exports, {
|
|
|
302
302
|
collectExternalModuleInfo: () => collectExternalModuleInfo,
|
|
303
303
|
combine: () => combine,
|
|
304
304
|
combinePaths: () => combinePaths,
|
|
305
|
+
commandLineOptionOfCustomType: () => commandLineOptionOfCustomType,
|
|
305
306
|
commentPragmas: () => commentPragmas,
|
|
306
307
|
commonOptionsWithBuild: () => commonOptionsWithBuild,
|
|
307
308
|
commonPackageFolders: () => commonPackageFolders,
|
|
@@ -918,6 +919,8 @@ __export(typescript_exports, {
|
|
|
918
919
|
getNameOfDeclaration: () => getNameOfDeclaration,
|
|
919
920
|
getNameOfExpando: () => getNameOfExpando,
|
|
920
921
|
getNameOfJSDocTypedef: () => getNameOfJSDocTypedef,
|
|
922
|
+
getNameOfModuleKind: () => getNameOfModuleKind,
|
|
923
|
+
getNameOfModuleResolutionKind: () => getNameOfModuleResolutionKind,
|
|
921
924
|
getNameOfScriptTarget: () => getNameOfScriptTarget,
|
|
922
925
|
getNameOrArgument: () => getNameOrArgument,
|
|
923
926
|
getNameTable: () => getNameTable,
|
|
@@ -1926,6 +1929,7 @@ __export(typescript_exports, {
|
|
|
1926
1929
|
moduleOptionDeclaration: () => moduleOptionDeclaration,
|
|
1927
1930
|
moduleResolutionIsEqualTo: () => moduleResolutionIsEqualTo,
|
|
1928
1931
|
moduleResolutionNameAndModeGetter: () => moduleResolutionNameAndModeGetter,
|
|
1932
|
+
moduleResolutionOptionDeclaration: () => moduleResolutionOptionDeclaration,
|
|
1929
1933
|
moduleResolutionOptionDeclarations: () => moduleResolutionOptionDeclarations,
|
|
1930
1934
|
moduleResolutionSupportsPackageJsonExportsAndImports: () => moduleResolutionSupportsPackageJsonExportsAndImports,
|
|
1931
1935
|
moduleResolutionUsesNodeModules: () => moduleResolutionUsesNodeModules,
|
|
@@ -2362,7 +2366,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2362
2366
|
|
|
2363
2367
|
// src/compiler/corePublic.ts
|
|
2364
2368
|
var versionMajorMinor = "5.5";
|
|
2365
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2369
|
+
var version = `${versionMajorMinor}.0-insiders.20240501`;
|
|
2366
2370
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2367
2371
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2368
2372
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6600,7 +6604,8 @@ var CheckFlags = /* @__PURE__ */ ((CheckFlags2) => {
|
|
|
6600
6604
|
CheckFlags2[CheckFlags2["Mapped"] = 262144] = "Mapped";
|
|
6601
6605
|
CheckFlags2[CheckFlags2["StripOptional"] = 524288] = "StripOptional";
|
|
6602
6606
|
CheckFlags2[CheckFlags2["Unresolved"] = 1048576] = "Unresolved";
|
|
6603
|
-
CheckFlags2[CheckFlags2["
|
|
6607
|
+
CheckFlags2[CheckFlags2["SyntheticInterface"] = 2097152] = "SyntheticInterface";
|
|
6608
|
+
CheckFlags2[CheckFlags2["SyntheticMember"] = 6] = "SyntheticMember";
|
|
6604
6609
|
CheckFlags2[CheckFlags2["Discriminant"] = 192] = "Discriminant";
|
|
6605
6610
|
CheckFlags2[CheckFlags2["Partial"] = 48] = "Partial";
|
|
6606
6611
|
return CheckFlags2;
|
|
@@ -11330,6 +11335,16 @@ var Diagnostics = {
|
|
|
11330
11335
|
Export_0_from_module_1: diag(90059, 3 /* Message */, "Export_0_from_module_1_90059", "Export '{0}' from module '{1}'"),
|
|
11331
11336
|
Export_all_referenced_locals: diag(90060, 3 /* Message */, "Export_all_referenced_locals_90060", "Export all referenced locals"),
|
|
11332
11337
|
Update_modifiers_of_0: diag(90061, 3 /* Message */, "Update_modifiers_of_0_90061", "Update modifiers of '{0}'"),
|
|
11338
|
+
Add_annotation_of_type_0: diag(90062, 3 /* Message */, "Add_annotation_of_type_0_90062", "Add annotation of type '{0}'"),
|
|
11339
|
+
Add_return_type_0: diag(90063, 3 /* Message */, "Add_return_type_0_90063", "Add return type '{0}'"),
|
|
11340
|
+
Extract_base_class_to_variable: diag(90064, 3 /* Message */, "Extract_base_class_to_variable_90064", "Extract base class to variable"),
|
|
11341
|
+
Extract_default_export_to_variable: diag(90065, 3 /* Message */, "Extract_default_export_to_variable_90065", "Extract default export to variable"),
|
|
11342
|
+
Extract_binding_expressions_to_variable: diag(90066, 3 /* Message */, "Extract_binding_expressions_to_variable_90066", "Extract binding expressions to variable"),
|
|
11343
|
+
Add_all_missing_type_annotations: diag(90067, 3 /* Message */, "Add_all_missing_type_annotations_90067", "Add all missing type annotations"),
|
|
11344
|
+
Add_satisfies_and_an_inline_type_assertion_with_0: diag(90068, 3 /* Message */, "Add_satisfies_and_an_inline_type_assertion_with_0_90068", "Add satisfies and an inline type assertion with '{0}'"),
|
|
11345
|
+
Extract_to_variable_and_replace_with_0_as_typeof_0: diag(90069, 3 /* Message */, "Extract_to_variable_and_replace_with_0_as_typeof_0_90069", "Extract to variable and replace with '{0} as typeof {0}'"),
|
|
11346
|
+
Mark_array_literal_as_const: diag(90070, 3 /* Message */, "Mark_array_literal_as_const_90070", "Mark array literal as const"),
|
|
11347
|
+
Annotate_types_of_properties_expando_function_in_a_namespace: diag(90071, 3 /* Message */, "Annotate_types_of_properties_expando_function_in_a_namespace_90071", "Annotate types of properties expando function in a namespace"),
|
|
11333
11348
|
Convert_function_to_an_ES2015_class: diag(95001, 3 /* Message */, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
|
|
11334
11349
|
Convert_0_to_1_in_0: diag(95003, 3 /* Message */, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
|
|
11335
11350
|
Extract_to_0_in_1: diag(95004, 3 /* Message */, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
|
|
@@ -17450,7 +17465,7 @@ function entityNameToString(name) {
|
|
|
17450
17465
|
return Debug.assertNever(name.name);
|
|
17451
17466
|
}
|
|
17452
17467
|
case 311 /* JSDocMemberName */:
|
|
17453
|
-
return entityNameToString(name.left) + entityNameToString(name.right);
|
|
17468
|
+
return entityNameToString(name.left) + "#" + entityNameToString(name.right);
|
|
17454
17469
|
case 295 /* JsxNamespacedName */:
|
|
17455
17470
|
return entityNameToString(name.namespace) + ":" + entityNameToString(name.name);
|
|
17456
17471
|
default:
|
|
@@ -21194,7 +21209,7 @@ function getDeclarationModifierFlagsFromSymbol(s, isWrite = false) {
|
|
|
21194
21209
|
const flags = getCombinedModifierFlags(declaration);
|
|
21195
21210
|
return s.parent && s.parent.flags & 32 /* Class */ ? flags : flags & ~7 /* AccessibilityModifier */;
|
|
21196
21211
|
}
|
|
21197
|
-
if (getCheckFlags(s) & 6 /*
|
|
21212
|
+
if (getCheckFlags(s) & 6 /* SyntheticMember */) {
|
|
21198
21213
|
const checkFlags = s.links.checkFlags;
|
|
21199
21214
|
const accessModifier = checkFlags & 1024 /* ContainsPrivate */ ? 2 /* Private */ : checkFlags & 256 /* ContainsPublic */ ? 1 /* Public */ : 4 /* Protected */;
|
|
21200
21215
|
const staticModifier = checkFlags & 2048 /* ContainsStatic */ ? 256 /* Static */ : 0;
|
|
@@ -22069,7 +22084,19 @@ function getStrictOptionValue(compilerOptions, flag) {
|
|
|
22069
22084
|
return compilerOptions[flag] === void 0 ? !!compilerOptions.strict : !!compilerOptions[flag];
|
|
22070
22085
|
}
|
|
22071
22086
|
function getNameOfScriptTarget(scriptTarget) {
|
|
22072
|
-
|
|
22087
|
+
const entries = [...targetOptionDeclaration.type].reverse();
|
|
22088
|
+
return forEach(entries, ([key, value]) => value === scriptTarget ? key : void 0);
|
|
22089
|
+
}
|
|
22090
|
+
function getNameOfModuleKind(moduleKind) {
|
|
22091
|
+
const entries = [...moduleOptionDeclaration.type].reverse();
|
|
22092
|
+
return forEach(entries, ([key, value]) => value === moduleKind ? key : void 0);
|
|
22093
|
+
}
|
|
22094
|
+
function getNameOfModuleResolutionKind(moduleResolution) {
|
|
22095
|
+
if (moduleResolution === 2 /* Node10 */) {
|
|
22096
|
+
return "node10";
|
|
22097
|
+
}
|
|
22098
|
+
const entries = [...moduleResolutionOptionDeclaration.type].reverse();
|
|
22099
|
+
return forEach(entries, ([key, value]) => value === moduleResolution ? key : void 0);
|
|
22073
22100
|
}
|
|
22074
22101
|
function getEmitStandardClassFields(compilerOptions) {
|
|
22075
22102
|
return compilerOptions.useDefineForClassFields !== false && getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */;
|
|
@@ -40406,6 +40433,25 @@ var moduleOptionDeclaration = {
|
|
|
40406
40433
|
description: Diagnostics.Specify_what_module_code_is_generated,
|
|
40407
40434
|
defaultValueDescription: void 0
|
|
40408
40435
|
};
|
|
40436
|
+
var moduleResolutionOptionDeclaration = {
|
|
40437
|
+
name: "moduleResolution",
|
|
40438
|
+
type: new Map(Object.entries({
|
|
40439
|
+
// N.B. The first entry specifies the value shown in `tsc --init`
|
|
40440
|
+
node10: 2 /* Node10 */,
|
|
40441
|
+
node: 2 /* Node10 */,
|
|
40442
|
+
classic: 1 /* Classic */,
|
|
40443
|
+
node16: 3 /* Node16 */,
|
|
40444
|
+
nodenext: 99 /* NodeNext */,
|
|
40445
|
+
bundler: 100 /* Bundler */
|
|
40446
|
+
})),
|
|
40447
|
+
deprecatedKeys: /* @__PURE__ */ new Set(["node"]),
|
|
40448
|
+
affectsSourceFile: true,
|
|
40449
|
+
affectsModuleResolution: true,
|
|
40450
|
+
paramType: Diagnostics.STRATEGY,
|
|
40451
|
+
category: Diagnostics.Modules,
|
|
40452
|
+
description: Diagnostics.Specify_how_TypeScript_looks_up_a_file_from_a_given_module_specifier,
|
|
40453
|
+
defaultValueDescription: Diagnostics.module_AMD_or_UMD_or_System_or_ES6_then_Classic_Otherwise_Node
|
|
40454
|
+
};
|
|
40409
40455
|
var commandOptionsWithoutBuild = [
|
|
40410
40456
|
// CommandLine only options
|
|
40411
40457
|
{
|
|
@@ -40847,25 +40893,7 @@ var commandOptionsWithoutBuild = [
|
|
|
40847
40893
|
defaultValueDescription: false
|
|
40848
40894
|
},
|
|
40849
40895
|
// Module Resolution
|
|
40850
|
-
|
|
40851
|
-
name: "moduleResolution",
|
|
40852
|
-
type: new Map(Object.entries({
|
|
40853
|
-
// N.B. The first entry specifies the value shown in `tsc --init`
|
|
40854
|
-
node10: 2 /* Node10 */,
|
|
40855
|
-
node: 2 /* Node10 */,
|
|
40856
|
-
classic: 1 /* Classic */,
|
|
40857
|
-
node16: 3 /* Node16 */,
|
|
40858
|
-
nodenext: 99 /* NodeNext */,
|
|
40859
|
-
bundler: 100 /* Bundler */
|
|
40860
|
-
})),
|
|
40861
|
-
deprecatedKeys: /* @__PURE__ */ new Set(["node"]),
|
|
40862
|
-
affectsSourceFile: true,
|
|
40863
|
-
affectsModuleResolution: true,
|
|
40864
|
-
paramType: Diagnostics.STRATEGY,
|
|
40865
|
-
category: Diagnostics.Modules,
|
|
40866
|
-
description: Diagnostics.Specify_how_TypeScript_looks_up_a_file_from_a_given_module_specifier,
|
|
40867
|
-
defaultValueDescription: Diagnostics.module_AMD_or_UMD_or_System_or_ES6_then_Classic_Otherwise_Node
|
|
40868
|
-
},
|
|
40896
|
+
moduleResolutionOptionDeclaration,
|
|
40869
40897
|
{
|
|
40870
40898
|
name: "baseUrl",
|
|
40871
40899
|
type: "string",
|
|
@@ -41434,6 +41462,10 @@ var configDirTemplateSubstitutionOptions = optionDeclarations.filter(
|
|
|
41434
41462
|
var configDirTemplateSubstitutionWatchOptions = optionsForWatch.filter(
|
|
41435
41463
|
(option) => option.allowConfigDirTemplateSubstitution || !option.isCommandLineOnly && option.isFilePath
|
|
41436
41464
|
);
|
|
41465
|
+
var commandLineOptionOfCustomType = optionDeclarations.filter(isCommandLineOptionOfCustomType);
|
|
41466
|
+
function isCommandLineOptionOfCustomType(option) {
|
|
41467
|
+
return !isString(option.type);
|
|
41468
|
+
}
|
|
41437
41469
|
var optionsForBuild = [
|
|
41438
41470
|
{
|
|
41439
41471
|
name: "verbose",
|
|
@@ -50233,6 +50265,7 @@ function isInstantiatedModule(node, preserveConstEnums) {
|
|
|
50233
50265
|
return moduleState === 1 /* Instantiated */ || preserveConstEnums && moduleState === 2 /* ConstEnumOnly */;
|
|
50234
50266
|
}
|
|
50235
50267
|
function createTypeChecker(host) {
|
|
50268
|
+
var _a;
|
|
50236
50269
|
var deferredDiagnosticsCallbacks = [];
|
|
50237
50270
|
var addLazyDiagnostic = (arg) => {
|
|
50238
50271
|
deferredDiagnosticsCallbacks.push(arg);
|
|
@@ -50243,7 +50276,7 @@ function createTypeChecker(host) {
|
|
|
50243
50276
|
var externalHelpersModule;
|
|
50244
50277
|
var scanner2;
|
|
50245
50278
|
var Symbol47 = objectAllocator.getSymbolConstructor();
|
|
50246
|
-
var
|
|
50279
|
+
var Type29 = objectAllocator.getTypeConstructor();
|
|
50247
50280
|
var Signature14 = objectAllocator.getSignatureConstructor();
|
|
50248
50281
|
var typeCount = 0;
|
|
50249
50282
|
var symbolCount = 0;
|
|
@@ -50259,6 +50292,7 @@ function createTypeChecker(host) {
|
|
|
50259
50292
|
var compilerOptions = host.getCompilerOptions();
|
|
50260
50293
|
var languageVersion = getEmitScriptTarget(compilerOptions);
|
|
50261
50294
|
var moduleKind = getEmitModuleKind(compilerOptions);
|
|
50295
|
+
var moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
50262
50296
|
var legacyDecorators = !!compilerOptions.experimentalDecorators;
|
|
50263
50297
|
var useDefineForClassFields = getUseDefineForClassFields(compilerOptions);
|
|
50264
50298
|
var emitStandardClassFields = getEmitStandardClassFields(compilerOptions);
|
|
@@ -50271,6 +50305,7 @@ function createTypeChecker(host) {
|
|
|
50271
50305
|
var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
|
|
50272
50306
|
var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
|
|
50273
50307
|
var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
|
|
50308
|
+
var noUncheckedIndexedAccess = compilerOptions.noUncheckedIndexedAccess;
|
|
50274
50309
|
var checkBinaryExpression = createCheckBinaryExpression();
|
|
50275
50310
|
var emitResolver = createResolver();
|
|
50276
50311
|
var nodeBuilder = createNodeBuilder();
|
|
@@ -50385,6 +50420,7 @@ function createTypeChecker(host) {
|
|
|
50385
50420
|
getBaseTypes,
|
|
50386
50421
|
getBaseTypeOfLiteralType,
|
|
50387
50422
|
getWidenedType,
|
|
50423
|
+
getWidenedLiteralType,
|
|
50388
50424
|
getTypeFromTypeNode: (nodeIn) => {
|
|
50389
50425
|
const node = getParseTreeNode(nodeIn, isTypeNode);
|
|
50390
50426
|
return node ? getTypeFromTypeNode(node) : errorType;
|
|
@@ -50613,14 +50649,6 @@ function createTypeChecker(host) {
|
|
|
50613
50649
|
return void 0;
|
|
50614
50650
|
return type;
|
|
50615
50651
|
},
|
|
50616
|
-
createTypeReference: (target, typeArguments) => {
|
|
50617
|
-
if (target !== emptyGenericType && getObjectFlags(target) & 3 /* ClassOrInterface */) {
|
|
50618
|
-
const interfaceType = target;
|
|
50619
|
-
if (some(interfaceType.typeParameters)) {
|
|
50620
|
-
return createTypeReference(interfaceType, typeArguments);
|
|
50621
|
-
}
|
|
50622
|
-
}
|
|
50623
|
-
},
|
|
50624
50652
|
isSymbolAccessible,
|
|
50625
50653
|
isArrayType,
|
|
50626
50654
|
isTupleType,
|
|
@@ -51091,6 +51119,7 @@ function createTypeChecker(host) {
|
|
|
51091
51119
|
};
|
|
51092
51120
|
var anyIterationTypes = createIterationTypes(anyType, anyType, anyType);
|
|
51093
51121
|
var anyIterationTypesExceptNext = createIterationTypes(anyType, anyType, unknownType);
|
|
51122
|
+
var defaultIterationTypes = createIterationTypes(neverType, anyType, undefinedType);
|
|
51094
51123
|
var asyncIterationTypesResolver = {
|
|
51095
51124
|
iterableCacheKey: "iterationTypesOfAsyncIterable",
|
|
51096
51125
|
iteratorCacheKey: "iterationTypesOfAsyncIterator",
|
|
@@ -51244,6 +51273,32 @@ function createTypeChecker(host) {
|
|
|
51244
51273
|
[".jsx", ".jsx"],
|
|
51245
51274
|
[".json", ".json"]
|
|
51246
51275
|
];
|
|
51276
|
+
var typeScriptSettingsSymbol = createSymbol(64 /* Interface */, "TypeScriptSettings", 2097152 /* SyntheticInterface */);
|
|
51277
|
+
typeScriptSettingsSymbol.declarations = [];
|
|
51278
|
+
typeScriptSettingsSymbol.members = createSymbolTable([
|
|
51279
|
+
createProperty("version", getStringLiteralType(version), 8 /* Readonly */),
|
|
51280
|
+
createProperty("versionMajorMinor", getStringLiteralType(versionMajorMinor), 8 /* Readonly */),
|
|
51281
|
+
createProperty("locale", compilerOptions.locale ? getStringLiteralType(compilerOptions.locale) : undefinedType, 8 /* Readonly */),
|
|
51282
|
+
createProperty("target", getStringLiteralType(getNameOfScriptTarget(languageVersion) ?? ""), 8 /* Readonly */),
|
|
51283
|
+
createProperty("module", getStringLiteralType(getNameOfModuleKind(moduleKind) ?? ""), 8 /* Readonly */),
|
|
51284
|
+
createProperty("moduleResolution", getStringLiteralType(getNameOfModuleResolutionKind(moduleResolutionKind) ?? ""), 8 /* Readonly */),
|
|
51285
|
+
createProperty("customConditions", createTupleType(
|
|
51286
|
+
((_a = compilerOptions.customConditions) == null ? void 0 : _a.map((cond) => getStringLiteralType(cond))) ?? emptyArray,
|
|
51287
|
+
/*elementFlags*/
|
|
51288
|
+
void 0,
|
|
51289
|
+
/*readonly*/
|
|
51290
|
+
true
|
|
51291
|
+
), 8 /* Readonly */),
|
|
51292
|
+
createProperty("esModuleInterop", getESModuleInterop(compilerOptions) ? trueType : falseType, 8 /* Readonly */),
|
|
51293
|
+
createProperty("exactOptionalPropertyTypes", exactOptionalPropertyTypes ? trueType : falseType, 8 /* Readonly */),
|
|
51294
|
+
createProperty("noImplicitAny", noImplicitAny ? trueType : falseType, 8 /* Readonly */),
|
|
51295
|
+
createProperty("noUncheckedIndexedAccess", noUncheckedIndexedAccess ? trueType : falseType, 8 /* Readonly */),
|
|
51296
|
+
createProperty("strictBindCallApply", strictBindCallApply ? trueType : falseType, 8 /* Readonly */),
|
|
51297
|
+
createProperty("strictFunctionTypes", strictFunctionTypes ? trueType : falseType, 8 /* Readonly */),
|
|
51298
|
+
createProperty("strictNullChecks", strictNullChecks ? trueType : falseType, 8 /* Readonly */),
|
|
51299
|
+
createProperty("useDefineForClassFields", useDefineForClassFields ? trueType : falseType, 8 /* Readonly */)
|
|
51300
|
+
]);
|
|
51301
|
+
globals.set(typeScriptSettingsSymbol.escapedName, typeScriptSettingsSymbol);
|
|
51247
51302
|
initializeTypeChecker();
|
|
51248
51303
|
return checker;
|
|
51249
51304
|
function getCachedType(key) {
|
|
@@ -51418,8 +51473,8 @@ function createTypeChecker(host) {
|
|
|
51418
51473
|
symbol.links.type = type;
|
|
51419
51474
|
return symbol;
|
|
51420
51475
|
}
|
|
51421
|
-
function createProperty(name, type) {
|
|
51422
|
-
const symbol = createSymbol(4 /* Property */, name);
|
|
51476
|
+
function createProperty(name, type, checkFlags) {
|
|
51477
|
+
const symbol = createSymbol(4 /* Property */, name, checkFlags);
|
|
51423
51478
|
symbol.links.type = type;
|
|
51424
51479
|
return symbol;
|
|
51425
51480
|
}
|
|
@@ -51601,9 +51656,9 @@ function createTypeChecker(host) {
|
|
|
51601
51656
|
});
|
|
51602
51657
|
}
|
|
51603
51658
|
function mergeModuleAugmentation(moduleName) {
|
|
51604
|
-
var
|
|
51659
|
+
var _a2, _b, _c;
|
|
51605
51660
|
const moduleAugmentation = moduleName.parent;
|
|
51606
|
-
if (((
|
|
51661
|
+
if (((_a2 = moduleAugmentation.symbol.declarations) == null ? void 0 : _a2[0]) !== moduleAugmentation) {
|
|
51607
51662
|
Debug.assert(moduleAugmentation.symbol.declarations.length > 1);
|
|
51608
51663
|
return;
|
|
51609
51664
|
}
|
|
@@ -51916,7 +51971,7 @@ function createTypeChecker(host) {
|
|
|
51916
51971
|
}
|
|
51917
51972
|
function onSuccessfullyResolvedSymbol(errorLocation, result, meaning, lastLocation, associatedDeclarationForContainingInitializerOrBindingName, withinDeferredContext) {
|
|
51918
51973
|
addLazyDiagnostic(() => {
|
|
51919
|
-
var
|
|
51974
|
+
var _a2;
|
|
51920
51975
|
const name = result.escapedName;
|
|
51921
51976
|
const isInExternalModule = lastLocation && isSourceFile(lastLocation) && isExternalOrCommonJsModule(lastLocation);
|
|
51922
51977
|
if (errorLocation && (meaning & 2 /* BlockScopedVariable */ || (meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */)) {
|
|
@@ -51956,7 +52011,7 @@ function createTypeChecker(host) {
|
|
|
51956
52011
|
const isGlobal = getSymbol2(globals, name, meaning) === result;
|
|
51957
52012
|
const nonValueSymbol = isGlobal && isSourceFile(lastLocation) && lastLocation.locals && getSymbol2(lastLocation.locals, name, ~111551 /* Value */);
|
|
51958
52013
|
if (nonValueSymbol) {
|
|
51959
|
-
const importDecl = (
|
|
52014
|
+
const importDecl = (_a2 = nonValueSymbol.declarations) == null ? void 0 : _a2.find((d) => d.kind === 276 /* ImportSpecifier */ || d.kind === 273 /* ImportClause */ || d.kind === 274 /* NamespaceImport */ || d.kind === 271 /* ImportEqualsDeclaration */);
|
|
51960
52015
|
if (importDecl && !isTypeOnlyImportDeclaration(importDecl)) {
|
|
51961
52016
|
error2(importDecl, Diagnostics.Import_0_conflicts_with_global_value_used_in_this_file_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled, unescapeLeadingUnderscores(name));
|
|
51962
52017
|
}
|
|
@@ -52207,12 +52262,12 @@ function createTypeChecker(host) {
|
|
|
52207
52262
|
return false;
|
|
52208
52263
|
}
|
|
52209
52264
|
function checkResolvedBlockScopedVariable(result, errorLocation) {
|
|
52210
|
-
var
|
|
52265
|
+
var _a2;
|
|
52211
52266
|
Debug.assert(!!(result.flags & 2 /* BlockScopedVariable */ || result.flags & 32 /* Class */ || result.flags & 384 /* Enum */));
|
|
52212
52267
|
if (result.flags & (16 /* Function */ | 1 /* FunctionScopedVariable */ | 67108864 /* Assignment */) && result.flags & 32 /* Class */) {
|
|
52213
52268
|
return;
|
|
52214
52269
|
}
|
|
52215
|
-
const declaration = (
|
|
52270
|
+
const declaration = (_a2 = result.declarations) == null ? void 0 : _a2.find(
|
|
52216
52271
|
(d) => isBlockOrCatchScoped(d) || isClassLike(d) || d.kind === 266 /* EnumDeclaration */
|
|
52217
52272
|
);
|
|
52218
52273
|
if (declaration === void 0)
|
|
@@ -52394,14 +52449,14 @@ function createTypeChecker(host) {
|
|
|
52394
52449
|
}
|
|
52395
52450
|
}
|
|
52396
52451
|
function getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias) {
|
|
52397
|
-
var
|
|
52452
|
+
var _a2;
|
|
52398
52453
|
let exportDefaultSymbol;
|
|
52399
52454
|
if (isShorthandAmbientModuleSymbol(moduleSymbol)) {
|
|
52400
52455
|
exportDefaultSymbol = moduleSymbol;
|
|
52401
52456
|
} else {
|
|
52402
52457
|
exportDefaultSymbol = resolveExportByName(moduleSymbol, "default" /* Default */, node, dontResolveAlias);
|
|
52403
52458
|
}
|
|
52404
|
-
const file = (
|
|
52459
|
+
const file = (_a2 = moduleSymbol.declarations) == null ? void 0 : _a2.find(isSourceFile);
|
|
52405
52460
|
const specifier = getModuleSpecifierForImportOrExport(node);
|
|
52406
52461
|
if (!specifier) {
|
|
52407
52462
|
return exportDefaultSymbol;
|
|
@@ -52467,8 +52522,8 @@ function createTypeChecker(host) {
|
|
|
52467
52522
|
}
|
|
52468
52523
|
}
|
|
52469
52524
|
function reportNonDefaultExport(moduleSymbol, node) {
|
|
52470
|
-
var
|
|
52471
|
-
if ((
|
|
52525
|
+
var _a2, _b, _c;
|
|
52526
|
+
if ((_a2 = moduleSymbol.exports) == null ? void 0 : _a2.has(node.symbol.escapedName)) {
|
|
52472
52527
|
error2(
|
|
52473
52528
|
node.name,
|
|
52474
52529
|
Diagnostics.Module_0_has_no_default_export_Did_you_mean_to_use_import_1_from_0_instead,
|
|
@@ -52481,8 +52536,8 @@ function createTypeChecker(host) {
|
|
|
52481
52536
|
if (exportStar) {
|
|
52482
52537
|
const defaultExport = (_c = exportStar.declarations) == null ? void 0 : _c.find(
|
|
52483
52538
|
(decl) => {
|
|
52484
|
-
var
|
|
52485
|
-
return !!(isExportDeclaration(decl) && decl.moduleSpecifier && ((_b2 = (
|
|
52539
|
+
var _a3, _b2;
|
|
52540
|
+
return !!(isExportDeclaration(decl) && decl.moduleSpecifier && ((_b2 = (_a3 = resolveExternalModuleName(decl, decl.moduleSpecifier)) == null ? void 0 : _a3.exports) == null ? void 0 : _b2.has("default" /* Default */)));
|
|
52486
52541
|
}
|
|
52487
52542
|
);
|
|
52488
52543
|
if (defaultExport) {
|
|
@@ -52549,11 +52604,11 @@ function createTypeChecker(host) {
|
|
|
52549
52604
|
return result;
|
|
52550
52605
|
}
|
|
52551
52606
|
function getExportOfModule(symbol, name, specifier, dontResolveAlias) {
|
|
52552
|
-
var
|
|
52607
|
+
var _a2;
|
|
52553
52608
|
if (symbol.flags & 1536 /* Module */) {
|
|
52554
52609
|
const exportSymbol = getExportsOfSymbol(symbol).get(name.escapedText);
|
|
52555
52610
|
const resolved = resolveSymbol(exportSymbol, dontResolveAlias);
|
|
52556
|
-
const exportStarDeclaration = (
|
|
52611
|
+
const exportStarDeclaration = (_a2 = getSymbolLinks(symbol).typeOnlyExportStarMap) == null ? void 0 : _a2.get(name.escapedText);
|
|
52557
52612
|
markSymbolOfAliasDeclarationIfTypeOnly(
|
|
52558
52613
|
specifier,
|
|
52559
52614
|
exportSymbol,
|
|
@@ -52575,7 +52630,7 @@ function createTypeChecker(host) {
|
|
|
52575
52630
|
}
|
|
52576
52631
|
}
|
|
52577
52632
|
function getExternalModuleMember(node, specifier, dontResolveAlias = false) {
|
|
52578
|
-
var
|
|
52633
|
+
var _a2;
|
|
52579
52634
|
const moduleSpecifier = getExternalModuleRequireArgument(node) || node.moduleSpecifier;
|
|
52580
52635
|
const moduleSymbol = resolveExternalModuleName(node, moduleSpecifier);
|
|
52581
52636
|
const name = !isPropertyAccessExpression(specifier) && specifier.propertyName || specifier.name;
|
|
@@ -52609,7 +52664,7 @@ function createTypeChecker(host) {
|
|
|
52609
52664
|
symbolFromVariable = resolveSymbol(symbolFromVariable, dontResolveAlias);
|
|
52610
52665
|
let symbolFromModule = getExportOfModule(targetSymbol, name, specifier, dontResolveAlias);
|
|
52611
52666
|
if (symbolFromModule === void 0 && name.escapedText === "default" /* Default */) {
|
|
52612
|
-
const file = (
|
|
52667
|
+
const file = (_a2 = moduleSymbol.declarations) == null ? void 0 : _a2.find(isSourceFile);
|
|
52613
52668
|
if (isOnlyImportableAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
52614
52669
|
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
52615
52670
|
}
|
|
@@ -52623,7 +52678,7 @@ function createTypeChecker(host) {
|
|
|
52623
52678
|
}
|
|
52624
52679
|
}
|
|
52625
52680
|
function errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name) {
|
|
52626
|
-
var
|
|
52681
|
+
var _a2;
|
|
52627
52682
|
const moduleName = getFullyQualifiedName(moduleSymbol, node);
|
|
52628
52683
|
const declarationName = declarationNameToString(name);
|
|
52629
52684
|
const suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
|
|
@@ -52634,7 +52689,7 @@ function createTypeChecker(host) {
|
|
|
52634
52689
|
addRelatedInfo(diagnostic, createDiagnosticForNode(suggestion.valueDeclaration, Diagnostics._0_is_declared_here, suggestionName));
|
|
52635
52690
|
}
|
|
52636
52691
|
} else {
|
|
52637
|
-
if ((
|
|
52692
|
+
if ((_a2 = moduleSymbol.exports) == null ? void 0 : _a2.has("default" /* Default */)) {
|
|
52638
52693
|
error2(
|
|
52639
52694
|
name,
|
|
52640
52695
|
Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead,
|
|
@@ -52647,8 +52702,8 @@ function createTypeChecker(host) {
|
|
|
52647
52702
|
}
|
|
52648
52703
|
}
|
|
52649
52704
|
function reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName) {
|
|
52650
|
-
var
|
|
52651
|
-
const localSymbol = (_b = (
|
|
52705
|
+
var _a2, _b;
|
|
52706
|
+
const localSymbol = (_b = (_a2 = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _a2.locals) == null ? void 0 : _b.get(name.escapedText);
|
|
52652
52707
|
const exports2 = moduleSymbol.exports;
|
|
52653
52708
|
if (localSymbol) {
|
|
52654
52709
|
const exportedEqualsSymbol = exports2 == null ? void 0 : exports2.get("export=" /* ExportEquals */);
|
|
@@ -52915,9 +52970,9 @@ function createTypeChecker(host) {
|
|
|
52915
52970
|
return markSymbolOfAliasDeclarationIfTypeOnlyWorker(links, immediateTarget, overwriteEmpty) || markSymbolOfAliasDeclarationIfTypeOnlyWorker(links, finalTarget, overwriteEmpty);
|
|
52916
52971
|
}
|
|
52917
52972
|
function markSymbolOfAliasDeclarationIfTypeOnlyWorker(aliasDeclarationLinks, target, overwriteEmpty) {
|
|
52918
|
-
var
|
|
52973
|
+
var _a2;
|
|
52919
52974
|
if (target && (aliasDeclarationLinks.typeOnlyDeclaration === void 0 || overwriteEmpty && aliasDeclarationLinks.typeOnlyDeclaration === false)) {
|
|
52920
|
-
const exportSymbol = ((
|
|
52975
|
+
const exportSymbol = ((_a2 = target.exports) == null ? void 0 : _a2.get("export=" /* ExportEquals */)) ?? target;
|
|
52921
52976
|
const typeOnly = exportSymbol.declarations && find(exportSymbol.declarations, isTypeOnlyImportOrExportDeclaration);
|
|
52922
52977
|
aliasDeclarationLinks.typeOnlyDeclaration = typeOnly ?? getSymbolLinks(exportSymbol).typeOnlyDeclaration ?? false;
|
|
52923
52978
|
}
|
|
@@ -53214,7 +53269,7 @@ function createTypeChecker(host) {
|
|
|
53214
53269
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
|
|
53215
53270
|
}
|
|
53216
53271
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
53217
|
-
var
|
|
53272
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
53218
53273
|
if (startsWith(moduleReference, "@types/")) {
|
|
53219
53274
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
53220
53275
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -53229,13 +53284,13 @@ function createTypeChecker(host) {
|
|
|
53229
53284
|
return ambientModule;
|
|
53230
53285
|
}
|
|
53231
53286
|
const currentSourceFile = getSourceFileOfNode(location);
|
|
53232
|
-
const contextSpecifier = isStringLiteralLike(location) ? location : ((
|
|
53287
|
+
const contextSpecifier = isStringLiteralLike(location) ? location : ((_a2 = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _a2.name) || ((_b = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _b.argument.literal) || (isInJSFile(location) && isJSDocImportTag(location) ? location.moduleSpecifier : void 0) || (isVariableDeclaration(location) && location.initializer && isRequireCall(
|
|
53233
53288
|
location.initializer,
|
|
53234
53289
|
/*requireStringLiteralLikeArgument*/
|
|
53235
53290
|
true
|
|
53236
53291
|
) ? location.initializer.arguments[0] : void 0) || ((_c = findAncestor(location, isImportCall)) == null ? void 0 : _c.arguments[0]) || ((_d = findAncestor(location, isImportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _e.moduleReference.expression) || ((_f = findAncestor(location, isExportDeclaration)) == null ? void 0 : _f.moduleSpecifier);
|
|
53237
53292
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : host.getDefaultResolutionModeForFile(currentSourceFile);
|
|
53238
|
-
const
|
|
53293
|
+
const moduleResolutionKind2 = getEmitModuleResolutionKind(compilerOptions);
|
|
53239
53294
|
const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
|
|
53240
53295
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
53241
53296
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -53271,7 +53326,7 @@ function createTypeChecker(host) {
|
|
|
53271
53326
|
moduleReference
|
|
53272
53327
|
);
|
|
53273
53328
|
}
|
|
53274
|
-
if (
|
|
53329
|
+
if (moduleResolutionKind2 === 3 /* Node16 */ || moduleResolutionKind2 === 99 /* NodeNext */) {
|
|
53275
53330
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
53276
53331
|
const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
53277
53332
|
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !hasResolutionModeOverride(overrideHost)) {
|
|
@@ -53375,8 +53430,8 @@ function createTypeChecker(host) {
|
|
|
53375
53430
|
error2(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
53376
53431
|
} else {
|
|
53377
53432
|
const isExtensionlessRelativePathImport = pathIsRelative(moduleReference) && !hasExtension(moduleReference);
|
|
53378
|
-
const resolutionIsNode16OrNext =
|
|
53379
|
-
if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) &&
|
|
53433
|
+
const resolutionIsNode16OrNext = moduleResolutionKind2 === 3 /* Node16 */ || moduleResolutionKind2 === 99 /* NodeNext */;
|
|
53434
|
+
if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind2 !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
53380
53435
|
error2(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
53381
53436
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
53382
53437
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
@@ -53462,7 +53517,7 @@ function createTypeChecker(host) {
|
|
|
53462
53517
|
return links.cjsExportMerged = merged;
|
|
53463
53518
|
}
|
|
53464
53519
|
function resolveESModuleSymbol(moduleSymbol, referencingLocation, dontResolveAlias, suppressInteropError) {
|
|
53465
|
-
var
|
|
53520
|
+
var _a2;
|
|
53466
53521
|
const symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias);
|
|
53467
53522
|
if (!dontResolveAlias && symbol) {
|
|
53468
53523
|
if (!suppressInteropError && !(symbol.flags & (1536 /* Module */ | 3 /* Variable */)) && !getDeclarationOfKind(symbol, 307 /* SourceFile */)) {
|
|
@@ -53478,7 +53533,7 @@ function createTypeChecker(host) {
|
|
|
53478
53533
|
if (defaultOnlyType) {
|
|
53479
53534
|
return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent);
|
|
53480
53535
|
}
|
|
53481
|
-
const targetFile = (
|
|
53536
|
+
const targetFile = (_a2 = moduleSymbol == null ? void 0 : moduleSymbol.declarations) == null ? void 0 : _a2.find(isSourceFile);
|
|
53482
53537
|
const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(getEmitSyntaxForModuleSpecifierExpression(reference), host.getImpliedNodeFormatForEmit(targetFile));
|
|
53483
53538
|
if (getESModuleInterop(compilerOptions) || isEsmCjsRef) {
|
|
53484
53539
|
let sigs = getSignaturesOfStructuredType(type, 0 /* Call */);
|
|
@@ -53687,8 +53742,8 @@ function createTypeChecker(host) {
|
|
|
53687
53742
|
return getMergedSymbol(symbol.parent && getLateBoundSymbol(symbol.parent));
|
|
53688
53743
|
}
|
|
53689
53744
|
function getFunctionExpressionParentSymbolOrSymbol(symbol) {
|
|
53690
|
-
var
|
|
53691
|
-
return ((
|
|
53745
|
+
var _a2, _b;
|
|
53746
|
+
return ((_a2 = symbol.valueDeclaration) == null ? void 0 : _a2.kind) === 219 /* ArrowFunction */ || ((_b = symbol.valueDeclaration) == null ? void 0 : _b.kind) === 218 /* FunctionExpression */ ? getSymbolOfNode(symbol.valueDeclaration.parent) || symbol : symbol;
|
|
53692
53747
|
}
|
|
53693
53748
|
function getAlternativeContainingModules(symbol, enclosingDeclaration) {
|
|
53694
53749
|
const containingFile = getSourceFileOfNode(enclosingDeclaration);
|
|
@@ -53842,11 +53897,11 @@ function createTypeChecker(host) {
|
|
|
53842
53897
|
return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && getSymbolFlags(symbol, !includeTypeOnlyMembers) & 111551 /* Value */);
|
|
53843
53898
|
}
|
|
53844
53899
|
function createType(flags) {
|
|
53845
|
-
var
|
|
53846
|
-
const result = new
|
|
53900
|
+
var _a2;
|
|
53901
|
+
const result = new Type29(checker, flags);
|
|
53847
53902
|
typeCount++;
|
|
53848
53903
|
result.id = typeCount;
|
|
53849
|
-
(
|
|
53904
|
+
(_a2 = tracing) == null ? void 0 : _a2.recordType(result);
|
|
53850
53905
|
return result;
|
|
53851
53906
|
}
|
|
53852
53907
|
function createTypeWithSymbol(flags, symbol) {
|
|
@@ -53855,7 +53910,7 @@ function createTypeChecker(host) {
|
|
|
53855
53910
|
return result;
|
|
53856
53911
|
}
|
|
53857
53912
|
function createOriginType(flags) {
|
|
53858
|
-
return new
|
|
53913
|
+
return new Type29(checker, flags);
|
|
53859
53914
|
}
|
|
53860
53915
|
function createIntrinsicType(kind, intrinsicName, objectFlags = 0 /* None */, debugIntrinsicName) {
|
|
53861
53916
|
checkIntrinsicName(intrinsicName, debugIntrinsicName);
|
|
@@ -54265,7 +54320,7 @@ function createTypeChecker(host) {
|
|
|
54265
54320
|
}
|
|
54266
54321
|
return { accessibility: 0 /* Accessible */, aliasesToMakeVisible };
|
|
54267
54322
|
function getIsDeclarationVisible(declaration) {
|
|
54268
|
-
var
|
|
54323
|
+
var _a2, _b;
|
|
54269
54324
|
if (!isDeclarationVisible(declaration)) {
|
|
54270
54325
|
const anyImportSyntax = getAnyImportSyntax(declaration);
|
|
54271
54326
|
if (anyImportSyntax && !hasSyntacticModifier(anyImportSyntax, 32 /* Export */) && // import clause without export
|
|
@@ -54277,7 +54332,7 @@ function createTypeChecker(host) {
|
|
|
54277
54332
|
} else if (isLateVisibilityPaintedStatement(declaration) && !hasSyntacticModifier(declaration, 32 /* Export */) && isDeclarationVisible(declaration.parent)) {
|
|
54278
54333
|
return addVisibleAlias(declaration, declaration);
|
|
54279
54334
|
} else if (isBindingElement(declaration)) {
|
|
54280
|
-
if (symbol.flags & 2097152 /* Alias */ && isInJSFile(declaration) && ((
|
|
54335
|
+
if (symbol.flags & 2097152 /* Alias */ && isInJSFile(declaration) && ((_a2 = declaration.parent) == null ? void 0 : _a2.parent) && isVariableDeclaration(declaration.parent.parent) && ((_b = declaration.parent.parent.parent) == null ? void 0 : _b.parent) && isVariableStatement(declaration.parent.parent.parent.parent) && !hasSyntacticModifier(declaration.parent.parent.parent.parent, 32 /* Export */) && declaration.parent.parent.parent.parent.parent && isDeclarationVisible(declaration.parent.parent.parent.parent.parent)) {
|
|
54281
54336
|
return addVisibleAlias(declaration, declaration.parent.parent.parent.parent);
|
|
54282
54337
|
} else if (symbol.flags & 2 /* BlockScopedVariable */) {
|
|
54283
54338
|
const variableStatement = findAncestor(declaration, isVariableStatement);
|
|
@@ -54453,31 +54508,31 @@ function createTypeChecker(host) {
|
|
|
54453
54508
|
}
|
|
54454
54509
|
function createNodeBuilder() {
|
|
54455
54510
|
return {
|
|
54456
|
-
typeToTypeNode: (type, enclosingDeclaration, flags, tracker) =>
|
|
54457
|
-
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, tracker) =>
|
|
54458
|
-
expressionOrTypeToTypeNode: (expr, type, addUndefined, enclosingDeclaration, flags, tracker) =>
|
|
54459
|
-
serializeTypeForDeclaration: (declaration, type, symbol, enclosingDeclaration, flags, tracker) =>
|
|
54460
|
-
serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, tracker) =>
|
|
54461
|
-
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, tracker) =>
|
|
54511
|
+
typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
|
54512
|
+
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
|
|
54513
|
+
expressionOrTypeToTypeNode: (expr, type, addUndefined, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
|
|
54514
|
+
serializeTypeForDeclaration: (declaration, type, symbol, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(context, declaration, type, symbol)),
|
|
54515
|
+
serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => serializeReturnTypeForSignature(context, signature)),
|
|
54516
|
+
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
|
|
54462
54517
|
indexInfo,
|
|
54463
54518
|
context,
|
|
54464
54519
|
/*typeNode*/
|
|
54465
54520
|
void 0
|
|
54466
54521
|
)),
|
|
54467
|
-
signatureToSignatureDeclaration: (signature, kind, enclosingDeclaration, flags, tracker) =>
|
|
54468
|
-
symbolToEntityName: (symbol, meaning, enclosingDeclaration, flags, tracker) =>
|
|
54522
|
+
signatureToSignatureDeclaration: (signature, kind, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => signatureToSignatureDeclarationHelper(signature, kind, context)),
|
|
54523
|
+
symbolToEntityName: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => symbolToName(
|
|
54469
54524
|
symbol,
|
|
54470
54525
|
context,
|
|
54471
54526
|
meaning,
|
|
54472
54527
|
/*expectsIdentifier*/
|
|
54473
54528
|
false
|
|
54474
54529
|
)),
|
|
54475
|
-
symbolToExpression: (symbol, meaning, enclosingDeclaration, flags, tracker) =>
|
|
54476
|
-
symbolToTypeParameterDeclarations: (symbol, enclosingDeclaration, flags, tracker) =>
|
|
54477
|
-
symbolToParameterDeclaration: (symbol, enclosingDeclaration, flags, tracker) =>
|
|
54478
|
-
typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, tracker) =>
|
|
54479
|
-
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker) =>
|
|
54480
|
-
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) =>
|
|
54530
|
+
symbolToExpression: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => symbolToExpression(symbol, context, meaning)),
|
|
54531
|
+
symbolToTypeParameterDeclarations: (symbol, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => typeParametersToTypeParameterDeclarations(symbol, context)),
|
|
54532
|
+
symbolToParameterDeclaration: (symbol, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => symbolToParameterDeclaration(symbol, context)),
|
|
54533
|
+
typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => typeParameterToDeclaration(parameter, context)),
|
|
54534
|
+
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
|
|
54535
|
+
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
|
|
54481
54536
|
};
|
|
54482
54537
|
function setTextRange2(context, range, location) {
|
|
54483
54538
|
if (!nodeIsSynthesized(range) && !(range.flags & 16 /* Synthesized */) && (!context.enclosingFile || context.enclosingFile !== getSourceFileOfNode(range))) {
|
|
@@ -54560,7 +54615,7 @@ function createTypeChecker(host) {
|
|
|
54560
54615
|
}
|
|
54561
54616
|
return symbolToExpression(symbol, context, meaning);
|
|
54562
54617
|
}
|
|
54563
|
-
function
|
|
54618
|
+
function withContext2(enclosingDeclaration, flags, tracker, cb) {
|
|
54564
54619
|
Debug.assert(enclosingDeclaration === void 0 || (enclosingDeclaration.flags & 16 /* Synthesized */) === 0);
|
|
54565
54620
|
const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost : flags & 134217728 /* DoNotIncludeSymbolChain */ ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : void 0;
|
|
54566
54621
|
const context = {
|
|
@@ -54596,7 +54651,7 @@ function createTypeChecker(host) {
|
|
|
54596
54651
|
return typeNode;
|
|
54597
54652
|
}
|
|
54598
54653
|
function typeToTypeNodeWorker(type, context) {
|
|
54599
|
-
var
|
|
54654
|
+
var _a2, _b;
|
|
54600
54655
|
if (cancellationToken && cancellationToken.throwIfCancellationRequested) {
|
|
54601
54656
|
cancellationToken.throwIfCancellationRequested();
|
|
54602
54657
|
}
|
|
@@ -54730,7 +54785,7 @@ function createTypeChecker(host) {
|
|
|
54730
54785
|
if (!context.encounteredError && !(context.flags & 32768 /* AllowThisInObjectLiteral */)) {
|
|
54731
54786
|
context.encounteredError = true;
|
|
54732
54787
|
}
|
|
54733
|
-
(_b = (
|
|
54788
|
+
(_b = (_a2 = context.tracker).reportInaccessibleThisError) == null ? void 0 : _b.call(_a2);
|
|
54734
54789
|
}
|
|
54735
54790
|
context.approximateLength += 4;
|
|
54736
54791
|
return factory.createThisTypeNode();
|
|
@@ -54895,9 +54950,9 @@ function createTypeChecker(host) {
|
|
|
54895
54950
|
return factory.createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode);
|
|
54896
54951
|
}
|
|
54897
54952
|
function typeToTypeNodeOrCircularityElision(type2) {
|
|
54898
|
-
var
|
|
54953
|
+
var _a3, _b2, _c;
|
|
54899
54954
|
if (type2.flags & 1048576 /* Union */) {
|
|
54900
|
-
if ((
|
|
54955
|
+
if ((_a3 = context.visitedTypes) == null ? void 0 : _a3.has(getTypeId(type2))) {
|
|
54901
54956
|
if (!(context.flags & 131072 /* AllowAnonymousIdentifier */)) {
|
|
54902
54957
|
context.encounteredError = true;
|
|
54903
54958
|
(_c = (_b2 = context.tracker) == null ? void 0 : _b2.reportCyclicStructureError) == null ? void 0 : _c.call(_b2);
|
|
@@ -54915,13 +54970,13 @@ function createTypeChecker(host) {
|
|
|
54915
54970
|
return !!type2.target && isMappedTypeHomomorphic(type2.target) && !isMappedTypeHomomorphic(type2);
|
|
54916
54971
|
}
|
|
54917
54972
|
function createMappedTypeNodeFromType(type2) {
|
|
54918
|
-
var
|
|
54973
|
+
var _a3;
|
|
54919
54974
|
Debug.assert(!!(type2.flags & 524288 /* Object */));
|
|
54920
54975
|
const readonlyToken = type2.declaration.readonlyToken ? factory.createToken(type2.declaration.readonlyToken.kind) : void 0;
|
|
54921
54976
|
const questionToken = type2.declaration.questionToken ? factory.createToken(type2.declaration.questionToken.kind) : void 0;
|
|
54922
54977
|
let appropriateConstraintTypeNode;
|
|
54923
54978
|
let newTypeVariable;
|
|
54924
|
-
const needsModifierPreservingWrapper = !isMappedTypeWithKeyofConstraintDeclaration(type2) && !(getModifiersTypeFromMappedType(type2).flags & 2 /* Unknown */) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && !(getConstraintTypeFromMappedType(type2).flags & 262144 /* TypeParameter */ && ((
|
|
54979
|
+
const needsModifierPreservingWrapper = !isMappedTypeWithKeyofConstraintDeclaration(type2) && !(getModifiersTypeFromMappedType(type2).flags & 2 /* Unknown */) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && !(getConstraintTypeFromMappedType(type2).flags & 262144 /* TypeParameter */ && ((_a3 = getConstraintOfTypeParameter(getConstraintTypeFromMappedType(type2))) == null ? void 0 : _a3.flags) & 4194304 /* Index */);
|
|
54925
54980
|
if (isMappedTypeWithKeyofConstraintDeclaration(type2)) {
|
|
54926
54981
|
if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
54927
54982
|
const newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
|
|
@@ -54980,7 +55035,7 @@ function createTypeChecker(host) {
|
|
|
54980
55035
|
return result;
|
|
54981
55036
|
}
|
|
54982
55037
|
function createAnonymousTypeNode(type2) {
|
|
54983
|
-
var
|
|
55038
|
+
var _a3, _b2;
|
|
54984
55039
|
const typeId = type2.id;
|
|
54985
55040
|
const symbol = type2.symbol;
|
|
54986
55041
|
if (symbol) {
|
|
@@ -54994,7 +55049,7 @@ function createTypeChecker(host) {
|
|
|
54994
55049
|
return typeNode;
|
|
54995
55050
|
}
|
|
54996
55051
|
}
|
|
54997
|
-
if ((
|
|
55052
|
+
if ((_a3 = context.visitedTypes) == null ? void 0 : _a3.has(typeId)) {
|
|
54998
55053
|
return createElidedInformationPlaceholder(context);
|
|
54999
55054
|
}
|
|
55000
55055
|
return visitAndTransformType(type2, createTypeNodeFromObjectType);
|
|
@@ -55024,19 +55079,19 @@ function createTypeChecker(host) {
|
|
|
55024
55079
|
return createTypeNodeFromObjectType(type2);
|
|
55025
55080
|
}
|
|
55026
55081
|
function shouldWriteTypeOfFunctionSymbol() {
|
|
55027
|
-
var
|
|
55082
|
+
var _a4;
|
|
55028
55083
|
const isStaticMethodSymbol = !!(symbol.flags & 8192 /* Method */) && // typeof static method
|
|
55029
55084
|
some(symbol.declarations, (declaration) => isStatic(declaration));
|
|
55030
55085
|
const isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || // is exported function symbol
|
|
55031
55086
|
forEach(symbol.declarations, (declaration) => declaration.parent.kind === 307 /* SourceFile */ || declaration.parent.kind === 268 /* ModuleBlock */));
|
|
55032
55087
|
if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
|
|
55033
|
-
return (!!(context.flags & 4096 /* UseTypeOfFunction */) || ((
|
|
55088
|
+
return (!!(context.flags & 4096 /* UseTypeOfFunction */) || ((_a4 = context.visitedTypes) == null ? void 0 : _a4.has(typeId))) && // it is type of the symbol uses itself recursively
|
|
55034
55089
|
(!(context.flags & 8 /* UseStructuralFallback */) || isValueSymbolAccessible(symbol, context.enclosingDeclaration));
|
|
55035
55090
|
}
|
|
55036
55091
|
}
|
|
55037
55092
|
}
|
|
55038
55093
|
function visitAndTransformType(type2, transform2) {
|
|
55039
|
-
var
|
|
55094
|
+
var _a3, _b2, _c;
|
|
55040
55095
|
const typeId = type2.id;
|
|
55041
55096
|
const isConstructorObject = getObjectFlags(type2) & 16 /* Anonymous */ && type2.symbol && type2.symbol.flags & 32 /* Class */;
|
|
55042
55097
|
const id = getObjectFlags(type2) & 4 /* Reference */ && type2.node ? "N" + getNodeId(type2.node) : type2.flags & 16777216 /* Conditional */ ? "N" + getNodeId(type2.root.node) : type2.symbol ? (isConstructorObject ? "+" : "") + getSymbolId(type2.symbol) : void 0;
|
|
@@ -55051,7 +55106,7 @@ function createTypeChecker(host) {
|
|
|
55051
55106
|
if (links) {
|
|
55052
55107
|
links.serializedTypes || (links.serializedTypes = /* @__PURE__ */ new Map());
|
|
55053
55108
|
}
|
|
55054
|
-
const cachedResult = (
|
|
55109
|
+
const cachedResult = (_a3 = links == null ? void 0 : links.serializedTypes) == null ? void 0 : _a3.get(key);
|
|
55055
55110
|
if (cachedResult) {
|
|
55056
55111
|
(_b2 = cachedResult.trackedSymbols) == null ? void 0 : _b2.forEach(
|
|
55057
55112
|
([symbol, enclosingDeclaration, meaning]) => context.tracker.trackSymbol(
|
|
@@ -55229,36 +55284,7 @@ function createTypeChecker(host) {
|
|
|
55229
55284
|
}
|
|
55230
55285
|
let typeArgumentNodes;
|
|
55231
55286
|
if (typeArguments.length > 0) {
|
|
55232
|
-
|
|
55233
|
-
if (type2.target.typeParameters) {
|
|
55234
|
-
typeParameterCount = Math.min(type2.target.typeParameters.length, typeArguments.length);
|
|
55235
|
-
if (isReferenceToType2(type2, getGlobalIterableType(
|
|
55236
|
-
/*reportErrors*/
|
|
55237
|
-
false
|
|
55238
|
-
)) || isReferenceToType2(type2, getGlobalIterableIteratorType(
|
|
55239
|
-
/*reportErrors*/
|
|
55240
|
-
false
|
|
55241
|
-
)) || isReferenceToType2(type2, getGlobalAsyncIterableType(
|
|
55242
|
-
/*reportErrors*/
|
|
55243
|
-
false
|
|
55244
|
-
)) || isReferenceToType2(type2, getGlobalAsyncIterableIteratorType(
|
|
55245
|
-
/*reportErrors*/
|
|
55246
|
-
false
|
|
55247
|
-
))) {
|
|
55248
|
-
if (!type2.node || !isTypeReferenceNode(type2.node) || !type2.node.typeArguments || type2.node.typeArguments.length < typeParameterCount) {
|
|
55249
|
-
while (typeParameterCount > 0) {
|
|
55250
|
-
const typeArgument = typeArguments[typeParameterCount - 1];
|
|
55251
|
-
const defaultType = getDefaultFromTypeParameter(type2.target.typeParameters[typeParameterCount - 1]);
|
|
55252
|
-
if (!defaultType || !isTypeIdenticalTo(typeArgument, defaultType)) {
|
|
55253
|
-
break;
|
|
55254
|
-
}
|
|
55255
|
-
typeParameterCount--;
|
|
55256
|
-
}
|
|
55257
|
-
}
|
|
55258
|
-
}
|
|
55259
|
-
} else {
|
|
55260
|
-
typeParameterCount = 0;
|
|
55261
|
-
}
|
|
55287
|
+
const typeParameterCount = (type2.target.typeParameters || emptyArray).length;
|
|
55262
55288
|
typeArgumentNodes = mapToTypeNodes(typeArguments.slice(i, typeParameterCount), context);
|
|
55263
55289
|
}
|
|
55264
55290
|
const flags = context.flags;
|
|
@@ -55399,11 +55425,11 @@ function createTypeChecker(host) {
|
|
|
55399
55425
|
return factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
55400
55426
|
}
|
|
55401
55427
|
function shouldUsePlaceholderForProperty(propertySymbol, context) {
|
|
55402
|
-
var
|
|
55403
|
-
return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((
|
|
55428
|
+
var _a2;
|
|
55429
|
+
return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a2 = context.reverseMappedStack) == null ? void 0 : _a2[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */));
|
|
55404
55430
|
}
|
|
55405
55431
|
function addPropertyToElementList(propertySymbol, context, typeElements) {
|
|
55406
|
-
var
|
|
55432
|
+
var _a2;
|
|
55407
55433
|
const propertyIsReverseMapped = !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */);
|
|
55408
55434
|
const propertyType = shouldUsePlaceholderForProperty(propertySymbol, context) ? anyType : getNonMissingTypeOfSymbol(propertySymbol);
|
|
55409
55435
|
const saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
@@ -55425,7 +55451,7 @@ function createTypeChecker(host) {
|
|
|
55425
55451
|
context.tracker.reportNonSerializableProperty(symbolToString(propertySymbol));
|
|
55426
55452
|
}
|
|
55427
55453
|
}
|
|
55428
|
-
context.enclosingDeclaration = propertySymbol.valueDeclaration || ((
|
|
55454
|
+
context.enclosingDeclaration = propertySymbol.valueDeclaration || ((_a2 = propertySymbol.declarations) == null ? void 0 : _a2[0]) || saveEnclosingDeclaration;
|
|
55429
55455
|
const propertyName = getPropertyNameNodeForSymbol(propertySymbol, context);
|
|
55430
55456
|
context.enclosingDeclaration = saveEnclosingDeclaration;
|
|
55431
55457
|
context.approximateLength += symbolName(propertySymbol).length + 1;
|
|
@@ -55493,8 +55519,8 @@ function createTypeChecker(host) {
|
|
|
55493
55519
|
);
|
|
55494
55520
|
typeElements.push(preserveCommentsOn(propertySignature));
|
|
55495
55521
|
function preserveCommentsOn(node) {
|
|
55496
|
-
var
|
|
55497
|
-
const jsdocPropertyTag = (
|
|
55522
|
+
var _a3;
|
|
55523
|
+
const jsdocPropertyTag = (_a3 = propertySymbol.declarations) == null ? void 0 : _a3.find((d) => d.kind === 348 /* JSDocPropertyTag */);
|
|
55498
55524
|
if (jsdocPropertyTag) {
|
|
55499
55525
|
const commentText = getTextOfJSDocComment(jsdocPropertyTag.comment);
|
|
55500
55526
|
if (commentText) {
|
|
@@ -55601,7 +55627,7 @@ function createTypeChecker(host) {
|
|
|
55601
55627
|
);
|
|
55602
55628
|
}
|
|
55603
55629
|
function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
|
|
55604
|
-
var
|
|
55630
|
+
var _a2;
|
|
55605
55631
|
const flags = context.flags;
|
|
55606
55632
|
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
55607
55633
|
context.approximateLength += 3;
|
|
@@ -55691,7 +55717,7 @@ function createTypeChecker(host) {
|
|
|
55691
55717
|
if (typeArguments) {
|
|
55692
55718
|
node.typeArguments = factory.createNodeArray(typeArguments);
|
|
55693
55719
|
}
|
|
55694
|
-
if (((
|
|
55720
|
+
if (((_a2 = signature.declaration) == null ? void 0 : _a2.kind) === 323 /* JSDocSignature */ && signature.declaration.parent.kind === 339 /* JSDocOverloadTag */) {
|
|
55695
55721
|
const comment = getTextOfNode(
|
|
55696
55722
|
signature.declaration.parent.parent,
|
|
55697
55723
|
/*includeTrivia*/
|
|
@@ -56023,11 +56049,11 @@ function createTypeChecker(host) {
|
|
|
56023
56049
|
return typeParameterNodes;
|
|
56024
56050
|
}
|
|
56025
56051
|
function lookupTypeParameterNodes(chain, index, context) {
|
|
56026
|
-
var
|
|
56052
|
+
var _a2;
|
|
56027
56053
|
Debug.assert(chain && 0 <= index && index < chain.length);
|
|
56028
56054
|
const symbol = chain[index];
|
|
56029
56055
|
const symbolId = getSymbolId(symbol);
|
|
56030
|
-
if ((
|
|
56056
|
+
if ((_a2 = context.typeParameterSymbolList) == null ? void 0 : _a2.has(symbolId)) {
|
|
56031
56057
|
return void 0;
|
|
56032
56058
|
}
|
|
56033
56059
|
(context.typeParameterSymbolList || (context.typeParameterSymbolList = /* @__PURE__ */ new Set())).add(symbolId);
|
|
@@ -56262,7 +56288,7 @@ function createTypeChecker(host) {
|
|
|
56262
56288
|
return false;
|
|
56263
56289
|
}
|
|
56264
56290
|
function typeParameterToName(type, context) {
|
|
56265
|
-
var
|
|
56291
|
+
var _a2, _b;
|
|
56266
56292
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && context.typeParameterNames) {
|
|
56267
56293
|
const cached = context.typeParameterNames.get(getTypeId(type));
|
|
56268
56294
|
if (cached) {
|
|
@@ -56281,7 +56307,7 @@ function createTypeChecker(host) {
|
|
|
56281
56307
|
}
|
|
56282
56308
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
56283
56309
|
const rawtext = result.escapedText;
|
|
56284
|
-
let i = ((
|
|
56310
|
+
let i = ((_a2 = context.typeParameterNamesByTextNextNameCount) == null ? void 0 : _a2.get(rawtext)) || 0;
|
|
56285
56311
|
let text = rawtext;
|
|
56286
56312
|
while (((_b = context.typeParameterNamesByText) == null ? void 0 : _b.has(text)) || typeParameterShadowsOtherTypeParameterInScope(text, context, type)) {
|
|
56287
56313
|
i++;
|
|
@@ -56457,7 +56483,7 @@ function createTypeChecker(host) {
|
|
|
56457
56483
|
return enclosingDeclaration;
|
|
56458
56484
|
}
|
|
56459
56485
|
function serializeTypeForDeclaration(context, declaration, type, symbol) {
|
|
56460
|
-
var
|
|
56486
|
+
var _a2;
|
|
56461
56487
|
const addUndefined = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
|
|
56462
56488
|
const enclosingDeclaration = context.enclosingDeclaration;
|
|
56463
56489
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
@@ -56474,7 +56500,7 @@ function createTypeChecker(host) {
|
|
|
56474
56500
|
if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)))) {
|
|
56475
56501
|
context.flags |= 1048576 /* AllowUniqueESSymbolType */;
|
|
56476
56502
|
}
|
|
56477
|
-
const decl = declaration ?? symbol.valueDeclaration ?? ((
|
|
56503
|
+
const decl = declaration ?? symbol.valueDeclaration ?? ((_a2 = symbol.declarations) == null ? void 0 : _a2[0]);
|
|
56478
56504
|
const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
|
|
56479
56505
|
if (decl && hasInferredType(decl) && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
|
|
56480
56506
|
syntacticNodeBuilder.serializeTypeOfDeclaration(decl, context);
|
|
@@ -56835,7 +56861,7 @@ function createTypeChecker(host) {
|
|
|
56835
56861
|
}
|
|
56836
56862
|
}
|
|
56837
56863
|
function symbolTableToDeclarationStatements(symbolTable, context) {
|
|
56838
|
-
var
|
|
56864
|
+
var _a2;
|
|
56839
56865
|
const serializePropertySymbolForClass = makeSerializePropertySymbol(
|
|
56840
56866
|
factory.createPropertyDeclaration,
|
|
56841
56867
|
174 /* MethodDeclaration */,
|
|
@@ -56857,14 +56883,14 @@ function createTypeChecker(host) {
|
|
|
56857
56883
|
...oldcontext,
|
|
56858
56884
|
usedSymbolNames: new Set(oldcontext.usedSymbolNames),
|
|
56859
56885
|
remappedSymbolNames: /* @__PURE__ */ new Map(),
|
|
56860
|
-
remappedSymbolReferences: new Map((
|
|
56886
|
+
remappedSymbolReferences: new Map((_a2 = oldcontext.remappedSymbolReferences) == null ? void 0 : _a2.entries()),
|
|
56861
56887
|
tracker: void 0
|
|
56862
56888
|
};
|
|
56863
56889
|
const tracker = {
|
|
56864
56890
|
...oldcontext.tracker.inner,
|
|
56865
56891
|
trackSymbol: (sym, decl, meaning) => {
|
|
56866
|
-
var
|
|
56867
|
-
if ((
|
|
56892
|
+
var _a3, _b;
|
|
56893
|
+
if ((_a3 = context.remappedSymbolNames) == null ? void 0 : _a3.has(getSymbolId(sym)))
|
|
56868
56894
|
return false;
|
|
56869
56895
|
const accessibleResult = isSymbolAccessible(
|
|
56870
56896
|
sym,
|
|
@@ -57099,7 +57125,7 @@ function createTypeChecker(host) {
|
|
|
57099
57125
|
}
|
|
57100
57126
|
}
|
|
57101
57127
|
function serializeSymbolWorker(symbol, isPrivate, propertyAsAlias, escapedSymbolName = symbol.escapedName) {
|
|
57102
|
-
var
|
|
57128
|
+
var _a3, _b, _c, _d, _e, _f;
|
|
57103
57129
|
const symbolName2 = unescapeLeadingUnderscores(escapedSymbolName);
|
|
57104
57130
|
const isDefault = escapedSymbolName === "default" /* Default */;
|
|
57105
57131
|
if (isPrivate && !(context.flags & 131072 /* AllowAnonymousIdentifier */) && isStringANonContextualKeyword(symbolName2) && !isDefault) {
|
|
@@ -57130,7 +57156,7 @@ function createTypeChecker(host) {
|
|
|
57130
57156
|
} else {
|
|
57131
57157
|
const type = getTypeOfSymbol(symbol);
|
|
57132
57158
|
const localName = getInternalSymbolName(symbol, symbolName2);
|
|
57133
|
-
if (type.symbol && type.symbol !== symbol && type.symbol.flags & 16 /* Function */ && some(type.symbol.declarations, isFunctionExpressionOrArrowFunction) && (((
|
|
57159
|
+
if (type.symbol && type.symbol !== symbol && type.symbol.flags & 16 /* Function */ && some(type.symbol.declarations, isFunctionExpressionOrArrowFunction) && (((_a3 = type.symbol.members) == null ? void 0 : _a3.size) || ((_b = type.symbol.exports) == null ? void 0 : _b.size))) {
|
|
57134
57160
|
if (!context.remappedSymbolReferences) {
|
|
57135
57161
|
context.remappedSymbolReferences = /* @__PURE__ */ new Map();
|
|
57136
57162
|
}
|
|
@@ -57309,11 +57335,11 @@ function createTypeChecker(host) {
|
|
|
57309
57335
|
results.push(node);
|
|
57310
57336
|
}
|
|
57311
57337
|
function serializeTypeAlias(symbol, symbolName2, modifierFlags) {
|
|
57312
|
-
var
|
|
57338
|
+
var _a3;
|
|
57313
57339
|
const aliasType = getDeclaredTypeOfTypeAlias(symbol);
|
|
57314
57340
|
const typeParams = getSymbolLinks(symbol).typeParameters;
|
|
57315
57341
|
const typeParamDecls = map(typeParams, (p) => typeParameterToDeclaration(p, context));
|
|
57316
|
-
const jsdocAliasDecl = (
|
|
57342
|
+
const jsdocAliasDecl = (_a3 = symbol.declarations) == null ? void 0 : _a3.find(isJSDocTypeAlias);
|
|
57317
57343
|
const commentText = getTextOfJSDocComment(jsdocAliasDecl ? jsdocAliasDecl.comment || jsdocAliasDecl.parent.comment : void 0);
|
|
57318
57344
|
const oldFlags = context.flags;
|
|
57319
57345
|
context.flags |= 8388608 /* InTypeAlias */;
|
|
@@ -57400,12 +57426,12 @@ function createTypeChecker(host) {
|
|
|
57400
57426
|
/*isTypeOnly*/
|
|
57401
57427
|
false,
|
|
57402
57428
|
factory.createNamedExports(mapDefined(filter(mergedMembers, (n) => n.escapedName !== "export=" /* ExportEquals */), (s) => {
|
|
57403
|
-
var
|
|
57429
|
+
var _a3, _b;
|
|
57404
57430
|
const name = unescapeLeadingUnderscores(s.escapedName);
|
|
57405
57431
|
const localName2 = getInternalSymbolName(s, name);
|
|
57406
57432
|
const aliasDecl = s.declarations && getDeclarationOfAliasSymbol(s);
|
|
57407
57433
|
if (containingFile && (aliasDecl ? containingFile !== getSourceFileOfNode(aliasDecl) : !some(s.declarations, (d) => getSourceFileOfNode(d) === containingFile))) {
|
|
57408
|
-
(_b = (
|
|
57434
|
+
(_b = (_a3 = context.tracker) == null ? void 0 : _a3.reportNonlocalAugmentation) == null ? void 0 : _b.call(_a3, containingFile, symbol, s);
|
|
57409
57435
|
return void 0;
|
|
57410
57436
|
}
|
|
57411
57437
|
const target = aliasDecl && getTargetOfAliasDeclaration(
|
|
@@ -57571,8 +57597,8 @@ function createTypeChecker(host) {
|
|
|
57571
57597
|
return void 0;
|
|
57572
57598
|
}
|
|
57573
57599
|
function serializeAsClass(symbol, localName, modifierFlags) {
|
|
57574
|
-
var
|
|
57575
|
-
const originalDecl = (
|
|
57600
|
+
var _a3, _b;
|
|
57601
|
+
const originalDecl = (_a3 = symbol.declarations) == null ? void 0 : _a3.find(isClassLike);
|
|
57576
57602
|
const oldEnclosing = context.enclosingDeclaration;
|
|
57577
57603
|
context.enclosingDeclaration = originalDecl || oldEnclosing;
|
|
57578
57604
|
const localParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);
|
|
@@ -57669,7 +57695,7 @@ function createTypeChecker(host) {
|
|
|
57669
57695
|
});
|
|
57670
57696
|
}
|
|
57671
57697
|
function serializeAsAlias(symbol, localName, modifierFlags) {
|
|
57672
|
-
var
|
|
57698
|
+
var _a3, _b, _c, _d, _e, _f;
|
|
57673
57699
|
const node = getDeclarationOfAliasSymbol(symbol);
|
|
57674
57700
|
if (!node)
|
|
57675
57701
|
return Debug.fail();
|
|
@@ -57689,7 +57715,7 @@ function createTypeChecker(host) {
|
|
|
57689
57715
|
includePrivateSymbol(target);
|
|
57690
57716
|
switch (node.kind) {
|
|
57691
57717
|
case 208 /* BindingElement */:
|
|
57692
|
-
if (((_b = (
|
|
57718
|
+
if (((_b = (_a3 = node.parent) == null ? void 0 : _a3.parent) == null ? void 0 : _b.kind) === 260 /* VariableDeclaration */) {
|
|
57693
57719
|
const specifier2 = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
57694
57720
|
const { propertyName } = node;
|
|
57695
57721
|
addResult(
|
|
@@ -57912,7 +57938,7 @@ function createTypeChecker(host) {
|
|
|
57912
57938
|
);
|
|
57913
57939
|
}
|
|
57914
57940
|
function serializeMaybeAliasAssignment(symbol) {
|
|
57915
|
-
var
|
|
57941
|
+
var _a3;
|
|
57916
57942
|
if (symbol.flags & 4194304 /* Prototype */) {
|
|
57917
57943
|
return false;
|
|
57918
57944
|
}
|
|
@@ -57985,7 +58011,7 @@ function createTypeChecker(host) {
|
|
|
57985
58011
|
if (isTypeRepresentableAsFunctionNamespaceMerge(typeToSerialize, symbol)) {
|
|
57986
58012
|
serializeAsFunctionNamespaceMerge(typeToSerialize, symbol, varName, isExportAssignmentCompatibleSymbolName ? 0 /* None */ : 32 /* Export */);
|
|
57987
58013
|
} else {
|
|
57988
|
-
const flags = ((
|
|
58014
|
+
const flags = ((_a3 = context.enclosingDeclaration) == null ? void 0 : _a3.kind) === 267 /* ModuleDeclaration */ && (!(symbol.flags & 98304 /* Accessor */) || symbol.flags & 65536 /* SetAccessor */) ? 1 /* Let */ : 2 /* Const */;
|
|
57989
58015
|
const statement = factory.createVariableStatement(
|
|
57990
58016
|
/*modifiers*/
|
|
57991
58017
|
void 0,
|
|
@@ -58025,9 +58051,9 @@ function createTypeChecker(host) {
|
|
|
58025
58051
|
}
|
|
58026
58052
|
}
|
|
58027
58053
|
function isTypeRepresentableAsFunctionNamespaceMerge(typeToSerialize, hostSymbol) {
|
|
58028
|
-
var
|
|
58054
|
+
var _a3;
|
|
58029
58055
|
const ctxSrc = getSourceFileOfNode(context.enclosingDeclaration);
|
|
58030
|
-
return getObjectFlags(typeToSerialize) & (16 /* Anonymous */ | 32 /* Mapped */) && !some((
|
|
58056
|
+
return getObjectFlags(typeToSerialize) & (16 /* Anonymous */ | 32 /* Mapped */) && !some((_a3 = typeToSerialize.symbol) == null ? void 0 : _a3.declarations, isTypeNode) && // If the type comes straight from a type node, we shouldn't try to break it up
|
|
58031
58057
|
!length(getIndexInfosOfType(typeToSerialize)) && !isClassInstanceSide(typeToSerialize) && // While a class instance is potentially representable as a NS, prefer printing a reference to the instance type and serializing the class
|
|
58032
58058
|
!!(length(filter(getPropertiesOfType(typeToSerialize), isNamespaceMember)) || length(getSignaturesOfType(typeToSerialize, 0 /* Call */))) && !length(getSignaturesOfType(typeToSerialize, 1 /* Construct */)) && // TODO: could probably serialize as function + ns + class, now that that's OK
|
|
58033
58059
|
!getDeclarationWithTypeAnnotation(hostSymbol, enclosingDeclaration) && !(typeToSerialize.symbol && some(typeToSerialize.symbol.declarations, (d) => getSourceFileOfNode(d) !== ctxSrc)) && !some(getPropertiesOfType(typeToSerialize), (p) => isLateBoundName(p.escapedName)) && !some(getPropertiesOfType(typeToSerialize), (p) => some(p.declarations, (d) => getSourceFileOfNode(d) !== ctxSrc)) && every(getPropertiesOfType(typeToSerialize), (p) => {
|
|
@@ -58042,7 +58068,7 @@ function createTypeChecker(host) {
|
|
|
58042
58068
|
}
|
|
58043
58069
|
function makeSerializePropertySymbol(createProperty2, methodKind, useAccessors) {
|
|
58044
58070
|
return function serializePropertySymbol(p, isStatic2, baseType) {
|
|
58045
|
-
var
|
|
58071
|
+
var _a3, _b, _c, _d, _e;
|
|
58046
58072
|
const modifierFlags = getDeclarationModifierFlagsFromSymbol(p);
|
|
58047
58073
|
const isPrivate = !!(modifierFlags & 2 /* Private */);
|
|
58048
58074
|
if (isStatic2 && p.flags & (788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */)) {
|
|
@@ -58053,7 +58079,7 @@ function createTypeChecker(host) {
|
|
|
58053
58079
|
}
|
|
58054
58080
|
const flag = modifierFlags & ~1024 /* Async */ | (isStatic2 ? 256 /* Static */ : 0);
|
|
58055
58081
|
const name = getPropertyNameNodeForSymbol(p, context);
|
|
58056
|
-
const firstPropertyLikeDecl = (
|
|
58082
|
+
const firstPropertyLikeDecl = (_a3 = p.declarations) == null ? void 0 : _a3.find(or(isPropertyDeclaration, isAccessor, isVariableDeclaration, isPropertySignature, isBinaryExpression, isPropertyAccessExpression));
|
|
58057
58083
|
if (p.flags & 98304 /* Accessor */ && useAccessors) {
|
|
58058
58084
|
const result = [];
|
|
58059
58085
|
if (p.flags & 65536 /* SetAccessor */) {
|
|
@@ -58322,7 +58348,7 @@ function createTypeChecker(host) {
|
|
|
58322
58348
|
}
|
|
58323
58349
|
}
|
|
58324
58350
|
function getUnusedName(input, symbol) {
|
|
58325
|
-
var
|
|
58351
|
+
var _a3, _b;
|
|
58326
58352
|
const id = symbol ? getSymbolId(symbol) : void 0;
|
|
58327
58353
|
if (id) {
|
|
58328
58354
|
if (context.remappedSymbolNames.has(id)) {
|
|
@@ -58334,7 +58360,7 @@ function createTypeChecker(host) {
|
|
|
58334
58360
|
}
|
|
58335
58361
|
let i = 0;
|
|
58336
58362
|
const original = input;
|
|
58337
|
-
while ((
|
|
58363
|
+
while ((_a3 = context.usedSymbolNames) == null ? void 0 : _a3.has(input)) {
|
|
58338
58364
|
i++;
|
|
58339
58365
|
input = `${original}_${i}`;
|
|
58340
58366
|
}
|
|
@@ -58458,8 +58484,8 @@ function createTypeChecker(host) {
|
|
|
58458
58484
|
}
|
|
58459
58485
|
}
|
|
58460
58486
|
function getNameOfSymbolAsWritten(symbol, context) {
|
|
58461
|
-
var
|
|
58462
|
-
if ((
|
|
58487
|
+
var _a2;
|
|
58488
|
+
if ((_a2 = context == null ? void 0 : context.remappedSymbolReferences) == null ? void 0 : _a2.has(getSymbolId(symbol))) {
|
|
58463
58489
|
symbol = context.remappedSymbolReferences.get(getSymbolId(symbol));
|
|
58464
58490
|
}
|
|
58465
58491
|
if (context && symbol.escapedName === "default" /* Default */ && !(context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */) && // If it's not the first part of an entity name, it must print as `default`
|
|
@@ -58717,9 +58743,9 @@ function createTypeChecker(host) {
|
|
|
58717
58743
|
return prop ? getTypeOfSymbol(prop) : void 0;
|
|
58718
58744
|
}
|
|
58719
58745
|
function getTypeOfPropertyOrIndexSignatureOfType(type, name) {
|
|
58720
|
-
var
|
|
58746
|
+
var _a2;
|
|
58721
58747
|
let propType;
|
|
58722
|
-
return getTypeOfPropertyOfType(type, name) || (propType = (
|
|
58748
|
+
return getTypeOfPropertyOfType(type, name) || (propType = (_a2 = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a2.type) && addOptionality(
|
|
58723
58749
|
propType,
|
|
58724
58750
|
/*isProperty*/
|
|
58725
58751
|
true,
|
|
@@ -59207,14 +59233,14 @@ function createTypeChecker(host) {
|
|
|
59207
59233
|
return widened;
|
|
59208
59234
|
}
|
|
59209
59235
|
function getJSContainerObjectType(decl, symbol, init) {
|
|
59210
|
-
var
|
|
59236
|
+
var _a2, _b;
|
|
59211
59237
|
if (!isInJSFile(decl) || !init || !isObjectLiteralExpression(init) || init.properties.length) {
|
|
59212
59238
|
return void 0;
|
|
59213
59239
|
}
|
|
59214
59240
|
const exports2 = createSymbolTable();
|
|
59215
59241
|
while (isBinaryExpression(decl) || isPropertyAccessExpression(decl)) {
|
|
59216
59242
|
const s2 = getSymbolOfNode(decl);
|
|
59217
|
-
if ((
|
|
59243
|
+
if ((_a2 = s2 == null ? void 0 : s2.exports) == null ? void 0 : _a2.size) {
|
|
59218
59244
|
mergeSymbolTable(exports2, s2.exports);
|
|
59219
59245
|
}
|
|
59220
59246
|
decl = isBinaryExpression(decl) ? decl.parent : decl.parent.parent;
|
|
@@ -59228,7 +59254,7 @@ function createTypeChecker(host) {
|
|
|
59228
59254
|
return type;
|
|
59229
59255
|
}
|
|
59230
59256
|
function getAnnotatedTypeForAssignmentDeclaration(declaredType, expression, symbol, declaration) {
|
|
59231
|
-
var
|
|
59257
|
+
var _a2;
|
|
59232
59258
|
const typeNode = getEffectiveTypeAnnotationNode(expression.parent);
|
|
59233
59259
|
if (typeNode) {
|
|
59234
59260
|
const type = getWidenedType(getTypeFromTypeNode(typeNode));
|
|
@@ -59244,7 +59270,7 @@ function createTypeChecker(host) {
|
|
|
59244
59270
|
);
|
|
59245
59271
|
}
|
|
59246
59272
|
}
|
|
59247
|
-
if ((
|
|
59273
|
+
if ((_a2 = symbol.parent) == null ? void 0 : _a2.valueDeclaration) {
|
|
59248
59274
|
const possiblyAnnotatedSymbol = getFunctionExpressionParentSymbolOrSymbol(symbol.parent);
|
|
59249
59275
|
if (possiblyAnnotatedSymbol.valueDeclaration) {
|
|
59250
59276
|
const typeNode2 = getEffectiveTypeAnnotationNode(possiblyAnnotatedSymbol.valueDeclaration);
|
|
@@ -59298,13 +59324,13 @@ function createTypeChecker(host) {
|
|
|
59298
59324
|
resolvedSymbol.exports = createSymbolTable();
|
|
59299
59325
|
}
|
|
59300
59326
|
(resolvedSymbol || symbol).exports.forEach((s, name) => {
|
|
59301
|
-
var
|
|
59327
|
+
var _a2;
|
|
59302
59328
|
const exportedMember = members.get(name);
|
|
59303
59329
|
if (exportedMember && exportedMember !== s && !(s.flags & 2097152 /* Alias */)) {
|
|
59304
59330
|
if (s.flags & 111551 /* Value */ && exportedMember.flags & 111551 /* Value */) {
|
|
59305
59331
|
if (s.valueDeclaration && exportedMember.valueDeclaration && getSourceFileOfNode(s.valueDeclaration) !== getSourceFileOfNode(exportedMember.valueDeclaration)) {
|
|
59306
59332
|
const unescapedName = unescapeLeadingUnderscores(s.escapedName);
|
|
59307
|
-
const exportedMemberName = ((
|
|
59333
|
+
const exportedMemberName = ((_a2 = tryCast(exportedMember.valueDeclaration, isNamedDeclaration)) == null ? void 0 : _a2.name) || exportedMember.valueDeclaration;
|
|
59308
59334
|
addRelatedInfo(
|
|
59309
59335
|
error2(s.valueDeclaration, Diagnostics.Duplicate_identifier_0, unescapedName),
|
|
59310
59336
|
createDiagnosticForNode(exportedMemberName, Diagnostics._0_was_also_declared_here, unescapedName)
|
|
@@ -59977,8 +60003,11 @@ function createTypeChecker(host) {
|
|
|
59977
60003
|
}
|
|
59978
60004
|
}
|
|
59979
60005
|
function getOuterTypeParametersOfClassOrInterface(symbol) {
|
|
59980
|
-
var
|
|
59981
|
-
|
|
60006
|
+
var _a2;
|
|
60007
|
+
if (getCheckFlags(symbol) & 2097152 /* SyntheticInterface */) {
|
|
60008
|
+
return void 0;
|
|
60009
|
+
}
|
|
60010
|
+
const declaration = symbol.flags & 32 /* Class */ || symbol.flags & 16 /* Function */ ? symbol.valueDeclaration : (_a2 = symbol.declarations) == null ? void 0 : _a2.find((decl) => {
|
|
59982
60011
|
if (decl.kind === 264 /* InterfaceDeclaration */) {
|
|
59983
60012
|
return true;
|
|
59984
60013
|
}
|
|
@@ -60299,13 +60328,13 @@ function createTypeChecker(host) {
|
|
|
60299
60328
|
return links.declaredType;
|
|
60300
60329
|
}
|
|
60301
60330
|
function getDeclaredTypeOfTypeAlias(symbol) {
|
|
60302
|
-
var
|
|
60331
|
+
var _a2;
|
|
60303
60332
|
const links = getSymbolLinks(symbol);
|
|
60304
60333
|
if (!links.declaredType) {
|
|
60305
60334
|
if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) {
|
|
60306
60335
|
return errorType;
|
|
60307
60336
|
}
|
|
60308
|
-
const declaration = Debug.checkDefined((
|
|
60337
|
+
const declaration = Debug.checkDefined((_a2 = symbol.declarations) == null ? void 0 : _a2.find(isTypeAlias), "Type alias symbol with no valid declaration found");
|
|
60309
60338
|
const typeNode = isJSDocTypeAlias(declaration) ? declaration.typeExpression : declaration.type;
|
|
60310
60339
|
let type = typeNode ? getTypeFromTypeNode(typeNode) : errorType;
|
|
60311
60340
|
if (popTypeResolution()) {
|
|
@@ -61204,8 +61233,8 @@ function createTypeChecker(host) {
|
|
|
61204
61233
|
if (symbol === globalThisSymbol) {
|
|
61205
61234
|
const varsOnly = /* @__PURE__ */ new Map();
|
|
61206
61235
|
members.forEach((p) => {
|
|
61207
|
-
var
|
|
61208
|
-
if (!(p.flags & 418 /* BlockScoped */) && !(p.flags & 512 /* ValueModule */ && ((
|
|
61236
|
+
var _a2;
|
|
61237
|
+
if (!(p.flags & 418 /* BlockScoped */) && !(p.flags & 512 /* ValueModule */ && ((_a2 = p.declarations) == null ? void 0 : _a2.length) && every(p.declarations, isAmbientModule))) {
|
|
61209
61238
|
varsOnly.set(p.escapedName, p);
|
|
61210
61239
|
}
|
|
61211
61240
|
});
|
|
@@ -61441,7 +61470,7 @@ function createTypeChecker(host) {
|
|
|
61441
61470
|
}
|
|
61442
61471
|
}
|
|
61443
61472
|
function getTypeOfMappedSymbol(symbol) {
|
|
61444
|
-
var
|
|
61473
|
+
var _a2;
|
|
61445
61474
|
if (!symbol.links.type) {
|
|
61446
61475
|
const mappedType = symbol.links.mappedType;
|
|
61447
61476
|
if (!pushTypeResolution(symbol, 0 /* Type */)) {
|
|
@@ -61460,7 +61489,7 @@ function createTypeChecker(host) {
|
|
|
61460
61489
|
error2(currentNode, Diagnostics.Type_of_property_0_circularly_references_itself_in_mapped_type_1, symbolToString(symbol), typeToString(mappedType));
|
|
61461
61490
|
type = errorType;
|
|
61462
61491
|
}
|
|
61463
|
-
(
|
|
61492
|
+
(_a2 = symbol.links).type ?? (_a2.type = type);
|
|
61464
61493
|
}
|
|
61465
61494
|
return symbol.links.type;
|
|
61466
61495
|
}
|
|
@@ -61659,8 +61688,8 @@ function createTypeChecker(host) {
|
|
|
61659
61688
|
return !!typeVariable && isConstTypeVariable(typeVariable, depth);
|
|
61660
61689
|
}
|
|
61661
61690
|
function isConstTypeVariable(type, depth = 0) {
|
|
61662
|
-
var
|
|
61663
|
-
return depth < 5 && !!(type && (type.flags & 262144 /* TypeParameter */ && some((
|
|
61691
|
+
var _a2;
|
|
61692
|
+
return depth < 5 && !!(type && (type.flags & 262144 /* TypeParameter */ && some((_a2 = type.symbol) == null ? void 0 : _a2.declarations, (d) => hasSyntacticModifier(d, 4096 /* Const */)) || type.flags & 3145728 /* UnionOrIntersection */ && some(type.types, (t) => isConstTypeVariable(t, depth)) || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType, depth + 1) || type.flags & 16777216 /* Conditional */ && isConstTypeVariable(getConstraintOfConditionalType(type), depth + 1) || type.flags & 33554432 /* Substitution */ && isConstTypeVariable(type.baseType, depth) || getObjectFlags(type) & 32 /* Mapped */ && isConstMappedType(type, depth) || isGenericTupleType(type) && findIndex(getElementTypes(type), (t, i) => !!(type.target.elementFlags[i] & 8 /* Variadic */) && isConstTypeVariable(t, depth)) >= 0));
|
|
61664
61693
|
}
|
|
61665
61694
|
function getConstraintOfIndexedAccess(type) {
|
|
61666
61695
|
return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : void 0;
|
|
@@ -61951,7 +61980,7 @@ function createTypeChecker(host) {
|
|
|
61951
61980
|
return getReducedType(getApparentType(getReducedType(type)));
|
|
61952
61981
|
}
|
|
61953
61982
|
function createUnionOrIntersectionProperty(containingType, name, skipObjectFunctionPropertyAugment) {
|
|
61954
|
-
var
|
|
61983
|
+
var _a2, _b, _c;
|
|
61955
61984
|
let singleProp;
|
|
61956
61985
|
let propSet;
|
|
61957
61986
|
let indexTypes;
|
|
@@ -62019,7 +62048,7 @@ function createTypeChecker(host) {
|
|
|
62019
62048
|
}
|
|
62020
62049
|
if (!propSet && !(checkFlags & 16 /* ReadPartial */) && !indexTypes) {
|
|
62021
62050
|
if (mergedInstantiations) {
|
|
62022
|
-
const links = (
|
|
62051
|
+
const links = (_a2 = tryCast(singleProp, isTransientSymbol)) == null ? void 0 : _a2.links;
|
|
62023
62052
|
const clone2 = createSymbolWithType(singleProp, links == null ? void 0 : links.type);
|
|
62024
62053
|
clone2.parent = (_c = (_b = singleProp.valueDeclaration) == null ? void 0 : _b.symbol) == null ? void 0 : _c.parent;
|
|
62025
62054
|
clone2.links.containingType = containingType;
|
|
@@ -62090,8 +62119,8 @@ function createTypeChecker(host) {
|
|
|
62090
62119
|
return result;
|
|
62091
62120
|
}
|
|
62092
62121
|
function getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment) {
|
|
62093
|
-
var
|
|
62094
|
-
let property = skipObjectFunctionPropertyAugment ? (
|
|
62122
|
+
var _a2, _b, _c;
|
|
62123
|
+
let property = skipObjectFunctionPropertyAugment ? (_a2 = type.propertyCacheWithoutObjectFunctionPropertyAugment) == null ? void 0 : _a2.get(name) : (_b = type.propertyCache) == null ? void 0 : _b.get(name);
|
|
62095
62124
|
if (!property) {
|
|
62096
62125
|
property = createUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment);
|
|
62097
62126
|
if (property) {
|
|
@@ -62192,12 +62221,12 @@ function createTypeChecker(host) {
|
|
|
62192
62221
|
return errorInfo;
|
|
62193
62222
|
}
|
|
62194
62223
|
function getPropertyOfType(type, name, skipObjectFunctionPropertyAugment, includeTypeOnlyMembers) {
|
|
62195
|
-
var
|
|
62224
|
+
var _a2, _b;
|
|
62196
62225
|
type = getReducedApparentType(type);
|
|
62197
62226
|
if (type.flags & 524288 /* Object */) {
|
|
62198
62227
|
const resolved = resolveStructuredTypeMembers(type);
|
|
62199
62228
|
const symbol = resolved.members.get(name);
|
|
62200
|
-
if (symbol && !includeTypeOnlyMembers && ((
|
|
62229
|
+
if (symbol && !includeTypeOnlyMembers && ((_a2 = type.symbol) == null ? void 0 : _a2.flags) & 512 /* ValueModule */ && ((_b = getSymbolLinks(type.symbol).typeOnlyExportStarMap) == null ? void 0 : _b.has(name))) {
|
|
62201
62230
|
return void 0;
|
|
62202
62231
|
}
|
|
62203
62232
|
if (symbol && symbolIsValue(symbol, includeTypeOnlyMembers)) {
|
|
@@ -62249,8 +62278,8 @@ function createTypeChecker(host) {
|
|
|
62249
62278
|
}
|
|
62250
62279
|
let memberName;
|
|
62251
62280
|
if (everyType(type, (t) => {
|
|
62252
|
-
var
|
|
62253
|
-
return !!((
|
|
62281
|
+
var _a2;
|
|
62282
|
+
return !!((_a2 = t.symbol) == null ? void 0 : _a2.parent) && isArrayOrTupleSymbol(t.symbol.parent) && (!memberName ? (memberName = t.symbol.escapedName, true) : memberName === t.symbol.escapedName);
|
|
62254
62283
|
})) {
|
|
62255
62284
|
const arrayArg = mapType(type, (t) => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters[0], t.mapper));
|
|
62256
62285
|
const arrayType = createArrayType(arrayArg, someType(type, (t) => isReadonlyArraySymbol(t.symbol.parent)));
|
|
@@ -62314,8 +62343,8 @@ function createTypeChecker(host) {
|
|
|
62314
62343
|
return findIndexInfo(getIndexInfosOfType(type), keyType);
|
|
62315
62344
|
}
|
|
62316
62345
|
function getIndexTypeOfType(type, keyType) {
|
|
62317
|
-
var
|
|
62318
|
-
return (
|
|
62346
|
+
var _a2;
|
|
62347
|
+
return (_a2 = getIndexInfoOfType(type, keyType)) == null ? void 0 : _a2.type;
|
|
62319
62348
|
}
|
|
62320
62349
|
function getApplicableIndexInfos(type, keyType) {
|
|
62321
62350
|
return getIndexInfosOfType(type).filter((info) => isApplicableIndexType(keyType, info.keyType));
|
|
@@ -62327,12 +62356,12 @@ function createTypeChecker(host) {
|
|
|
62327
62356
|
return getApplicableIndexInfo(type, isLateBoundName(name) ? esSymbolType : getStringLiteralType(unescapeLeadingUnderscores(name)));
|
|
62328
62357
|
}
|
|
62329
62358
|
function getTypeParametersFromDeclaration(declaration) {
|
|
62330
|
-
var
|
|
62359
|
+
var _a2;
|
|
62331
62360
|
let result;
|
|
62332
62361
|
for (const node of getEffectiveTypeParameterDeclarations(declaration)) {
|
|
62333
62362
|
result = appendIfUnique(result, getDeclaredTypeOfTypeParameter(node.symbol));
|
|
62334
62363
|
}
|
|
62335
|
-
return (result == null ? void 0 : result.length) ? result : isFunctionDeclaration(declaration) ? (
|
|
62364
|
+
return (result == null ? void 0 : result.length) ? result : isFunctionDeclaration(declaration) ? (_a2 = getSignatureOfTypeTag(declaration)) == null ? void 0 : _a2.typeParameters : void 0;
|
|
62336
62365
|
}
|
|
62337
62366
|
function symbolsToArray(symbols) {
|
|
62338
62367
|
const result = [];
|
|
@@ -62819,9 +62848,9 @@ function createTypeChecker(host) {
|
|
|
62819
62848
|
return signature;
|
|
62820
62849
|
}
|
|
62821
62850
|
function getOrCreateTypeFromSignature(signature, outerTypeParameters) {
|
|
62822
|
-
var
|
|
62851
|
+
var _a2;
|
|
62823
62852
|
if (!signature.isolatedSignatureType) {
|
|
62824
|
-
const kind = (
|
|
62853
|
+
const kind = (_a2 = signature.declaration) == null ? void 0 : _a2.kind;
|
|
62825
62854
|
const isConstructor = kind === void 0 || kind === 176 /* Constructor */ || kind === 180 /* ConstructSignature */ || kind === 185 /* ConstructorType */;
|
|
62826
62855
|
const type = createObjectType(16 /* Anonymous */ | 134217728 /* SingleSignatureType */, createSymbol(16 /* Function */, "__function" /* Function */));
|
|
62827
62856
|
if (signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
|
@@ -62882,9 +62911,9 @@ function createTypeChecker(host) {
|
|
|
62882
62911
|
return mapDefined(filter(type.symbol && type.symbol.declarations, isTypeParameterDeclaration), getEffectiveConstraintOfTypeParameter)[0];
|
|
62883
62912
|
}
|
|
62884
62913
|
function getInferredTypeParameterConstraint(typeParameter, omitTypeReferences) {
|
|
62885
|
-
var
|
|
62914
|
+
var _a2;
|
|
62886
62915
|
let inferences;
|
|
62887
|
-
if ((
|
|
62916
|
+
if ((_a2 = typeParameter.symbol) == null ? void 0 : _a2.declarations) {
|
|
62888
62917
|
for (const declaration of typeParameter.symbol.declarations) {
|
|
62889
62918
|
if (declaration.parent.kind === 195 /* InferType */) {
|
|
62890
62919
|
const [childTypeParameter = declaration.parent, grandParent] = walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent);
|
|
@@ -63025,10 +63054,10 @@ function createTypeChecker(host) {
|
|
|
63025
63054
|
return type;
|
|
63026
63055
|
}
|
|
63027
63056
|
function getTypeArguments(type) {
|
|
63028
|
-
var
|
|
63057
|
+
var _a2, _b;
|
|
63029
63058
|
if (!type.resolvedTypeArguments) {
|
|
63030
63059
|
if (!pushTypeResolution(type, 6 /* ResolvedTypeArguments */)) {
|
|
63031
|
-
return ((
|
|
63060
|
+
return ((_a2 = type.target.localTypeParameters) == null ? void 0 : _a2.map(() => errorType)) || emptyArray;
|
|
63032
63061
|
}
|
|
63033
63062
|
const node = type.node;
|
|
63034
63063
|
const typeArguments = !node ? emptyArray : node.kind === 183 /* TypeReference */ ? concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments2(node, type.target.localTypeParameters)) : node.kind === 188 /* ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : map(node.elements, getTypeFromTypeNode);
|
|
@@ -63159,8 +63188,8 @@ function createTypeChecker(host) {
|
|
|
63159
63188
|
return checkNoTypeArguments(node, symbol) ? type : errorType;
|
|
63160
63189
|
}
|
|
63161
63190
|
function isLocalTypeAlias(symbol) {
|
|
63162
|
-
var
|
|
63163
|
-
const declaration = (
|
|
63191
|
+
var _a2;
|
|
63192
|
+
const declaration = (_a2 = symbol.declarations) == null ? void 0 : _a2.find(isTypeAlias);
|
|
63164
63193
|
return !!(declaration && getContainingFunction(declaration));
|
|
63165
63194
|
}
|
|
63166
63195
|
function getTypeReferenceName(node) {
|
|
@@ -63588,7 +63617,7 @@ function createTypeChecker(host) {
|
|
|
63588
63617
|
return deferredGlobalAsyncIterableType || (deferredGlobalAsyncIterableType = getGlobalType(
|
|
63589
63618
|
"AsyncIterable",
|
|
63590
63619
|
/*arity*/
|
|
63591
|
-
|
|
63620
|
+
1,
|
|
63592
63621
|
reportErrors2
|
|
63593
63622
|
)) || emptyGenericType;
|
|
63594
63623
|
}
|
|
@@ -63604,7 +63633,7 @@ function createTypeChecker(host) {
|
|
|
63604
63633
|
return deferredGlobalAsyncIterableIteratorType || (deferredGlobalAsyncIterableIteratorType = getGlobalType(
|
|
63605
63634
|
"AsyncIterableIterator",
|
|
63606
63635
|
/*arity*/
|
|
63607
|
-
|
|
63636
|
+
1,
|
|
63608
63637
|
reportErrors2
|
|
63609
63638
|
)) || emptyGenericType;
|
|
63610
63639
|
}
|
|
@@ -63620,7 +63649,7 @@ function createTypeChecker(host) {
|
|
|
63620
63649
|
return deferredGlobalIterableType || (deferredGlobalIterableType = getGlobalType(
|
|
63621
63650
|
"Iterable",
|
|
63622
63651
|
/*arity*/
|
|
63623
|
-
|
|
63652
|
+
1,
|
|
63624
63653
|
reportErrors2
|
|
63625
63654
|
)) || emptyGenericType;
|
|
63626
63655
|
}
|
|
@@ -63636,7 +63665,7 @@ function createTypeChecker(host) {
|
|
|
63636
63665
|
return deferredGlobalIterableIteratorType || (deferredGlobalIterableIteratorType = getGlobalType(
|
|
63637
63666
|
"IterableIterator",
|
|
63638
63667
|
/*arity*/
|
|
63639
|
-
|
|
63668
|
+
1,
|
|
63640
63669
|
reportErrors2
|
|
63641
63670
|
)) || emptyGenericType;
|
|
63642
63671
|
}
|
|
@@ -63818,7 +63847,7 @@ function createTypeChecker(host) {
|
|
|
63818
63847
|
return createTypeFromGenericGlobalType(getGlobalIterableType(
|
|
63819
63848
|
/*reportErrors*/
|
|
63820
63849
|
true
|
|
63821
|
-
), [iteratedType
|
|
63850
|
+
), [iteratedType]);
|
|
63822
63851
|
}
|
|
63823
63852
|
function createArrayType(elementType, readonly) {
|
|
63824
63853
|
return createTypeFromGenericGlobalType(readonly ? globalReadonlyArrayType : globalArrayType, [elementType]);
|
|
@@ -63997,7 +64026,7 @@ function createTypeChecker(host) {
|
|
|
63997
64026
|
return target.objectFlags & 8 /* Tuple */ ? createNormalizedTupleType(target, typeArguments) : createTypeReference(target, typeArguments);
|
|
63998
64027
|
}
|
|
63999
64028
|
function createNormalizedTupleType(target, elementTypes) {
|
|
64000
|
-
var
|
|
64029
|
+
var _a2, _b, _c, _d;
|
|
64001
64030
|
if (!(target.combinedFlags & 14 /* NonRequired */)) {
|
|
64002
64031
|
return createTypeReference(target, elementTypes);
|
|
64003
64032
|
}
|
|
@@ -64018,7 +64047,7 @@ function createTypeChecker(host) {
|
|
|
64018
64047
|
const flags = target.elementFlags[i];
|
|
64019
64048
|
if (flags & 8 /* Variadic */) {
|
|
64020
64049
|
if (type.flags & 1 /* Any */) {
|
|
64021
|
-
addElement(type, 4 /* Rest */, (
|
|
64050
|
+
addElement(type, 4 /* Rest */, (_a2 = target.labeledElementDeclarations) == null ? void 0 : _a2[i]);
|
|
64022
64051
|
} else if (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type)) {
|
|
64023
64052
|
addElement(type, 8 /* Variadic */, (_b = target.labeledElementDeclarations) == null ? void 0 : _b[i]);
|
|
64024
64053
|
} else if (isTupleType(type)) {
|
|
@@ -64031,8 +64060,8 @@ function createTypeChecker(host) {
|
|
|
64031
64060
|
return errorType;
|
|
64032
64061
|
}
|
|
64033
64062
|
forEach(elements, (t, n) => {
|
|
64034
|
-
var
|
|
64035
|
-
return addElement(t, type.target.elementFlags[n], (
|
|
64063
|
+
var _a3;
|
|
64064
|
+
return addElement(t, type.target.elementFlags[n], (_a3 = type.target.labeledElementDeclarations) == null ? void 0 : _a3[n]);
|
|
64036
64065
|
});
|
|
64037
64066
|
} else {
|
|
64038
64067
|
addElement(isArrayLikeType(type) && getIndexTypeOfType(type, numberType) || errorType, 4 /* Rest */, (_c = target.labeledElementDeclarations) == null ? void 0 : _c[i]);
|
|
@@ -64156,7 +64185,7 @@ function createTypeChecker(host) {
|
|
|
64156
64185
|
return includes;
|
|
64157
64186
|
}
|
|
64158
64187
|
function removeSubtypes(types, hasObjectTypes) {
|
|
64159
|
-
var
|
|
64188
|
+
var _a2;
|
|
64160
64189
|
if (types.length < 2) {
|
|
64161
64190
|
return types;
|
|
64162
64191
|
}
|
|
@@ -64186,7 +64215,7 @@ function createTypeChecker(host) {
|
|
|
64186
64215
|
if (count === 1e5) {
|
|
64187
64216
|
const estimatedCount = count / (len - i) * len;
|
|
64188
64217
|
if (estimatedCount > 1e6) {
|
|
64189
|
-
(
|
|
64218
|
+
(_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "removeSubtypes_DepthLimit", { typeIds: types.map((t) => t.id) });
|
|
64190
64219
|
error2(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
|
|
64191
64220
|
return void 0;
|
|
64192
64221
|
}
|
|
@@ -64651,10 +64680,10 @@ function createTypeChecker(host) {
|
|
|
64651
64680
|
return reduceLeft(types, (n, t) => t.flags & 1048576 /* Union */ ? n * t.types.length : t.flags & 131072 /* Never */ ? 0 : n, 1);
|
|
64652
64681
|
}
|
|
64653
64682
|
function checkCrossProductUnion(types) {
|
|
64654
|
-
var
|
|
64683
|
+
var _a2;
|
|
64655
64684
|
const size = getCrossProductUnionSize(types);
|
|
64656
64685
|
if (size >= 1e5) {
|
|
64657
|
-
(
|
|
64686
|
+
(_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "checkCrossProductUnion_DepthLimit", { typeIds: types.map((t) => t.id), size });
|
|
64658
64687
|
error2(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
|
|
64659
64688
|
return false;
|
|
64660
64689
|
}
|
|
@@ -64842,7 +64871,7 @@ function createTypeChecker(host) {
|
|
|
64842
64871
|
return links.resolvedType;
|
|
64843
64872
|
}
|
|
64844
64873
|
function getTemplateLiteralType(texts, types) {
|
|
64845
|
-
var
|
|
64874
|
+
var _a2, _b;
|
|
64846
64875
|
const unionIndex = findIndex(types, (t) => !!(t.flags & (131072 /* Never */ | 1048576 /* Union */)));
|
|
64847
64876
|
if (unionIndex >= 0) {
|
|
64848
64877
|
return checkCrossProductUnion(types) ? mapType(types[unionIndex], (t) => getTemplateLiteralType(texts, replaceElement(types, unionIndex, t))) : errorType;
|
|
@@ -64850,7 +64879,7 @@ function createTypeChecker(host) {
|
|
|
64850
64879
|
if (contains(types, wildcardType)) {
|
|
64851
64880
|
return wildcardType;
|
|
64852
64881
|
}
|
|
64853
|
-
if (texts.length === 2 && texts[0] === "" && texts[1] === "" && !(types[0].flags & 2944 /* Literal */) && !((_b = (
|
|
64882
|
+
if (texts.length === 2 && texts[0] === "" && texts[1] === "" && !(types[0].flags & 2944 /* Literal */) && !((_b = (_a2 = types[0].symbol) == null ? void 0 : _a2.declarations) == null ? void 0 : _b.some((d) => d.parent.kind === 195 /* InferType */)) && isTypeAssignableTo(types[0], stringType)) {
|
|
64854
64883
|
return types[0];
|
|
64855
64884
|
}
|
|
64856
64885
|
const newTypes = [];
|
|
@@ -65354,7 +65383,7 @@ function createTypeChecker(host) {
|
|
|
65354
65383
|
if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
|
|
65355
65384
|
indexType = stringType;
|
|
65356
65385
|
}
|
|
65357
|
-
if (
|
|
65386
|
+
if (noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */)
|
|
65358
65387
|
accessFlags |= 1 /* IncludeUndefined */;
|
|
65359
65388
|
if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 199 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, getTotalFixedElementCount(objectType.target)) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, getTotalFixedElementCount(objectType.target))) || isGenericReducibleType(objectType))) {
|
|
65360
65389
|
if (objectType.flags & 3 /* AnyOrUnknown */) {
|
|
@@ -65602,7 +65631,7 @@ function createTypeChecker(host) {
|
|
|
65602
65631
|
}
|
|
65603
65632
|
}
|
|
65604
65633
|
function getTypeFromImportTypeNode(node) {
|
|
65605
|
-
var
|
|
65634
|
+
var _a2;
|
|
65606
65635
|
const links = getNodeLinks(node);
|
|
65607
65636
|
if (!links.resolvedType) {
|
|
65608
65637
|
if (!isLiteralImportTypeNode(node)) {
|
|
@@ -65616,7 +65645,7 @@ function createTypeChecker(host) {
|
|
|
65616
65645
|
links.resolvedSymbol = unknownSymbol;
|
|
65617
65646
|
return links.resolvedType = errorType;
|
|
65618
65647
|
}
|
|
65619
|
-
const isExportEquals = !!((
|
|
65648
|
+
const isExportEquals = !!((_a2 = innerModuleSymbol.exports) == null ? void 0 : _a2.get("export=" /* ExportEquals */));
|
|
65620
65649
|
const moduleSymbol = resolveExternalModuleSymbol(
|
|
65621
65650
|
innerModuleSymbol,
|
|
65622
65651
|
/*dontResolveAlias*/
|
|
@@ -65821,8 +65850,8 @@ function createTypeChecker(host) {
|
|
|
65821
65850
|
return spread;
|
|
65822
65851
|
}
|
|
65823
65852
|
function isSpreadableProperty(prop) {
|
|
65824
|
-
var
|
|
65825
|
-
return !some(prop.declarations, isPrivateIdentifierClassElementDeclaration) && (!(prop.flags & (8192 /* Method */ | 32768 /* GetAccessor */ | 65536 /* SetAccessor */)) || !((
|
|
65853
|
+
var _a2;
|
|
65854
|
+
return !some(prop.declarations, isPrivateIdentifierClassElementDeclaration) && (!(prop.flags & (8192 /* Method */ | 32768 /* GetAccessor */ | 65536 /* SetAccessor */)) || !((_a2 = prop.declarations) == null ? void 0 : _a2.some((decl) => isClassLike(decl.parent))));
|
|
65826
65855
|
}
|
|
65827
65856
|
function getSpreadSymbol(prop, readonly) {
|
|
65828
65857
|
const isSetonlyAccessor = prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */);
|
|
@@ -66464,12 +66493,12 @@ function createTypeChecker(host) {
|
|
|
66464
66493
|
) : type;
|
|
66465
66494
|
}
|
|
66466
66495
|
function instantiateTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
66467
|
-
var
|
|
66496
|
+
var _a2;
|
|
66468
66497
|
if (!couldContainTypeVariables(type)) {
|
|
66469
66498
|
return type;
|
|
66470
66499
|
}
|
|
66471
66500
|
if (instantiationDepth === 100 || instantiationCount >= 5e6) {
|
|
66472
|
-
(
|
|
66501
|
+
(_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "instantiateType_DepthLimit", { typeId: type.id, instantiationDepth, instantiationCount });
|
|
66473
66502
|
error2(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
66474
66503
|
return errorType;
|
|
66475
66504
|
}
|
|
@@ -67643,7 +67672,7 @@ function createTypeChecker(host) {
|
|
|
67643
67672
|
return elements !== normalizedElements ? createNormalizedTupleType(type.target, normalizedElements) : type;
|
|
67644
67673
|
}
|
|
67645
67674
|
function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer) {
|
|
67646
|
-
var
|
|
67675
|
+
var _a2;
|
|
67647
67676
|
let errorInfo;
|
|
67648
67677
|
let relatedInfo;
|
|
67649
67678
|
let maybeKeys;
|
|
@@ -67683,7 +67712,7 @@ function createTypeChecker(host) {
|
|
|
67683
67712
|
false
|
|
67684
67713
|
);
|
|
67685
67714
|
relation.set(id, 4 /* Reported */ | 2 /* Failed */);
|
|
67686
|
-
(
|
|
67715
|
+
(_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth: sourceDepth, targetDepth });
|
|
67687
67716
|
const message = relationCount <= 0 ? Diagnostics.Excessive_complexity_comparing_types_0_and_1 : Diagnostics.Excessive_stack_depth_comparing_types_0_and_1;
|
|
67688
67717
|
const diag2 = error2(errorNode || currentNode, message, typeToString(source), typeToString(target));
|
|
67689
67718
|
if (errorOutputContainer) {
|
|
@@ -68058,7 +68087,7 @@ function createTypeChecker(host) {
|
|
|
68058
68087
|
return 0 /* False */;
|
|
68059
68088
|
}
|
|
68060
68089
|
function reportErrorResults(originalSource, originalTarget, source2, target2, headMessage2) {
|
|
68061
|
-
var
|
|
68090
|
+
var _a3, _b;
|
|
68062
68091
|
const sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource);
|
|
68063
68092
|
const targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget);
|
|
68064
68093
|
source2 = originalSource.aliasSymbol || sourceHasBase ? originalSource : source2;
|
|
@@ -68108,7 +68137,7 @@ function createTypeChecker(host) {
|
|
|
68108
68137
|
return;
|
|
68109
68138
|
}
|
|
68110
68139
|
reportRelationError(headMessage2, source2, target2);
|
|
68111
|
-
if (source2.flags & 262144 /* TypeParameter */ && ((_b = (
|
|
68140
|
+
if (source2.flags & 262144 /* TypeParameter */ && ((_b = (_a3 = source2.symbol) == null ? void 0 : _a3.declarations) == null ? void 0 : _b[0]) && !getConstraintOfType(source2)) {
|
|
68112
68141
|
const syntheticParam = cloneTypeParameter(source2);
|
|
68113
68142
|
syntheticParam.constraint = instantiateType(target2, makeUnaryTypeMapper(source2, syntheticParam));
|
|
68114
68143
|
if (hasNonCircularBaseConstraint(syntheticParam)) {
|
|
@@ -68143,10 +68172,10 @@ function createTypeChecker(host) {
|
|
|
68143
68172
|
}
|
|
68144
68173
|
function getTypeOfPropertyInTypes(types, name) {
|
|
68145
68174
|
const appendPropType = (propTypes, type) => {
|
|
68146
|
-
var
|
|
68175
|
+
var _a3;
|
|
68147
68176
|
type = getApparentType(type);
|
|
68148
68177
|
const prop = type.flags & 3145728 /* UnionOrIntersection */ ? getPropertyOfUnionOrIntersectionType(type, name) : getPropertyOfObjectType(type, name);
|
|
68149
|
-
const propType = prop && getTypeOfSymbol(prop) || ((
|
|
68178
|
+
const propType = prop && getTypeOfSymbol(prop) || ((_a3 = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a3.type) || undefinedType;
|
|
68150
68179
|
return append(propTypes, propType);
|
|
68151
68180
|
};
|
|
68152
68181
|
return getUnionType(reduceLeft(
|
|
@@ -68157,7 +68186,7 @@ function createTypeChecker(host) {
|
|
|
68157
68186
|
) || emptyArray);
|
|
68158
68187
|
}
|
|
68159
68188
|
function hasExcessProperties(source2, target2, reportErrors2) {
|
|
68160
|
-
var
|
|
68189
|
+
var _a3;
|
|
68161
68190
|
if (!isExcessPropertyCheckTarget(target2) || !noImplicitAny && getObjectFlags(target2) & 4096 /* JSLiteral */) {
|
|
68162
68191
|
return false;
|
|
68163
68192
|
}
|
|
@@ -68191,7 +68220,7 @@ function createTypeChecker(host) {
|
|
|
68191
68220
|
reportError(Diagnostics.Property_0_does_not_exist_on_type_1, propName, typeToString(errorTarget));
|
|
68192
68221
|
}
|
|
68193
68222
|
} else {
|
|
68194
|
-
const objectLiteralDeclaration = ((
|
|
68223
|
+
const objectLiteralDeclaration = ((_a3 = source2.symbol) == null ? void 0 : _a3.declarations) && firstOrUndefined(source2.symbol.declarations);
|
|
68195
68224
|
let suggestion;
|
|
68196
68225
|
if (prop.valueDeclaration && findAncestor(prop.valueDeclaration, (d) => d === objectLiteralDeclaration) && getSourceFileOfNode(objectLiteralDeclaration) === getSourceFileOfNode(errorNode)) {
|
|
68197
68226
|
const propDeclaration = prop.valueDeclaration;
|
|
@@ -68531,7 +68560,7 @@ function createTypeChecker(host) {
|
|
|
68531
68560
|
return result2;
|
|
68532
68561
|
}
|
|
68533
68562
|
function recursiveTypeRelatedTo(source2, target2, reportErrors2, intersectionState, recursionFlags) {
|
|
68534
|
-
var
|
|
68563
|
+
var _a3, _b, _c;
|
|
68535
68564
|
if (overflow) {
|
|
68536
68565
|
return 0 /* False */;
|
|
68537
68566
|
}
|
|
@@ -68616,7 +68645,7 @@ function createTypeChecker(host) {
|
|
|
68616
68645
|
}
|
|
68617
68646
|
let result2;
|
|
68618
68647
|
if (expandingFlags === 3 /* Both */) {
|
|
68619
|
-
(
|
|
68648
|
+
(_a3 = tracing) == null ? void 0 : _a3.instant(tracing.Phase.CheckTypes, "recursiveTypeRelatedTo_DepthLimit", {
|
|
68620
68649
|
sourceId: source2.id,
|
|
68621
68650
|
sourceIdStack: sourceStack.map((t) => t.id),
|
|
68622
68651
|
targetId: target2.id,
|
|
@@ -69297,7 +69326,7 @@ function createTypeChecker(host) {
|
|
|
69297
69326
|
return 0 /* False */;
|
|
69298
69327
|
}
|
|
69299
69328
|
function typeRelatedToDiscriminatedType(source2, target2) {
|
|
69300
|
-
var
|
|
69329
|
+
var _a3;
|
|
69301
69330
|
const sourceProperties = getPropertiesOfType(source2);
|
|
69302
69331
|
const sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target2);
|
|
69303
69332
|
if (!sourcePropertiesFiltered)
|
|
@@ -69306,7 +69335,7 @@ function createTypeChecker(host) {
|
|
|
69306
69335
|
for (const sourceProperty of sourcePropertiesFiltered) {
|
|
69307
69336
|
numCombinations *= countTypes(getNonMissingTypeOfSymbol(sourceProperty));
|
|
69308
69337
|
if (numCombinations > 25) {
|
|
69309
|
-
(
|
|
69338
|
+
(_a3 = tracing) == null ? void 0 : _a3.instant(tracing.Phase.CheckTypes, "typeRelatedToDiscriminatedType_DepthLimit", { sourceId: source2.id, targetId: target2.id, numCombinations });
|
|
69310
69339
|
return 0 /* False */;
|
|
69311
69340
|
}
|
|
69312
69341
|
}
|
|
@@ -69713,7 +69742,7 @@ function createTypeChecker(host) {
|
|
|
69713
69742
|
return result2;
|
|
69714
69743
|
}
|
|
69715
69744
|
function signaturesRelatedTo(source2, target2, kind, reportErrors2, intersectionState) {
|
|
69716
|
-
var
|
|
69745
|
+
var _a3, _b;
|
|
69717
69746
|
if (relation === identityRelation) {
|
|
69718
69747
|
return signaturesIdenticalTo(source2, target2, kind);
|
|
69719
69748
|
}
|
|
@@ -69769,7 +69798,7 @@ function createTypeChecker(host) {
|
|
|
69769
69798
|
const sourceSignature = first(sourceSignatures);
|
|
69770
69799
|
const targetSignature = first(targetSignatures);
|
|
69771
69800
|
result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, intersectionState, incompatibleReporter(sourceSignature, targetSignature));
|
|
69772
|
-
if (!result2 && reportErrors2 && kind === 1 /* Construct */ && sourceObjectFlags & targetObjectFlags && (((
|
|
69801
|
+
if (!result2 && reportErrors2 && kind === 1 /* Construct */ && sourceObjectFlags & targetObjectFlags && (((_a3 = targetSignature.declaration) == null ? void 0 : _a3.kind) === 176 /* Constructor */ || ((_b = sourceSignature.declaration) == null ? void 0 : _b.kind) === 176 /* Constructor */)) {
|
|
69773
69802
|
const constructSignatureToString = (signature) => signatureToString(
|
|
69774
69803
|
signature,
|
|
69775
69804
|
/*enclosingDeclaration*/
|
|
@@ -70087,10 +70116,10 @@ function createTypeChecker(host) {
|
|
|
70087
70116
|
return getVariancesWorker(symbol, getSymbolLinks(symbol).typeParameters);
|
|
70088
70117
|
}
|
|
70089
70118
|
function getVariancesWorker(symbol, typeParameters = emptyArray) {
|
|
70090
|
-
var
|
|
70119
|
+
var _a2, _b;
|
|
70091
70120
|
const links = getSymbolLinks(symbol);
|
|
70092
70121
|
if (!links.variances) {
|
|
70093
|
-
(
|
|
70122
|
+
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.CheckTypes, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
|
|
70094
70123
|
const oldVarianceComputation = inVarianceComputation;
|
|
70095
70124
|
const saveResolutionStart = resolutionStart;
|
|
70096
70125
|
if (!inVarianceComputation) {
|
|
@@ -70148,8 +70177,8 @@ function createTypeChecker(host) {
|
|
|
70148
70177
|
return markerTypes.has(getTypeId(type));
|
|
70149
70178
|
}
|
|
70150
70179
|
function getTypeParameterModifiers(tp) {
|
|
70151
|
-
var
|
|
70152
|
-
return reduceLeft((
|
|
70180
|
+
var _a2;
|
|
70181
|
+
return reduceLeft((_a2 = tp.symbol) == null ? void 0 : _a2.declarations, (modifiers, d) => modifiers | getEffectiveModifierFlags(d), 0 /* None */) & (8192 /* In */ | 16384 /* Out */ | 4096 /* Const */);
|
|
70153
70182
|
}
|
|
70154
70183
|
function hasCovariantVoidArgument(typeArguments, variances) {
|
|
70155
70184
|
for (let i = 0; i < variances.length; i++) {
|
|
@@ -70207,7 +70236,7 @@ function createTypeChecker(host) {
|
|
|
70207
70236
|
return isTypeReferenceWithGenericArguments(source) && isTypeReferenceWithGenericArguments(target) ? getGenericTypeReferenceRelationKey(source, target, postFix, ignoreConstraints) : `${source.id},${target.id}${postFix}`;
|
|
70208
70237
|
}
|
|
70209
70238
|
function forEachProperty2(prop, callback) {
|
|
70210
|
-
if (getCheckFlags(prop) & 6 /*
|
|
70239
|
+
if (getCheckFlags(prop) & 6 /* SyntheticMember */) {
|
|
70211
70240
|
for (const t of prop.links.containingType.types) {
|
|
70212
70241
|
const p = getPropertyOfType(t, prop.escapedName);
|
|
70213
70242
|
const result = p && forEachProperty2(p, callback);
|
|
@@ -70505,7 +70534,7 @@ function createTypeChecker(host) {
|
|
|
70505
70534
|
return propType;
|
|
70506
70535
|
}
|
|
70507
70536
|
if (everyType(type, isTupleType)) {
|
|
70508
|
-
return getTupleElementTypeOutOfStartCount(type, index,
|
|
70537
|
+
return getTupleElementTypeOutOfStartCount(type, index, noUncheckedIndexedAccess ? undefinedType : void 0);
|
|
70509
70538
|
}
|
|
70510
70539
|
return void 0;
|
|
70511
70540
|
}
|
|
@@ -71824,7 +71853,7 @@ function createTypeChecker(host) {
|
|
|
71824
71853
|
inferFromTypes(sourceNameType, targetNameType);
|
|
71825
71854
|
}
|
|
71826
71855
|
function inferFromObjectTypes(source, target) {
|
|
71827
|
-
var
|
|
71856
|
+
var _a2, _b;
|
|
71828
71857
|
if (getObjectFlags(source) & 4 /* Reference */ && getObjectFlags(target) & 4 /* Reference */ && (source.target === target.target || isArrayType(source) && isArrayType(target))) {
|
|
71829
71858
|
inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target));
|
|
71830
71859
|
return;
|
|
@@ -71871,7 +71900,7 @@ function createTypeChecker(host) {
|
|
|
71871
71900
|
inferFromTypes(sliceTupleType(source, startLength + targetInfo.impliedArity, endLength), elementTypes[startLength + 1]);
|
|
71872
71901
|
}
|
|
71873
71902
|
} else if (elementFlags[startLength] & 8 /* Variadic */ && elementFlags[startLength + 1] & 4 /* Rest */) {
|
|
71874
|
-
const param = (
|
|
71903
|
+
const param = (_a2 = getInferenceInfoForType(elementTypes[startLength])) == null ? void 0 : _a2.typeParameter;
|
|
71875
71904
|
const constraint = param && getBaseConstraintOfType(param);
|
|
71876
71905
|
if (constraint && isTupleType(constraint) && !constraint.target.hasRestElement) {
|
|
71877
71906
|
const impliedArity = constraint.target.fixedLength;
|
|
@@ -72358,8 +72387,8 @@ function createTypeChecker(host) {
|
|
|
72358
72387
|
return unionType.keyPropertyName.length ? unionType.keyPropertyName : void 0;
|
|
72359
72388
|
}
|
|
72360
72389
|
function getConstituentTypeForKeyType(unionType, keyType) {
|
|
72361
|
-
var
|
|
72362
|
-
const result = (
|
|
72390
|
+
var _a2;
|
|
72391
|
+
const result = (_a2 = unionType.constituentMap) == null ? void 0 : _a2.get(getTypeId(getRegularTypeOfLiteralType(keyType)));
|
|
72363
72392
|
return result !== unknownType ? result : void 0;
|
|
72364
72393
|
}
|
|
72365
72394
|
function getMatchingUnionConstituentForType(unionType, type) {
|
|
@@ -72543,12 +72572,12 @@ function createTypeChecker(host) {
|
|
|
72543
72572
|
return defaultExpression ? getUnionType([getNonUndefinedType(type), getTypeOfExpression(defaultExpression)]) : type;
|
|
72544
72573
|
}
|
|
72545
72574
|
function getTypeOfDestructuredProperty(type, name) {
|
|
72546
|
-
var
|
|
72575
|
+
var _a2;
|
|
72547
72576
|
const nameType = getLiteralTypeFromPropertyName(name);
|
|
72548
72577
|
if (!isTypeUsableAsPropertyName(nameType))
|
|
72549
72578
|
return errorType;
|
|
72550
72579
|
const text = getPropertyNameFromType(nameType);
|
|
72551
|
-
return getTypeOfPropertyOfType(type, text) || includeUndefinedInIndexSignature((
|
|
72580
|
+
return getTypeOfPropertyOfType(type, text) || includeUndefinedInIndexSignature((_a2 = getApplicableIndexInfoForName(type, text)) == null ? void 0 : _a2.type) || errorType;
|
|
72552
72581
|
}
|
|
72553
72582
|
function getTypeOfDestructuredArrayElement(type, index) {
|
|
72554
72583
|
return everyType(type, isTupleLikeType) && getTupleElementType(type, index) || includeUndefinedInIndexSignature(checkIteratedTypeOrElementType(
|
|
@@ -72562,7 +72591,7 @@ function createTypeChecker(host) {
|
|
|
72562
72591
|
function includeUndefinedInIndexSignature(type) {
|
|
72563
72592
|
if (!type)
|
|
72564
72593
|
return type;
|
|
72565
|
-
return
|
|
72594
|
+
return noUncheckedIndexedAccess ? getUnionType([type, missingType]) : type;
|
|
72566
72595
|
}
|
|
72567
72596
|
function getTypeOfDestructuredSpreadExpression(type) {
|
|
72568
72597
|
return createArrayType(checkIteratedTypeOrElementType(
|
|
@@ -73125,7 +73154,7 @@ function createTypeChecker(host) {
|
|
|
73125
73154
|
}
|
|
73126
73155
|
return false;
|
|
73127
73156
|
}
|
|
73128
|
-
function getFlowTypeOfReference(reference, declaredType, initialType = declaredType, flowContainer, flowNode = ((
|
|
73157
|
+
function getFlowTypeOfReference(reference, declaredType, initialType = declaredType, flowContainer, flowNode = ((_b) => (_b = tryCast(reference, canHaveFlowNode)) == null ? void 0 : _b.flowNode)()) {
|
|
73129
73158
|
let key;
|
|
73130
73159
|
let isKeySet = false;
|
|
73131
73160
|
let flowDepth = 0;
|
|
@@ -73860,7 +73889,7 @@ function createTypeChecker(host) {
|
|
|
73860
73889
|
if (!hasDefaultClause) {
|
|
73861
73890
|
return caseType;
|
|
73862
73891
|
}
|
|
73863
|
-
const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, getRegularTypeOfLiteralType(extractUnitType(t)))));
|
|
73892
|
+
const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, t.flags & 32768 /* Undefined */ ? undefinedType : getRegularTypeOfLiteralType(extractUnitType(t)))));
|
|
73864
73893
|
return caseType.flags & 131072 /* Never */ ? defaultType : getUnionType([caseType, defaultType]);
|
|
73865
73894
|
}
|
|
73866
73895
|
function narrowTypeByTypeName(type, typeName) {
|
|
@@ -74387,7 +74416,7 @@ function createTypeChecker(host) {
|
|
|
74387
74416
|
}
|
|
74388
74417
|
}
|
|
74389
74418
|
function getNarrowedTypeOfSymbol(symbol, location, checkMode) {
|
|
74390
|
-
var
|
|
74419
|
+
var _a2;
|
|
74391
74420
|
const type = getTypeOfSymbol(symbol, checkMode);
|
|
74392
74421
|
const declaration = symbol.valueDeclaration;
|
|
74393
74422
|
if (declaration) {
|
|
@@ -74429,7 +74458,7 @@ function createTypeChecker(host) {
|
|
|
74429
74458
|
if (func.parameters.length >= 2 && isContextSensitiveFunctionOrObjectLiteralMethod(func)) {
|
|
74430
74459
|
const contextualSignature = getContextualSignature(func);
|
|
74431
74460
|
if (contextualSignature && contextualSignature.parameters.length === 1 && signatureHasRestParameter(contextualSignature)) {
|
|
74432
|
-
const restType = getReducedApparentType(instantiateType(getTypeOfSymbol(contextualSignature.parameters[0]), (
|
|
74461
|
+
const restType = getReducedApparentType(instantiateType(getTypeOfSymbol(contextualSignature.parameters[0]), (_a2 = getInferenceContext(func)) == null ? void 0 : _a2.nonFixingMapper));
|
|
74433
74462
|
if (restType.flags & 1048576 /* Union */ && everyType(restType, isTupleType) && !some(func.parameters, isSomeSymbolAssigned)) {
|
|
74434
74463
|
const narrowedType = getFlowTypeOfReference(
|
|
74435
74464
|
func,
|
|
@@ -74581,7 +74610,7 @@ function createTypeChecker(host) {
|
|
|
74581
74610
|
}
|
|
74582
74611
|
}
|
|
74583
74612
|
function shouldMarkIdentifierAliasReferenced(node) {
|
|
74584
|
-
var
|
|
74613
|
+
var _a2;
|
|
74585
74614
|
const parent2 = node.parent;
|
|
74586
74615
|
if (parent2) {
|
|
74587
74616
|
if (isPropertyAccessExpression(parent2) && parent2.expression === node) {
|
|
@@ -74590,7 +74619,7 @@ function createTypeChecker(host) {
|
|
|
74590
74619
|
if (isExportSpecifier(parent2) && parent2.isTypeOnly) {
|
|
74591
74620
|
return false;
|
|
74592
74621
|
}
|
|
74593
|
-
const greatGrandparent = (
|
|
74622
|
+
const greatGrandparent = (_a2 = parent2.parent) == null ? void 0 : _a2.parent;
|
|
74594
74623
|
if (greatGrandparent && isExportDeclaration(greatGrandparent) && greatGrandparent.isTypeOnly) {
|
|
74595
74624
|
return false;
|
|
74596
74625
|
}
|
|
@@ -75322,7 +75351,7 @@ function createTypeChecker(host) {
|
|
|
75322
75351
|
}
|
|
75323
75352
|
}
|
|
75324
75353
|
function getContextualTypeForAssignmentDeclaration(binaryExpression) {
|
|
75325
|
-
var
|
|
75354
|
+
var _a2, _b;
|
|
75326
75355
|
const kind = getAssignmentDeclarationKind(binaryExpression);
|
|
75327
75356
|
switch (kind) {
|
|
75328
75357
|
case 0 /* None */:
|
|
@@ -75381,7 +75410,7 @@ function createTypeChecker(host) {
|
|
|
75381
75410
|
case 2 /* ModuleExports */:
|
|
75382
75411
|
let valueDeclaration;
|
|
75383
75412
|
if (kind !== 2 /* ModuleExports */) {
|
|
75384
|
-
valueDeclaration = canHaveSymbol(binaryExpression.left) ? (
|
|
75413
|
+
valueDeclaration = canHaveSymbol(binaryExpression.left) ? (_a2 = binaryExpression.left.symbol) == null ? void 0 : _a2.valueDeclaration : void 0;
|
|
75385
75414
|
}
|
|
75386
75415
|
valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) == null ? void 0 : _b.valueDeclaration);
|
|
75387
75416
|
const annotated = valueDeclaration && getEffectiveTypeAnnotationNode(valueDeclaration);
|
|
@@ -75448,7 +75477,7 @@ function createTypeChecker(host) {
|
|
|
75448
75477
|
return mapType(
|
|
75449
75478
|
type,
|
|
75450
75479
|
(t) => {
|
|
75451
|
-
var
|
|
75480
|
+
var _a2;
|
|
75452
75481
|
if (isGenericMappedType(t) && !t.declaration.nameType) {
|
|
75453
75482
|
const constraint = getConstraintTypeFromMappedType(t);
|
|
75454
75483
|
const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
|
|
@@ -75476,7 +75505,7 @@ function createTypeChecker(host) {
|
|
|
75476
75505
|
return restType;
|
|
75477
75506
|
}
|
|
75478
75507
|
}
|
|
75479
|
-
return (
|
|
75508
|
+
return (_a2 = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(unescapeLeadingUnderscores(name)))) == null ? void 0 : _a2.type;
|
|
75480
75509
|
}
|
|
75481
75510
|
return void 0;
|
|
75482
75511
|
},
|
|
@@ -75518,8 +75547,8 @@ function createTypeChecker(host) {
|
|
|
75518
75547
|
return mapType(
|
|
75519
75548
|
type,
|
|
75520
75549
|
(t) => {
|
|
75521
|
-
var
|
|
75522
|
-
return (
|
|
75550
|
+
var _a2;
|
|
75551
|
+
return (_a2 = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType)) == null ? void 0 : _a2.type;
|
|
75523
75552
|
},
|
|
75524
75553
|
/*noReductions*/
|
|
75525
75554
|
true
|
|
@@ -75638,60 +75667,71 @@ function createTypeChecker(host) {
|
|
|
75638
75667
|
return false;
|
|
75639
75668
|
}
|
|
75640
75669
|
function discriminateContextualTypeByObjectMembers(node, contextualType) {
|
|
75641
|
-
|
|
75642
|
-
|
|
75643
|
-
|
|
75644
|
-
|
|
75645
|
-
|
|
75646
|
-
|
|
75670
|
+
const key = `D${getNodeId(node)},${getTypeId(contextualType)}`;
|
|
75671
|
+
return getCachedType(key) ?? setCachedType(
|
|
75672
|
+
key,
|
|
75673
|
+
getMatchingUnionConstituentForObjectLiteral(contextualType, node) ?? discriminateTypeByDiscriminableItems(
|
|
75674
|
+
contextualType,
|
|
75675
|
+
concatenate(
|
|
75676
|
+
map(
|
|
75677
|
+
filter(node.properties, (p) => {
|
|
75678
|
+
if (!p.symbol) {
|
|
75679
|
+
return false;
|
|
75680
|
+
}
|
|
75681
|
+
if (p.kind === 303 /* PropertyAssignment */) {
|
|
75682
|
+
return isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName);
|
|
75683
|
+
}
|
|
75684
|
+
if (p.kind === 304 /* ShorthandPropertyAssignment */) {
|
|
75685
|
+
return isDiscriminantProperty(contextualType, p.symbol.escapedName);
|
|
75686
|
+
}
|
|
75647
75687
|
return false;
|
|
75648
|
-
}
|
|
75649
|
-
|
|
75650
|
-
|
|
75651
|
-
|
|
75652
|
-
|
|
75653
|
-
|
|
75654
|
-
|
|
75655
|
-
|
|
75656
|
-
|
|
75657
|
-
|
|
75688
|
+
}),
|
|
75689
|
+
(prop) => [() => getContextFreeTypeOfExpression(prop.kind === 303 /* PropertyAssignment */ ? prop.initializer : prop.name), prop.symbol.escapedName]
|
|
75690
|
+
),
|
|
75691
|
+
map(
|
|
75692
|
+
filter(getPropertiesOfType(contextualType), (s) => {
|
|
75693
|
+
var _a2;
|
|
75694
|
+
return !!(s.flags & 16777216 /* Optional */) && !!((_a2 = node == null ? void 0 : node.symbol) == null ? void 0 : _a2.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName);
|
|
75695
|
+
}),
|
|
75696
|
+
(s) => [() => undefinedType, s.escapedName]
|
|
75697
|
+
)
|
|
75658
75698
|
),
|
|
75659
|
-
|
|
75660
|
-
|
|
75661
|
-
var _a;
|
|
75662
|
-
return !!(s.flags & 16777216 /* Optional */) && !!((_a = node == null ? void 0 : node.symbol) == null ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName);
|
|
75663
|
-
}),
|
|
75664
|
-
(s) => [() => undefinedType, s.escapedName]
|
|
75665
|
-
)
|
|
75666
|
-
),
|
|
75667
|
-
isTypeAssignableTo
|
|
75699
|
+
isTypeAssignableTo
|
|
75700
|
+
)
|
|
75668
75701
|
);
|
|
75669
75702
|
}
|
|
75670
75703
|
function discriminateContextualTypeByJSXAttributes(node, contextualType) {
|
|
75704
|
+
const key = `D${getNodeId(node)},${getTypeId(contextualType)}`;
|
|
75705
|
+
const cached = getCachedType(key);
|
|
75706
|
+
if (cached)
|
|
75707
|
+
return cached;
|
|
75671
75708
|
const jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
|
|
75672
|
-
return
|
|
75673
|
-
|
|
75674
|
-
|
|
75675
|
-
|
|
75676
|
-
|
|
75677
|
-
(
|
|
75709
|
+
return setCachedType(
|
|
75710
|
+
key,
|
|
75711
|
+
discriminateTypeByDiscriminableItems(
|
|
75712
|
+
contextualType,
|
|
75713
|
+
concatenate(
|
|
75714
|
+
map(
|
|
75715
|
+
filter(node.properties, (p) => !!p.symbol && p.kind === 291 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer))),
|
|
75716
|
+
(prop) => [!prop.initializer ? () => trueType : () => getContextFreeTypeOfExpression(prop.initializer), prop.symbol.escapedName]
|
|
75717
|
+
),
|
|
75718
|
+
map(
|
|
75719
|
+
filter(getPropertiesOfType(contextualType), (s) => {
|
|
75720
|
+
var _a2;
|
|
75721
|
+
if (!(s.flags & 16777216 /* Optional */) || !((_a2 = node == null ? void 0 : node.symbol) == null ? void 0 : _a2.members)) {
|
|
75722
|
+
return false;
|
|
75723
|
+
}
|
|
75724
|
+
const element = node.parent.parent;
|
|
75725
|
+
if (s.escapedName === jsxChildrenPropertyName && isJsxElement(element) && getSemanticJsxChildren(element.children).length) {
|
|
75726
|
+
return false;
|
|
75727
|
+
}
|
|
75728
|
+
return !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName);
|
|
75729
|
+
}),
|
|
75730
|
+
(s) => [() => undefinedType, s.escapedName]
|
|
75731
|
+
)
|
|
75678
75732
|
),
|
|
75679
|
-
|
|
75680
|
-
|
|
75681
|
-
var _a;
|
|
75682
|
-
if (!(s.flags & 16777216 /* Optional */) || !((_a = node == null ? void 0 : node.symbol) == null ? void 0 : _a.members)) {
|
|
75683
|
-
return false;
|
|
75684
|
-
}
|
|
75685
|
-
const element = node.parent.parent;
|
|
75686
|
-
if (s.escapedName === jsxChildrenPropertyName && isJsxElement(element) && getSemanticJsxChildren(element.children).length) {
|
|
75687
|
-
return false;
|
|
75688
|
-
}
|
|
75689
|
-
return !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName);
|
|
75690
|
-
}),
|
|
75691
|
-
(s) => [() => undefinedType, s.escapedName]
|
|
75692
|
-
)
|
|
75693
|
-
),
|
|
75694
|
-
isTypeAssignableTo
|
|
75733
|
+
isTypeAssignableTo
|
|
75734
|
+
)
|
|
75695
75735
|
);
|
|
75696
75736
|
}
|
|
75697
75737
|
function getApparentTypeOfContextualType(node, contextFlags) {
|
|
@@ -75737,7 +75777,7 @@ function createTypeChecker(host) {
|
|
|
75737
75777
|
return type;
|
|
75738
75778
|
}
|
|
75739
75779
|
function getContextualType2(node, contextFlags) {
|
|
75740
|
-
var
|
|
75780
|
+
var _a2;
|
|
75741
75781
|
if (node.flags & 67108864 /* InWithStatement */) {
|
|
75742
75782
|
return void 0;
|
|
75743
75783
|
}
|
|
@@ -75783,7 +75823,7 @@ function createTypeChecker(host) {
|
|
|
75783
75823
|
const arrayLiteral = parent2;
|
|
75784
75824
|
const type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
|
|
75785
75825
|
const elementIndex = indexOfNode(arrayLiteral.elements, node);
|
|
75786
|
-
const spreadIndices = (
|
|
75826
|
+
const spreadIndices = (_a2 = getNodeLinks(arrayLiteral)).spreadIndices ?? (_a2.spreadIndices = getSpreadIndices(arrayLiteral.elements));
|
|
75787
75827
|
return getContextualTypeForElementExpression(type, elementIndex, arrayLiteral.elements.length, spreadIndices.first, spreadIndices.last);
|
|
75788
75828
|
}
|
|
75789
75829
|
case 227 /* ConditionalExpression */:
|
|
@@ -76315,13 +76355,13 @@ function createTypeChecker(host) {
|
|
|
76315
76355
|
return links.resolvedType;
|
|
76316
76356
|
}
|
|
76317
76357
|
function isSymbolWithNumericName(symbol) {
|
|
76318
|
-
var
|
|
76319
|
-
const firstDecl = (
|
|
76358
|
+
var _a2;
|
|
76359
|
+
const firstDecl = (_a2 = symbol.declarations) == null ? void 0 : _a2[0];
|
|
76320
76360
|
return isNumericLiteralName(symbol.escapedName) || firstDecl && isNamedDeclaration(firstDecl) && isNumericName(firstDecl.name);
|
|
76321
76361
|
}
|
|
76322
76362
|
function isSymbolWithSymbolName(symbol) {
|
|
76323
|
-
var
|
|
76324
|
-
const firstDecl = (
|
|
76363
|
+
var _a2;
|
|
76364
|
+
const firstDecl = (_a2 = symbol.declarations) == null ? void 0 : _a2[0];
|
|
76325
76365
|
return isKnownSymbol(symbol) || firstDecl && isNamedDeclaration(firstDecl) && isComputedPropertyName(firstDecl.name) && isTypeAssignableToKind(checkComputedPropertyName(firstDecl.name), 4096 /* ESSymbol */);
|
|
76326
76366
|
}
|
|
76327
76367
|
function getObjectLiteralIndexInfo(node, offset, properties, keyType) {
|
|
@@ -76351,7 +76391,7 @@ function createTypeChecker(host) {
|
|
|
76351
76391
|
return links.immediateTarget;
|
|
76352
76392
|
}
|
|
76353
76393
|
function checkObjectLiteral(node, checkMode = 0 /* Normal */) {
|
|
76354
|
-
var
|
|
76394
|
+
var _a2;
|
|
76355
76395
|
const inDestructuringPattern = isAssignmentTarget(node);
|
|
76356
76396
|
checkGrammarObjectLiteralExpression(node, inDestructuringPattern);
|
|
76357
76397
|
const allPropertiesTable = strictNullChecks ? createSymbolTable() : void 0;
|
|
@@ -76492,7 +76532,7 @@ function createTypeChecker(host) {
|
|
|
76492
76532
|
for (const prop of getPropertiesOfType(contextualType)) {
|
|
76493
76533
|
if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) {
|
|
76494
76534
|
if (!(prop.flags & 16777216 /* Optional */)) {
|
|
76495
|
-
error2(prop.valueDeclaration || ((
|
|
76535
|
+
error2(prop.valueDeclaration || ((_a2 = tryCast(prop, isTransientSymbol)) == null ? void 0 : _a2.links.bindingElement), Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
|
|
76496
76536
|
}
|
|
76497
76537
|
propertiesTable.set(prop.escapedName, prop);
|
|
76498
76538
|
propertiesArray.push(prop);
|
|
@@ -76956,7 +76996,7 @@ function createTypeChecker(host) {
|
|
|
76956
76996
|
}
|
|
76957
76997
|
}
|
|
76958
76998
|
function getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node) {
|
|
76959
|
-
var
|
|
76999
|
+
var _a2;
|
|
76960
77000
|
Debug.assert(isJsxIntrinsicTagName(node.tagName));
|
|
76961
77001
|
const links = getNodeLinks(node);
|
|
76962
77002
|
if (!links.resolvedJsxElementAttributesType) {
|
|
@@ -76965,7 +77005,7 @@ function createTypeChecker(host) {
|
|
|
76965
77005
|
return links.resolvedJsxElementAttributesType = getTypeOfSymbol(symbol) || errorType;
|
|
76966
77006
|
} else if (links.jsxFlags & 2 /* IntrinsicIndexedElement */) {
|
|
76967
77007
|
const propName = isJsxNamespacedName(node.tagName) ? getEscapedTextOfJsxNamespacedName(node.tagName) : node.tagName.escapedText;
|
|
76968
|
-
return links.resolvedJsxElementAttributesType = ((
|
|
77008
|
+
return links.resolvedJsxElementAttributesType = ((_a2 = getApplicableIndexInfoForName(getJsxType(JsxNames.IntrinsicElements, node), propName)) == null ? void 0 : _a2.type) || errorType;
|
|
76969
77009
|
} else {
|
|
76970
77010
|
return links.resolvedJsxElementAttributesType = errorType;
|
|
76971
77011
|
}
|
|
@@ -77142,7 +77182,7 @@ function createTypeChecker(host) {
|
|
|
77142
77182
|
return checkPropertyAccessibilityAtLocation(node, isSuper, writing, type, prop, errorNode);
|
|
77143
77183
|
}
|
|
77144
77184
|
function checkPropertyAccessibilityAtLocation(location, isSuper, writing, containingType, prop, errorNode) {
|
|
77145
|
-
var
|
|
77185
|
+
var _a2;
|
|
77146
77186
|
const flags = getDeclarationModifierFlagsFromSymbol(prop, writing);
|
|
77147
77187
|
if (isSuper) {
|
|
77148
77188
|
if (languageVersion < 2 /* ES2015 */) {
|
|
@@ -77159,7 +77199,7 @@ function createTypeChecker(host) {
|
|
|
77159
77199
|
}
|
|
77160
77200
|
return false;
|
|
77161
77201
|
}
|
|
77162
|
-
if (!(flags & 256 /* Static */) && ((
|
|
77202
|
+
if (!(flags & 256 /* Static */) && ((_a2 = prop.declarations) == null ? void 0 : _a2.some(isClassInstanceProperty))) {
|
|
77163
77203
|
if (errorNode) {
|
|
77164
77204
|
error2(errorNode, Diagnostics.Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super, symbolToString(prop));
|
|
77165
77205
|
}
|
|
@@ -77546,7 +77586,7 @@ function createTypeChecker(host) {
|
|
|
77546
77586
|
error2(node, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(apparentType));
|
|
77547
77587
|
}
|
|
77548
77588
|
propType = indexInfo.type;
|
|
77549
|
-
if (
|
|
77589
|
+
if (noUncheckedIndexedAccess && getAssignmentTargetKind(node) !== 1 /* Definite */) {
|
|
77550
77590
|
propType = getUnionType([propType, missingType]);
|
|
77551
77591
|
}
|
|
77552
77592
|
if (compilerOptions.noPropertyAccessFromIndexSignature && isPropertyAccessExpression(node)) {
|
|
@@ -77573,12 +77613,12 @@ function createTypeChecker(host) {
|
|
|
77573
77613
|
return getFlowTypeOfAccessExpression(node, prop, propType, right, checkMode);
|
|
77574
77614
|
}
|
|
77575
77615
|
function isUncheckedJSSuggestion(node, suggestion, excludeClasses) {
|
|
77576
|
-
var
|
|
77616
|
+
var _a2;
|
|
77577
77617
|
const file = getSourceFileOfNode(node);
|
|
77578
77618
|
if (file) {
|
|
77579
77619
|
if (compilerOptions.checkJs === void 0 && file.checkJsDirective === void 0 && (file.scriptKind === 1 /* JS */ || file.scriptKind === 2 /* JSX */)) {
|
|
77580
77620
|
const declarationFile = forEach(suggestion == null ? void 0 : suggestion.declarations, getSourceFileOfNode);
|
|
77581
|
-
const suggestionHasNoExtendsOrDecorators = !(suggestion == null ? void 0 : suggestion.valueDeclaration) || !isClassLike(suggestion.valueDeclaration) || ((
|
|
77621
|
+
const suggestionHasNoExtendsOrDecorators = !(suggestion == null ? void 0 : suggestion.valueDeclaration) || !isClassLike(suggestion.valueDeclaration) || ((_a2 = suggestion.valueDeclaration.heritageClauses) == null ? void 0 : _a2.length) || classOrConstructorParameterIsDecorated(
|
|
77582
77622
|
/*useLegacyDecorators*/
|
|
77583
77623
|
false,
|
|
77584
77624
|
suggestion.valueDeclaration
|
|
@@ -78376,7 +78416,7 @@ function createTypeChecker(host) {
|
|
|
78376
78416
|
errorOutputContainer
|
|
78377
78417
|
);
|
|
78378
78418
|
function checkTagNameDoesNotExpectTooManyArguments() {
|
|
78379
|
-
var
|
|
78419
|
+
var _a2;
|
|
78380
78420
|
if (getJsxNamespaceContainerForImplicitImport(node)) {
|
|
78381
78421
|
return true;
|
|
78382
78422
|
}
|
|
@@ -78442,7 +78482,7 @@ function createTypeChecker(host) {
|
|
|
78442
78482
|
}
|
|
78443
78483
|
if (reportErrors2) {
|
|
78444
78484
|
const diag2 = createDiagnosticForNode(node.tagName, Diagnostics.Tag_0_expects_at_least_1_arguments_but_the_JSX_factory_2_provides_at_most_3, entityNameToString(node.tagName), absoluteMinArgCount, entityNameToString(factory2), maxParamCount);
|
|
78445
|
-
const tagNameDeclaration = (
|
|
78485
|
+
const tagNameDeclaration = (_a2 = getSymbolAtLocation(node.tagName)) == null ? void 0 : _a2.valueDeclaration;
|
|
78446
78486
|
if (tagNameDeclaration) {
|
|
78447
78487
|
addRelatedInfo(diag2, createDiagnosticForNode(tagNameDeclaration, Diagnostics._0_is_declared_here, entityNameToString(node.tagName)));
|
|
78448
78488
|
}
|
|
@@ -78591,9 +78631,9 @@ function createTypeChecker(host) {
|
|
|
78591
78631
|
const spreadType = arg.kind === 230 /* SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
|
|
78592
78632
|
if (spreadType && isTupleType(spreadType)) {
|
|
78593
78633
|
forEach(getElementTypes(spreadType), (t, i2) => {
|
|
78594
|
-
var
|
|
78634
|
+
var _a2;
|
|
78595
78635
|
const flags = spreadType.target.elementFlags[i2];
|
|
78596
|
-
const syntheticArg = createSyntheticExpression(arg, flags & 4 /* Rest */ ? createArrayType(t) : t, !!(flags & 12 /* Variable */), (
|
|
78636
|
+
const syntheticArg = createSyntheticExpression(arg, flags & 4 /* Rest */ ? createArrayType(t) : t, !!(flags & 12 /* Variable */), (_a2 = spreadType.target.labeledElementDeclarations) == null ? void 0 : _a2[i2]);
|
|
78597
78637
|
effectiveArgs.push(syntheticArg);
|
|
78598
78638
|
});
|
|
78599
78639
|
} else {
|
|
@@ -78701,7 +78741,7 @@ function createTypeChecker(host) {
|
|
|
78701
78741
|
return constructorSymbol === globalPromiseSymbol;
|
|
78702
78742
|
}
|
|
78703
78743
|
function getArgumentArityError(node, signatures, args, headMessage) {
|
|
78704
|
-
var
|
|
78744
|
+
var _a2;
|
|
78705
78745
|
const spreadIndex = getSpreadArgumentIndex(args);
|
|
78706
78746
|
if (spreadIndex > -1) {
|
|
78707
78747
|
return createDiagnosticForNode(args[spreadIndex], Diagnostics.A_spread_argument_must_either_have_a_tuple_type_or_be_passed_to_a_rest_parameter);
|
|
@@ -78760,7 +78800,7 @@ function createTypeChecker(host) {
|
|
|
78760
78800
|
} else {
|
|
78761
78801
|
diagnostic = getDiagnosticForCallNode(node, error3, parameterRange, args.length);
|
|
78762
78802
|
}
|
|
78763
|
-
const parameter = (
|
|
78803
|
+
const parameter = (_a2 = closestSignature == null ? void 0 : closestSignature.declaration) == null ? void 0 : _a2.parameters[closestSignature.thisParameter ? args.length + 1 : args.length];
|
|
78764
78804
|
if (parameter) {
|
|
78765
78805
|
const messageAndArgs = isBindingPattern(parameter.name) ? [Diagnostics.An_argument_matching_this_binding_pattern_was_not_provided] : isRestParameter(parameter) ? [Diagnostics.Arguments_for_the_rest_parameter_0_were_not_provided, idText(getFirstIdentifier(parameter.name))] : [Diagnostics.An_argument_for_0_was_not_provided, !parameter.name ? args.length : idText(getFirstIdentifier(parameter.name))];
|
|
78766
78806
|
const parameterError = createDiagnosticForNode(parameter, ...messageAndArgs);
|
|
@@ -79000,11 +79040,11 @@ function createTypeChecker(host) {
|
|
|
79000
79040
|
}
|
|
79001
79041
|
return result;
|
|
79002
79042
|
function addImplementationSuccessElaboration(failed, diagnostic) {
|
|
79003
|
-
var
|
|
79043
|
+
var _a2, _b;
|
|
79004
79044
|
const oldCandidatesForArgumentError = candidatesForArgumentError;
|
|
79005
79045
|
const oldCandidateForArgumentArityError = candidateForArgumentArityError;
|
|
79006
79046
|
const oldCandidateForTypeArgumentError = candidateForTypeArgumentError;
|
|
79007
|
-
const failedSignatureDeclarations = ((_b = (
|
|
79047
|
+
const failedSignatureDeclarations = ((_b = (_a2 = failed.declaration) == null ? void 0 : _a2.symbol) == null ? void 0 : _b.declarations) || emptyArray;
|
|
79008
79048
|
const isOverload2 = failedSignatureDeclarations.length > 1;
|
|
79009
79049
|
const implDecl = isOverload2 ? find(failedSignatureDeclarations, (d) => isFunctionLikeDeclaration(d) && nodeIsPresent(d.body)) : void 0;
|
|
79010
79050
|
if (implDecl) {
|
|
@@ -79019,7 +79059,7 @@ function createTypeChecker(host) {
|
|
|
79019
79059
|
candidateForTypeArgumentError = oldCandidateForTypeArgumentError;
|
|
79020
79060
|
}
|
|
79021
79061
|
function chooseOverload(candidates2, relation, isSingleNonGenericCandidate2, signatureHelpTrailingComma2 = false) {
|
|
79022
|
-
var
|
|
79062
|
+
var _a2, _b;
|
|
79023
79063
|
candidatesForArgumentError = void 0;
|
|
79024
79064
|
candidateForArgumentArityError = void 0;
|
|
79025
79065
|
candidateForTypeArgumentError = void 0;
|
|
@@ -79054,7 +79094,7 @@ function createTypeChecker(host) {
|
|
|
79054
79094
|
let checkCandidate;
|
|
79055
79095
|
let inferenceContext;
|
|
79056
79096
|
if (candidate.typeParameters) {
|
|
79057
|
-
const paramLocation = (_b = (
|
|
79097
|
+
const paramLocation = (_b = (_a2 = candidate.typeParameters[0].symbol.declarations) == null ? void 0 : _a2[0]) == null ? void 0 : _b.parent;
|
|
79058
79098
|
const candidateParameterContext = paramLocation || (candidate.declaration && isConstructorDeclaration(candidate.declaration) ? candidate.declaration.parent : candidate.declaration);
|
|
79059
79099
|
if (candidateParameterContext && findAncestor(node, (a) => a === candidateParameterContext)) {
|
|
79060
79100
|
candidate = getImplementationSignature(candidate);
|
|
@@ -79743,7 +79783,7 @@ function createTypeChecker(host) {
|
|
|
79743
79783
|
return result;
|
|
79744
79784
|
}
|
|
79745
79785
|
function isJSConstructor(node) {
|
|
79746
|
-
var
|
|
79786
|
+
var _a2;
|
|
79747
79787
|
if (!node || !isInJSFile(node)) {
|
|
79748
79788
|
return false;
|
|
79749
79789
|
}
|
|
@@ -79754,12 +79794,12 @@ function createTypeChecker(host) {
|
|
|
79754
79794
|
if (isPropertyAssignment(walkUpParenthesizedExpressions(func.parent)))
|
|
79755
79795
|
return false;
|
|
79756
79796
|
const symbol = getSymbolOfDeclaration(func);
|
|
79757
|
-
return !!((
|
|
79797
|
+
return !!((_a2 = symbol == null ? void 0 : symbol.members) == null ? void 0 : _a2.size);
|
|
79758
79798
|
}
|
|
79759
79799
|
return false;
|
|
79760
79800
|
}
|
|
79761
79801
|
function mergeJSSymbols(target, source) {
|
|
79762
|
-
var
|
|
79802
|
+
var _a2, _b;
|
|
79763
79803
|
if (source) {
|
|
79764
79804
|
const links = getSymbolLinks(source);
|
|
79765
79805
|
if (!links.inferredClassSymbol || !links.inferredClassSymbol.has(getSymbolId(target))) {
|
|
@@ -79767,7 +79807,7 @@ function createTypeChecker(host) {
|
|
|
79767
79807
|
inferred.exports = inferred.exports || createSymbolTable();
|
|
79768
79808
|
inferred.members = inferred.members || createSymbolTable();
|
|
79769
79809
|
inferred.flags |= source.flags & 32 /* Class */;
|
|
79770
|
-
if ((
|
|
79810
|
+
if ((_a2 = source.exports) == null ? void 0 : _a2.size) {
|
|
79771
79811
|
mergeSymbolTable(inferred.exports, source.exports);
|
|
79772
79812
|
}
|
|
79773
79813
|
if ((_b = source.members) == null ? void 0 : _b.size) {
|
|
@@ -79780,13 +79820,13 @@ function createTypeChecker(host) {
|
|
|
79780
79820
|
}
|
|
79781
79821
|
}
|
|
79782
79822
|
function getAssignedClassSymbol(decl) {
|
|
79783
|
-
var
|
|
79823
|
+
var _a2;
|
|
79784
79824
|
const assignmentSymbol = decl && getSymbolOfExpando(
|
|
79785
79825
|
decl,
|
|
79786
79826
|
/*allowDeclaration*/
|
|
79787
79827
|
true
|
|
79788
79828
|
);
|
|
79789
|
-
const prototype = (
|
|
79829
|
+
const prototype = (_a2 = assignmentSymbol == null ? void 0 : assignmentSymbol.exports) == null ? void 0 : _a2.get("prototype");
|
|
79790
79830
|
const init = (prototype == null ? void 0 : prototype.valueDeclaration) && getAssignedJSPrototype(prototype.valueDeclaration);
|
|
79791
79831
|
return init ? getSymbolOfDeclaration(init) : void 0;
|
|
79792
79832
|
}
|
|
@@ -79843,7 +79883,7 @@ function createTypeChecker(host) {
|
|
|
79843
79883
|
}
|
|
79844
79884
|
}
|
|
79845
79885
|
function checkCallExpression(node, checkMode) {
|
|
79846
|
-
var
|
|
79886
|
+
var _a2, _b, _c;
|
|
79847
79887
|
checkGrammarTypeArguments(node, node.typeArguments);
|
|
79848
79888
|
const signature = getResolvedSignature(
|
|
79849
79889
|
node,
|
|
@@ -79860,7 +79900,7 @@ function createTypeChecker(host) {
|
|
|
79860
79900
|
}
|
|
79861
79901
|
if (node.kind === 214 /* NewExpression */) {
|
|
79862
79902
|
const declaration = signature.declaration;
|
|
79863
|
-
if (declaration && declaration.kind !== 176 /* Constructor */ && declaration.kind !== 180 /* ConstructSignature */ && declaration.kind !== 185 /* ConstructorType */ && !(isJSDocSignature(declaration) && ((_b = (
|
|
79903
|
+
if (declaration && declaration.kind !== 176 /* Constructor */ && declaration.kind !== 180 /* ConstructSignature */ && declaration.kind !== 185 /* ConstructorType */ && !(isJSDocSignature(declaration) && ((_b = (_a2 = getJSDocRoot(declaration)) == null ? void 0 : _a2.parent) == null ? void 0 : _b.kind) === 176 /* Constructor */) && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) {
|
|
79864
79904
|
if (noImplicitAny) {
|
|
79865
79905
|
error2(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);
|
|
79866
79906
|
}
|
|
@@ -80019,11 +80059,11 @@ function createTypeChecker(host) {
|
|
|
80019
80059
|
return void 0;
|
|
80020
80060
|
}
|
|
80021
80061
|
function getTypeWithSyntheticDefaultImportType(type, symbol, originalSymbol, moduleSpecifier) {
|
|
80022
|
-
var
|
|
80062
|
+
var _a2;
|
|
80023
80063
|
if (allowSyntheticDefaultImports && type && !isErrorType(type)) {
|
|
80024
80064
|
const synthType = type;
|
|
80025
80065
|
if (!synthType.syntheticType) {
|
|
80026
|
-
const file = (
|
|
80066
|
+
const file = (_a2 = originalSymbol.declarations) == null ? void 0 : _a2.find(isSourceFile);
|
|
80027
80067
|
const hasSyntheticDefault = canHaveSyntheticDefault(
|
|
80028
80068
|
file,
|
|
80029
80069
|
originalSymbol,
|
|
@@ -80357,8 +80397,8 @@ function createTypeChecker(host) {
|
|
|
80357
80397
|
return restParameter.escapedName;
|
|
80358
80398
|
}
|
|
80359
80399
|
function getParameterIdentifierInfoAtPosition(signature, pos) {
|
|
80360
|
-
var
|
|
80361
|
-
if (((
|
|
80400
|
+
var _a2;
|
|
80401
|
+
if (((_a2 = signature.declaration) == null ? void 0 : _a2.kind) === 317 /* JSDocFunctionType */) {
|
|
80362
80402
|
return void 0;
|
|
80363
80403
|
}
|
|
80364
80404
|
const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
|
|
@@ -81045,14 +81085,24 @@ function createTypeChecker(host) {
|
|
|
81045
81085
|
void 0
|
|
81046
81086
|
) || unknownType;
|
|
81047
81087
|
if (globalGeneratorType === emptyGenericType) {
|
|
81048
|
-
const
|
|
81088
|
+
const globalType = resolver.getGlobalIterableIteratorType(
|
|
81049
81089
|
/*reportErrors*/
|
|
81050
81090
|
false
|
|
81051
81091
|
);
|
|
81052
|
-
|
|
81053
|
-
|
|
81092
|
+
const iterationTypes = globalType !== emptyGenericType ? getIterationTypesOfGlobalIterableType(globalType, resolver) : void 0;
|
|
81093
|
+
const iterableIteratorReturnType = iterationTypes ? iterationTypes.returnType : anyType;
|
|
81094
|
+
const iterableIteratorNextType = iterationTypes ? iterationTypes.nextType : undefinedType;
|
|
81095
|
+
if (isTypeAssignableTo(returnType, iterableIteratorReturnType) && isTypeAssignableTo(iterableIteratorNextType, nextType)) {
|
|
81096
|
+
if (globalType !== emptyGenericType) {
|
|
81097
|
+
return createTypeFromGenericGlobalType(globalType, [yieldType]);
|
|
81098
|
+
}
|
|
81099
|
+
resolver.getGlobalIterableIteratorType(
|
|
81100
|
+
/*reportErrors*/
|
|
81101
|
+
true
|
|
81102
|
+
);
|
|
81103
|
+
return emptyObjectType;
|
|
81054
81104
|
}
|
|
81055
|
-
resolver.
|
|
81105
|
+
resolver.getGlobalGeneratorType(
|
|
81056
81106
|
/*reportErrors*/
|
|
81057
81107
|
true
|
|
81058
81108
|
);
|
|
@@ -81458,7 +81508,7 @@ function createTypeChecker(host) {
|
|
|
81458
81508
|
return !!(getCheckFlags(symbol) & 8 /* Readonly */ || symbol.flags & 4 /* Property */ && getDeclarationModifierFlagsFromSymbol(symbol) & 8 /* Readonly */ || symbol.flags & 3 /* Variable */ && getDeclarationNodeFlagsFromSymbol(symbol) & 6 /* Constant */ || symbol.flags & 98304 /* Accessor */ && !(symbol.flags & 65536 /* SetAccessor */) || symbol.flags & 8 /* EnumMember */ || some(symbol.declarations, isReadonlyAssignmentDeclaration));
|
|
81459
81509
|
}
|
|
81460
81510
|
function isAssignmentToReadonlyEntity(expr, symbol, assignmentKind) {
|
|
81461
|
-
var
|
|
81511
|
+
var _a2, _b;
|
|
81462
81512
|
if (assignmentKind === 0 /* None */) {
|
|
81463
81513
|
return false;
|
|
81464
81514
|
}
|
|
@@ -81472,7 +81522,7 @@ function createTypeChecker(host) {
|
|
|
81472
81522
|
const isAssignmentDeclaration2 = isBinaryExpression(symbol.valueDeclaration);
|
|
81473
81523
|
const isLocalPropertyDeclaration = ctor.parent === symbol.valueDeclaration.parent;
|
|
81474
81524
|
const isLocalParameterProperty = ctor === symbol.valueDeclaration.parent;
|
|
81475
|
-
const isLocalThisPropertyAssignment = isAssignmentDeclaration2 && ((
|
|
81525
|
+
const isLocalThisPropertyAssignment = isAssignmentDeclaration2 && ((_a2 = symbol.parent) == null ? void 0 : _a2.valueDeclaration) === ctor.parent;
|
|
81476
81526
|
const isLocalThisPropertyAssignmentConstructorFunction = isAssignmentDeclaration2 && ((_b = symbol.parent) == null ? void 0 : _b.valueDeclaration) === ctor;
|
|
81477
81527
|
const isWriteableSymbol = isLocalPropertyDeclaration || isLocalParameterProperty || isLocalThisPropertyAssignment || isLocalThisPropertyAssignmentConstructorFunction;
|
|
81478
81528
|
return !isWriteableSymbol;
|
|
@@ -81870,7 +81920,7 @@ function createTypeChecker(host) {
|
|
|
81870
81920
|
checkExternalEmitHelpers(node, 512 /* Read */);
|
|
81871
81921
|
}
|
|
81872
81922
|
const possiblyOutOfBoundsType = checkIteratedTypeOrElementType(65 /* Destructuring */ | 128 /* PossiblyOutOfBounds */, sourceType, undefinedType, node) || errorType;
|
|
81873
|
-
let inBoundsType =
|
|
81923
|
+
let inBoundsType = noUncheckedIndexedAccess ? void 0 : possiblyOutOfBoundsType;
|
|
81874
81924
|
for (let i = 0; i < elements.length; i++) {
|
|
81875
81925
|
let type = possiblyOutOfBoundsType;
|
|
81876
81926
|
if (node.elements[i].kind === 230 /* SpreadElement */) {
|
|
@@ -82459,7 +82509,7 @@ function createTypeChecker(host) {
|
|
|
82459
82509
|
}
|
|
82460
82510
|
}
|
|
82461
82511
|
function isAssignmentDeclaration2(kind) {
|
|
82462
|
-
var
|
|
82512
|
+
var _a2;
|
|
82463
82513
|
switch (kind) {
|
|
82464
82514
|
case 2 /* ModuleExports */:
|
|
82465
82515
|
return true;
|
|
@@ -82470,7 +82520,7 @@ function createTypeChecker(host) {
|
|
|
82470
82520
|
case 4 /* ThisProperty */:
|
|
82471
82521
|
const symbol = getSymbolOfNode(left);
|
|
82472
82522
|
const init = getAssignedExpandoInitializer(right);
|
|
82473
|
-
return !!init && isObjectLiteralExpression(init) && !!((
|
|
82523
|
+
return !!init && isObjectLiteralExpression(init) && !!((_a2 = symbol == null ? void 0 : symbol.exports) == null ? void 0 : _a2.size);
|
|
82474
82524
|
default:
|
|
82475
82525
|
return false;
|
|
82476
82526
|
}
|
|
@@ -83020,8 +83070,8 @@ function createTypeChecker(host) {
|
|
|
83020
83070
|
return type;
|
|
83021
83071
|
}
|
|
83022
83072
|
function checkExpression(node, checkMode, forceTuple) {
|
|
83023
|
-
var
|
|
83024
|
-
(
|
|
83073
|
+
var _a2, _b;
|
|
83074
|
+
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Check, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
|
|
83025
83075
|
const saveCurrentNode = currentNode;
|
|
83026
83076
|
currentNode = node;
|
|
83027
83077
|
instantiationCount = 0;
|
|
@@ -83196,7 +83246,7 @@ function createTypeChecker(host) {
|
|
|
83196
83246
|
addLazyDiagnostic(() => checkTypeNameIsReserved(node.name, Diagnostics.Type_parameter_name_cannot_be_0));
|
|
83197
83247
|
}
|
|
83198
83248
|
function checkTypeParameterDeferred(node) {
|
|
83199
|
-
var
|
|
83249
|
+
var _a2, _b;
|
|
83200
83250
|
if (isInterfaceDeclaration(node.parent) || isClassLike(node.parent) || isTypeAliasDeclaration(node.parent)) {
|
|
83201
83251
|
const typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node));
|
|
83202
83252
|
const modifiers = getTypeParameterModifiers(typeParameter) & (8192 /* In */ | 16384 /* Out */);
|
|
@@ -83205,7 +83255,7 @@ function createTypeChecker(host) {
|
|
|
83205
83255
|
if (isTypeAliasDeclaration(node.parent) && !(getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (4 /* Reference */ | 16 /* Anonymous */ | 32 /* Mapped */))) {
|
|
83206
83256
|
error2(node, Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
83207
83257
|
} else if (modifiers === 8192 /* In */ || modifiers === 16384 /* Out */) {
|
|
83208
|
-
(
|
|
83258
|
+
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.CheckTypes, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
|
|
83209
83259
|
const source = createMarkerType(symbol, typeParameter, modifiers === 16384 /* Out */ ? markerSubTypeForCheck : markerSuperTypeForCheck);
|
|
83210
83260
|
const target = createMarkerType(symbol, typeParameter, modifiers === 16384 /* Out */ ? markerSuperTypeForCheck : markerSubTypeForCheck);
|
|
83211
83261
|
const saveVarianceTypeParameter = typeParameter;
|
|
@@ -83915,8 +83965,8 @@ function createTypeChecker(host) {
|
|
|
83915
83965
|
}
|
|
83916
83966
|
}
|
|
83917
83967
|
function checkGrammarMappedType(node) {
|
|
83918
|
-
var
|
|
83919
|
-
if ((
|
|
83968
|
+
var _a2;
|
|
83969
|
+
if ((_a2 = node.members) == null ? void 0 : _a2.length) {
|
|
83920
83970
|
return grammarErrorOnNode(node.members[0], Diagnostics.A_mapped_type_may_not_declare_properties_or_methods);
|
|
83921
83971
|
}
|
|
83922
83972
|
}
|
|
@@ -84350,13 +84400,13 @@ function createTypeChecker(host) {
|
|
|
84350
84400
|
return !!thenFunction && getSignaturesOfType(getTypeWithFacts(thenFunction, 2097152 /* NEUndefinedOrNull */), 0 /* Call */).length > 0;
|
|
84351
84401
|
}
|
|
84352
84402
|
function isAwaitedTypeInstantiation(type) {
|
|
84353
|
-
var
|
|
84403
|
+
var _a2;
|
|
84354
84404
|
if (type.flags & 16777216 /* Conditional */) {
|
|
84355
84405
|
const awaitedSymbol = getGlobalAwaitedSymbol(
|
|
84356
84406
|
/*reportErrors*/
|
|
84357
84407
|
false
|
|
84358
84408
|
);
|
|
84359
|
-
return !!awaitedSymbol && type.aliasSymbol === awaitedSymbol && ((
|
|
84409
|
+
return !!awaitedSymbol && type.aliasSymbol === awaitedSymbol && ((_a2 = type.aliasTypeArguments) == null ? void 0 : _a2.length) === 1;
|
|
84360
84410
|
}
|
|
84361
84411
|
return false;
|
|
84362
84412
|
}
|
|
@@ -84942,7 +84992,7 @@ function createTypeChecker(host) {
|
|
|
84942
84992
|
}
|
|
84943
84993
|
}
|
|
84944
84994
|
function checkFunctionOrMethodDeclaration(node) {
|
|
84945
|
-
var
|
|
84995
|
+
var _a2;
|
|
84946
84996
|
checkDecorators(node);
|
|
84947
84997
|
checkSignatureDeclaration(node);
|
|
84948
84998
|
const functionFlags = getFunctionFlags(node);
|
|
@@ -84952,7 +85002,7 @@ function createTypeChecker(host) {
|
|
|
84952
85002
|
if (hasBindableName(node)) {
|
|
84953
85003
|
const symbol = getSymbolOfDeclaration(node);
|
|
84954
85004
|
const localSymbol = node.localSymbol || symbol;
|
|
84955
|
-
const firstDeclaration = (
|
|
85005
|
+
const firstDeclaration = (_a2 = localSymbol.declarations) == null ? void 0 : _a2.find(
|
|
84956
85006
|
// Get first non javascript function declaration
|
|
84957
85007
|
(declaration) => declaration.kind === node.kind && !(declaration.flags & 524288 /* JavaScriptFile */)
|
|
84958
85008
|
);
|
|
@@ -85226,9 +85276,9 @@ function createTypeChecker(host) {
|
|
|
85226
85276
|
});
|
|
85227
85277
|
}
|
|
85228
85278
|
function checkPotentialUncheckedRenamedBindingElementsInTypes() {
|
|
85229
|
-
var
|
|
85279
|
+
var _a2;
|
|
85230
85280
|
for (const node of potentialUnusedRenamedBindingElementsInTypes) {
|
|
85231
|
-
if (!((
|
|
85281
|
+
if (!((_a2 = getSymbolOfDeclaration(node)) == null ? void 0 : _a2.isReferenced)) {
|
|
85232
85282
|
const wrappingDeclaration = walkUpBindingElementsAndPatterns(node);
|
|
85233
85283
|
Debug.assert(isPartOfParameterDeclaration(wrappingDeclaration), "Only parameter declaration should be checked here");
|
|
85234
85284
|
const diagnostic = createDiagnosticForNode(node.name, Diagnostics._0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation, declarationNameToString(node.name), declarationNameToString(node.propertyName));
|
|
@@ -85451,7 +85501,7 @@ function createTypeChecker(host) {
|
|
|
85451
85501
|
return type === autoType ? anyType : type === autoArrayType ? anyArrayType : type;
|
|
85452
85502
|
}
|
|
85453
85503
|
function checkVariableLikeDeclaration(node) {
|
|
85454
|
-
var
|
|
85504
|
+
var _a2;
|
|
85455
85505
|
checkDecorators(node);
|
|
85456
85506
|
if (!isBindingElement(node)) {
|
|
85457
85507
|
checkSourceElement(node.type);
|
|
@@ -85550,7 +85600,7 @@ function createTypeChecker(host) {
|
|
|
85550
85600
|
if (node === symbol.valueDeclaration) {
|
|
85551
85601
|
const initializer = hasOnlyExpressionInitializer(node) && getEffectiveInitializer(node);
|
|
85552
85602
|
if (initializer) {
|
|
85553
|
-
const isJSObjectLiteralInitializer = isInJSFile(node) && isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAccess(node.name)) && !!((
|
|
85603
|
+
const isJSObjectLiteralInitializer = isInJSFile(node) && isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAccess(node.name)) && !!((_a2 = symbol.exports) == null ? void 0 : _a2.size);
|
|
85554
85604
|
if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 249 /* ForInStatement */) {
|
|
85555
85605
|
const initializerType = checkExpressionCached(initializer);
|
|
85556
85606
|
checkTypeAssignableToAndOptionallyElaborate(
|
|
@@ -85645,8 +85695,8 @@ function createTypeChecker(host) {
|
|
|
85645
85695
|
return getSelectedEffectiveModifierFlags(left, interestingFlags) === getSelectedEffectiveModifierFlags(right, interestingFlags);
|
|
85646
85696
|
}
|
|
85647
85697
|
function checkVariableDeclaration(node) {
|
|
85648
|
-
var
|
|
85649
|
-
(
|
|
85698
|
+
var _a2, _b;
|
|
85699
|
+
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Check, "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
|
|
85650
85700
|
checkGrammarVariableDeclaration(node);
|
|
85651
85701
|
checkVariableLikeDeclaration(node);
|
|
85652
85702
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
@@ -85924,7 +85974,7 @@ function createTypeChecker(host) {
|
|
|
85924
85974
|
}
|
|
85925
85975
|
const uplevelIteration = languageVersion >= 2 /* ES2015 */;
|
|
85926
85976
|
const downlevelIteration = !uplevelIteration && compilerOptions.downlevelIteration;
|
|
85927
|
-
const possibleOutOfBounds =
|
|
85977
|
+
const possibleOutOfBounds = noUncheckedIndexedAccess && !!(use & 128 /* PossiblyOutOfBounds */);
|
|
85928
85978
|
if (uplevelIteration || downlevelIteration || allowAsyncIterables) {
|
|
85929
85979
|
const iterationTypes = getIterationTypesOfIterable(inputType, use, uplevelIteration ? errorNode : void 0);
|
|
85930
85980
|
if (checkAssignability) {
|
|
@@ -85973,14 +86023,14 @@ function createTypeChecker(host) {
|
|
|
85973
86023
|
}
|
|
85974
86024
|
const arrayElementType = getIndexTypeOfType(arrayType, numberType);
|
|
85975
86025
|
if (hasStringConstituent && arrayElementType) {
|
|
85976
|
-
if (arrayElementType.flags & 402653316 /* StringLike */ && !
|
|
86026
|
+
if (arrayElementType.flags & 402653316 /* StringLike */ && !noUncheckedIndexedAccess) {
|
|
85977
86027
|
return stringType;
|
|
85978
86028
|
}
|
|
85979
86029
|
return getUnionType(possibleOutOfBounds ? [arrayElementType, stringType, undefinedType] : [arrayElementType, stringType], 2 /* Subtype */);
|
|
85980
86030
|
}
|
|
85981
86031
|
return use & 128 /* PossiblyOutOfBounds */ ? includeUndefinedInIndexSignature(arrayElementType) : arrayElementType;
|
|
85982
86032
|
function getIterationDiagnosticDetails(allowsStrings, downlevelIteration2) {
|
|
85983
|
-
var
|
|
86033
|
+
var _a2;
|
|
85984
86034
|
if (downlevelIteration2) {
|
|
85985
86035
|
return allowsStrings ? [Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator, true] : [Diagnostics.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator, true];
|
|
85986
86036
|
}
|
|
@@ -85994,7 +86044,7 @@ function createTypeChecker(host) {
|
|
|
85994
86044
|
if (yieldType) {
|
|
85995
86045
|
return [Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher, false];
|
|
85996
86046
|
}
|
|
85997
|
-
if (isES2015OrLaterIterable((
|
|
86047
|
+
if (isES2015OrLaterIterable((_a2 = inputType.symbol) == null ? void 0 : _a2.escapedName)) {
|
|
85998
86048
|
return [Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher, true];
|
|
85999
86049
|
}
|
|
86000
86050
|
return allowsStrings ? [Diagnostics.Type_0_is_not_an_array_type_or_a_string_type, true] : [Diagnostics.Type_0_is_not_an_array_type, true];
|
|
@@ -86066,7 +86116,7 @@ function createTypeChecker(host) {
|
|
|
86066
86116
|
return type[cacheKey] = cachedTypes2;
|
|
86067
86117
|
}
|
|
86068
86118
|
function getIterationTypesOfIterable(type, use, errorNode) {
|
|
86069
|
-
var
|
|
86119
|
+
var _a2, _b;
|
|
86070
86120
|
if (isTypeAny(type)) {
|
|
86071
86121
|
return anyIterationTypes;
|
|
86072
86122
|
}
|
|
@@ -86081,7 +86131,7 @@ function createTypeChecker(host) {
|
|
|
86081
86131
|
}
|
|
86082
86132
|
}
|
|
86083
86133
|
return void 0;
|
|
86084
|
-
} else if ((
|
|
86134
|
+
} else if ((_a2 = errorOutputContainer == null ? void 0 : errorOutputContainer.errors) == null ? void 0 : _a2.length) {
|
|
86085
86135
|
for (const diag2 of errorOutputContainer.errors) {
|
|
86086
86136
|
diagnostics.add(diag2);
|
|
86087
86137
|
}
|
|
@@ -86188,14 +86238,41 @@ function createTypeChecker(host) {
|
|
|
86188
86238
|
function getIterationTypesOfIterableCached(type, resolver) {
|
|
86189
86239
|
return getCachedIterationTypes(type, resolver.iterableCacheKey);
|
|
86190
86240
|
}
|
|
86241
|
+
function getIterationTypesOfGlobalIterableType(globalType, resolver) {
|
|
86242
|
+
const globalIterationTypes = getIterationTypesOfIterableCached(globalType, resolver) || getIterationTypesOfIterableSlow(
|
|
86243
|
+
globalType,
|
|
86244
|
+
resolver,
|
|
86245
|
+
/*errorNode*/
|
|
86246
|
+
void 0,
|
|
86247
|
+
/*errorOutputContainer*/
|
|
86248
|
+
void 0,
|
|
86249
|
+
/*noCache*/
|
|
86250
|
+
false
|
|
86251
|
+
);
|
|
86252
|
+
return globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes;
|
|
86253
|
+
}
|
|
86191
86254
|
function getIterationTypesOfIterableFast(type, resolver) {
|
|
86192
|
-
|
|
86255
|
+
let globalType;
|
|
86256
|
+
if (isReferenceToType2(type, globalType = resolver.getGlobalIterableType(
|
|
86193
86257
|
/*reportErrors*/
|
|
86194
86258
|
false
|
|
86195
|
-
)) || isReferenceToType2(type, resolver.getGlobalIterableIteratorType(
|
|
86259
|
+
)) || isReferenceToType2(type, globalType = resolver.getGlobalIterableIteratorType(
|
|
86196
86260
|
/*reportErrors*/
|
|
86197
86261
|
false
|
|
86198
|
-
))
|
|
86262
|
+
))) {
|
|
86263
|
+
const [yieldType] = getTypeArguments(type);
|
|
86264
|
+
const { returnType, nextType } = getIterationTypesOfGlobalIterableType(globalType, resolver);
|
|
86265
|
+
return setCachedIterationTypes(type, resolver.iterableCacheKey, createIterationTypes(resolver.resolveIterationType(
|
|
86266
|
+
yieldType,
|
|
86267
|
+
/*errorNode*/
|
|
86268
|
+
void 0
|
|
86269
|
+
) || yieldType, resolver.resolveIterationType(
|
|
86270
|
+
returnType,
|
|
86271
|
+
/*errorNode*/
|
|
86272
|
+
void 0
|
|
86273
|
+
) || returnType, nextType));
|
|
86274
|
+
}
|
|
86275
|
+
if (isReferenceToType2(type, resolver.getGlobalGeneratorType(
|
|
86199
86276
|
/*reportErrors*/
|
|
86200
86277
|
false
|
|
86201
86278
|
))) {
|
|
@@ -86240,10 +86317,10 @@ function createTypeChecker(host) {
|
|
|
86240
86317
|
!!getAwaitedTypeOfPromise(type) || !allowAsyncIterables && isForOfStatement(errorNode.parent) && errorNode.parent.expression === errorNode && getGlobalAsyncIterableType(
|
|
86241
86318
|
/*reportErrors*/
|
|
86242
86319
|
false
|
|
86243
|
-
) !== emptyGenericType && isTypeAssignableTo(type,
|
|
86320
|
+
) !== emptyGenericType && isTypeAssignableTo(type, getGlobalAsyncIterableType(
|
|
86244
86321
|
/*reportErrors*/
|
|
86245
86322
|
false
|
|
86246
|
-
)
|
|
86323
|
+
))
|
|
86247
86324
|
);
|
|
86248
86325
|
return errorAndMaybeSuggestAwait(errorNode, suggestAwait, message, typeToString(type));
|
|
86249
86326
|
}
|
|
@@ -86273,10 +86350,26 @@ function createTypeChecker(host) {
|
|
|
86273
86350
|
return getCachedIterationTypes(type, resolver.iteratorCacheKey);
|
|
86274
86351
|
}
|
|
86275
86352
|
function getIterationTypesOfIteratorFast(type, resolver) {
|
|
86276
|
-
|
|
86353
|
+
const globalType = resolver.getGlobalIterableIteratorType(
|
|
86277
86354
|
/*reportErrors*/
|
|
86278
86355
|
false
|
|
86279
|
-
)
|
|
86356
|
+
);
|
|
86357
|
+
if (isReferenceToType2(type, globalType)) {
|
|
86358
|
+
const [yieldType] = getTypeArguments(type);
|
|
86359
|
+
const globalIterationTypes = getIterationTypesOfIteratorCached(globalType, resolver) || getIterationTypesOfIteratorSlow(
|
|
86360
|
+
globalType,
|
|
86361
|
+
resolver,
|
|
86362
|
+
/*errorNode*/
|
|
86363
|
+
void 0,
|
|
86364
|
+
/*errorOutputContainer*/
|
|
86365
|
+
void 0,
|
|
86366
|
+
/*noCache*/
|
|
86367
|
+
false
|
|
86368
|
+
);
|
|
86369
|
+
const { returnType, nextType } = globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes;
|
|
86370
|
+
return setCachedIterationTypes(type, resolver.iteratorCacheKey, createIterationTypes(yieldType, returnType, nextType));
|
|
86371
|
+
}
|
|
86372
|
+
if (isReferenceToType2(type, resolver.getGlobalIteratorType(
|
|
86280
86373
|
/*reportErrors*/
|
|
86281
86374
|
false
|
|
86282
86375
|
)) || isReferenceToType2(type, resolver.getGlobalGeneratorType(
|
|
@@ -86346,7 +86439,7 @@ function createTypeChecker(host) {
|
|
|
86346
86439
|
));
|
|
86347
86440
|
}
|
|
86348
86441
|
function getIterationTypesOfMethod(type, resolver, methodName, errorNode, errorOutputContainer) {
|
|
86349
|
-
var
|
|
86442
|
+
var _a2, _b, _c, _d;
|
|
86350
86443
|
const method = getPropertyOfType(type, methodName);
|
|
86351
86444
|
if (!method && methodName !== "next") {
|
|
86352
86445
|
return void 0;
|
|
@@ -86377,7 +86470,7 @@ function createTypeChecker(host) {
|
|
|
86377
86470
|
/*reportErrors*/
|
|
86378
86471
|
false
|
|
86379
86472
|
);
|
|
86380
|
-
const isGeneratorMethod = ((_b = (
|
|
86473
|
+
const isGeneratorMethod = ((_b = (_a2 = globalGeneratorType.symbol) == null ? void 0 : _a2.members) == null ? void 0 : _b.get(methodName)) === methodType.symbol;
|
|
86381
86474
|
const isIteratorMethod = !isGeneratorMethod && ((_d = (_c = globalIteratorType.symbol) == null ? void 0 : _c.members) == null ? void 0 : _d.get(methodName)) === methodType.symbol;
|
|
86382
86475
|
if (isGeneratorMethod || isIteratorMethod) {
|
|
86383
86476
|
const globalType = isGeneratorMethod ? globalGeneratorType : globalIteratorType;
|
|
@@ -87249,7 +87342,7 @@ function createTypeChecker(host) {
|
|
|
87249
87342
|
return filter(symbol.declarations, (d) => d.kind === 263 /* ClassDeclaration */ || d.kind === 264 /* InterfaceDeclaration */);
|
|
87250
87343
|
}
|
|
87251
87344
|
function checkKindsOfPropertyMemberOverrides(type, baseType) {
|
|
87252
|
-
var
|
|
87345
|
+
var _a2, _b, _c, _d, _e;
|
|
87253
87346
|
const baseProperties = getPropertiesOfType(baseType);
|
|
87254
87347
|
const notImplementedInfo = /* @__PURE__ */ new Map();
|
|
87255
87348
|
basePropertyCheck:
|
|
@@ -87280,7 +87373,7 @@ function createTypeChecker(host) {
|
|
|
87280
87373
|
const baseTypeName = typeToString(baseType);
|
|
87281
87374
|
const typeName = typeToString(type);
|
|
87282
87375
|
const basePropertyName = symbolToString(baseProperty);
|
|
87283
|
-
const missedProperties = append((
|
|
87376
|
+
const missedProperties = append((_a2 = notImplementedInfo.get(derivedClassDecl)) == null ? void 0 : _a2.missedProperties, basePropertyName);
|
|
87284
87377
|
notImplementedInfo.set(derivedClassDecl, { baseTypeName, typeName, missedProperties });
|
|
87285
87378
|
}
|
|
87286
87379
|
} else {
|
|
@@ -87292,7 +87385,7 @@ function createTypeChecker(host) {
|
|
|
87292
87385
|
const basePropertyFlags = base.flags & 98308 /* PropertyOrAccessor */;
|
|
87293
87386
|
const derivedPropertyFlags = derived.flags & 98308 /* PropertyOrAccessor */;
|
|
87294
87387
|
if (basePropertyFlags && derivedPropertyFlags) {
|
|
87295
|
-
if ((getCheckFlags(base) & 6 /*
|
|
87388
|
+
if ((getCheckFlags(base) & 6 /* SyntheticMember */ ? (_b = base.declarations) == null ? void 0 : _b.some((d) => isPropertyAbstractOrInterface(d, baseDeclarationFlags)) : (_c = base.declarations) == null ? void 0 : _c.every((d) => isPropertyAbstractOrInterface(d, baseDeclarationFlags))) || getCheckFlags(base) & 262144 /* Mapped */ || derived.valueDeclaration && isBinaryExpression(derived.valueDeclaration)) {
|
|
87296
87389
|
continue;
|
|
87297
87390
|
}
|
|
87298
87391
|
const overriddenInstanceProperty = basePropertyFlags !== 4 /* Property */ && derivedPropertyFlags === 4 /* Property */;
|
|
@@ -87773,7 +87866,7 @@ function createTypeChecker(host) {
|
|
|
87773
87866
|
}
|
|
87774
87867
|
addLazyDiagnostic(checkModuleDeclarationDiagnostics);
|
|
87775
87868
|
function checkModuleDeclarationDiagnostics() {
|
|
87776
|
-
var
|
|
87869
|
+
var _a2, _b;
|
|
87777
87870
|
const isGlobalAugmentation = isGlobalScopeAugmentation(node);
|
|
87778
87871
|
const inAmbientContext = node.flags & 33554432 /* Ambient */;
|
|
87779
87872
|
if (isGlobalAugmentation && !inAmbientContext) {
|
|
@@ -87798,7 +87891,7 @@ function createTypeChecker(host) {
|
|
|
87798
87891
|
if (getIsolatedModules(compilerOptions) && !getSourceFileOfNode(node).externalModuleIndicator) {
|
|
87799
87892
|
error2(node.name, Diagnostics.Namespaces_are_not_allowed_in_global_script_files_when_0_is_enabled_If_this_file_is_not_intended_to_be_a_global_script_set_moduleDetection_to_force_or_add_an_empty_export_statement, isolatedModulesLikeFlagName);
|
|
87800
87893
|
}
|
|
87801
|
-
if (((
|
|
87894
|
+
if (((_a2 = symbol.declarations) == null ? void 0 : _a2.length) > 1) {
|
|
87802
87895
|
const firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol);
|
|
87803
87896
|
if (firstNonAmbientClassOrFunc) {
|
|
87804
87897
|
if (getSourceFileOfNode(node) !== getSourceFileOfNode(firstNonAmbientClassOrFunc)) {
|
|
@@ -87935,7 +88028,7 @@ function createTypeChecker(host) {
|
|
|
87935
88028
|
return true;
|
|
87936
88029
|
}
|
|
87937
88030
|
function checkAliasSymbol(node) {
|
|
87938
|
-
var
|
|
88031
|
+
var _a2, _b, _c, _d;
|
|
87939
88032
|
let symbol = getSymbolOfDeclaration(node);
|
|
87940
88033
|
const target = resolveAlias(symbol);
|
|
87941
88034
|
if (target !== unknownSymbol) {
|
|
@@ -87945,7 +88038,7 @@ function createTypeChecker(host) {
|
|
|
87945
88038
|
Debug.assert(node.kind !== 280 /* NamespaceExport */);
|
|
87946
88039
|
if (node.kind === 281 /* ExportSpecifier */) {
|
|
87947
88040
|
const diag2 = error2(errorNode, Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files);
|
|
87948
|
-
const alreadyExportedSymbol = (_b = (
|
|
88041
|
+
const alreadyExportedSymbol = (_b = (_a2 = getSourceFileOfNode(node).symbol) == null ? void 0 : _a2.exports) == null ? void 0 : _b.get((node.propertyName || node.name).escapedText);
|
|
87949
88042
|
if (alreadyExportedSymbol === target) {
|
|
87950
88043
|
const exportingDeclaration = (_c = alreadyExportedSymbol.declarations) == null ? void 0 : _c.find(isJSDocNode);
|
|
87951
88044
|
if (exportingDeclaration) {
|
|
@@ -88072,7 +88165,7 @@ function createTypeChecker(host) {
|
|
|
88072
88165
|
}
|
|
88073
88166
|
}
|
|
88074
88167
|
function checkImportAttributes(declaration) {
|
|
88075
|
-
var
|
|
88168
|
+
var _a2;
|
|
88076
88169
|
const node = declaration.attributes;
|
|
88077
88170
|
if (node) {
|
|
88078
88171
|
const importAttributesType = getGlobalImportAttributesType(
|
|
@@ -88093,7 +88186,7 @@ function createTypeChecker(host) {
|
|
|
88093
88186
|
const message = isImportAttributes2 ? moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve : moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve;
|
|
88094
88187
|
return grammarErrorOnNode(node, message);
|
|
88095
88188
|
}
|
|
88096
|
-
const isTypeOnly = isJSDocImportTag(declaration) || (isImportDeclaration(declaration) ? (
|
|
88189
|
+
const isTypeOnly = isJSDocImportTag(declaration) || (isImportDeclaration(declaration) ? (_a2 = declaration.importClause) == null ? void 0 : _a2.isTypeOnly : declaration.isTypeOnly);
|
|
88097
88190
|
if (isTypeOnly) {
|
|
88098
88191
|
return grammarErrorOnNode(node, isImportAttributes2 ? Diagnostics.Import_attributes_cannot_be_used_with_type_only_imports_or_exports : Diagnostics.Import_assertions_cannot_be_used_with_type_only_imports_or_exports);
|
|
88099
88192
|
}
|
|
@@ -88206,8 +88299,8 @@ function createTypeChecker(host) {
|
|
|
88206
88299
|
checkImportAttributes(node);
|
|
88207
88300
|
}
|
|
88208
88301
|
function checkGrammarExportDeclaration(node) {
|
|
88209
|
-
var
|
|
88210
|
-
if (node.isTypeOnly && ((
|
|
88302
|
+
var _a2;
|
|
88303
|
+
if (node.isTypeOnly && ((_a2 = node.exportClause) == null ? void 0 : _a2.kind) === 279 /* NamedExports */) {
|
|
88211
88304
|
return checkGrammarNamedImportsOrExports(node.exportClause);
|
|
88212
88305
|
}
|
|
88213
88306
|
return false;
|
|
@@ -88709,8 +88802,8 @@ function createTypeChecker(host) {
|
|
|
88709
88802
|
links.deferredNodes = void 0;
|
|
88710
88803
|
}
|
|
88711
88804
|
function checkDeferredNode(node) {
|
|
88712
|
-
var
|
|
88713
|
-
(
|
|
88805
|
+
var _a2, _b;
|
|
88806
|
+
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Check, "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
|
|
88714
88807
|
const saveCurrentNode = currentNode;
|
|
88715
88808
|
currentNode = node;
|
|
88716
88809
|
instantiationCount = 0;
|
|
@@ -88762,8 +88855,8 @@ function createTypeChecker(host) {
|
|
|
88762
88855
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
88763
88856
|
}
|
|
88764
88857
|
function checkSourceFile(node) {
|
|
88765
|
-
var
|
|
88766
|
-
(
|
|
88858
|
+
var _a2, _b;
|
|
88859
|
+
(_a2 = tracing) == null ? void 0 : _a2.push(
|
|
88767
88860
|
tracing.Phase.Check,
|
|
88768
88861
|
"checkSourceFile",
|
|
88769
88862
|
{ path: node.path },
|
|
@@ -89557,7 +89650,7 @@ function createTypeChecker(host) {
|
|
|
89557
89650
|
return roots ? flatMap(roots, getRootSymbols) : [symbol];
|
|
89558
89651
|
}
|
|
89559
89652
|
function getImmediateRootSymbols(symbol) {
|
|
89560
|
-
if (getCheckFlags(symbol) & 6 /*
|
|
89653
|
+
if (getCheckFlags(symbol) & 6 /* SyntheticMember */) {
|
|
89561
89654
|
return mapDefined(getSymbolLinks(symbol).containingType.types, (type) => getPropertyOfType(type, symbol.escapedName));
|
|
89562
89655
|
} else if (symbol.flags & 33554432 /* Transient */) {
|
|
89563
89656
|
const { links: { leftSpread, rightSpread, syntheticOrigin } } = symbol;
|
|
@@ -89589,7 +89682,7 @@ function createTypeChecker(host) {
|
|
|
89589
89682
|
return isModuleOrEnumDeclaration(node.parent) && node === node.parent.name;
|
|
89590
89683
|
}
|
|
89591
89684
|
function getReferencedExportContainer(nodeIn, prefixLocals) {
|
|
89592
|
-
var
|
|
89685
|
+
var _a2;
|
|
89593
89686
|
const node = getParseTreeNode(nodeIn, isIdentifier);
|
|
89594
89687
|
if (node) {
|
|
89595
89688
|
let symbol = getReferencedValueSymbol(
|
|
@@ -89607,7 +89700,7 @@ function createTypeChecker(host) {
|
|
|
89607
89700
|
}
|
|
89608
89701
|
const parentSymbol = getParentOfSymbol(symbol);
|
|
89609
89702
|
if (parentSymbol) {
|
|
89610
|
-
if (parentSymbol.flags & 512 /* ValueModule */ && ((
|
|
89703
|
+
if (parentSymbol.flags & 512 /* ValueModule */ && ((_a2 = parentSymbol.valueDeclaration) == null ? void 0 : _a2.kind) === 307 /* SourceFile */) {
|
|
89611
89704
|
const symbolFile = parentSymbol.valueDeclaration;
|
|
89612
89705
|
const referenceFile = getSourceFileOfNode(node);
|
|
89613
89706
|
const symbolIsUmdExport = symbolFile !== referenceFile;
|
|
@@ -89834,11 +89927,11 @@ function createTypeChecker(host) {
|
|
|
89834
89927
|
return symbol && getPropertiesOfType(getTypeOfSymbol(symbol)) || emptyArray;
|
|
89835
89928
|
}
|
|
89836
89929
|
function getNodeCheckFlags(node) {
|
|
89837
|
-
var
|
|
89930
|
+
var _a2;
|
|
89838
89931
|
const nodeId = node.id || 0;
|
|
89839
89932
|
if (nodeId < 0 || nodeId >= nodeLinks.length)
|
|
89840
89933
|
return 0;
|
|
89841
|
-
return ((
|
|
89934
|
+
return ((_a2 = nodeLinks[nodeId]) == null ? void 0 : _a2.flags) || 0;
|
|
89842
89935
|
}
|
|
89843
89936
|
function getEnumMemberValue(node) {
|
|
89844
89937
|
computeEnumMemberValues(node.parent);
|
|
@@ -89873,7 +89966,7 @@ function createTypeChecker(host) {
|
|
|
89873
89966
|
return !!(type.flags & 524288 /* Object */) && getSignaturesOfType(type, 0 /* Call */).length > 0;
|
|
89874
89967
|
}
|
|
89875
89968
|
function getTypeReferenceSerializationKind(typeNameIn, location) {
|
|
89876
|
-
var
|
|
89969
|
+
var _a2;
|
|
89877
89970
|
const typeName = getParseTreeNode(typeNameIn, isEntityName);
|
|
89878
89971
|
if (!typeName)
|
|
89879
89972
|
return 0 /* Unknown */;
|
|
@@ -89893,7 +89986,7 @@ function createTypeChecker(host) {
|
|
|
89893
89986
|
true,
|
|
89894
89987
|
location
|
|
89895
89988
|
);
|
|
89896
|
-
isTypeOnly = !!((
|
|
89989
|
+
isTypeOnly = !!((_a2 = rootValueSymbol == null ? void 0 : rootValueSymbol.declarations) == null ? void 0 : _a2.every(isTypeOnlyImportOrExportDeclaration));
|
|
89897
89990
|
}
|
|
89898
89991
|
const valueSymbol = resolveEntityName(
|
|
89899
89992
|
typeName,
|
|
@@ -90605,7 +90698,7 @@ function createTypeChecker(host) {
|
|
|
90605
90698
|
return externalHelpersModule;
|
|
90606
90699
|
}
|
|
90607
90700
|
function checkGrammarModifiers(node) {
|
|
90608
|
-
var
|
|
90701
|
+
var _a2;
|
|
90609
90702
|
const quickResult = reportObviousDecoratorErrors(node) || reportObviousModifierErrors(node);
|
|
90610
90703
|
if (quickResult !== void 0) {
|
|
90611
90704
|
return quickResult;
|
|
@@ -90881,7 +90974,7 @@ function createTypeChecker(host) {
|
|
|
90881
90974
|
case 147 /* OutKeyword */: {
|
|
90882
90975
|
const inOutFlag = modifier.kind === 103 /* InKeyword */ ? 8192 /* In */ : 16384 /* Out */;
|
|
90883
90976
|
const inOutText = modifier.kind === 103 /* InKeyword */ ? "in" : "out";
|
|
90884
|
-
const parent2 = isJSDocTemplateTag(node.parent) && (getEffectiveJSDocHost(node.parent) || find((
|
|
90977
|
+
const parent2 = isJSDocTemplateTag(node.parent) && (getEffectiveJSDocHost(node.parent) || find((_a2 = getJSDocRoot(node.parent)) == null ? void 0 : _a2.tags, isJSDocTypedefTag)) || node.parent;
|
|
90885
90978
|
if (node.kind !== 168 /* TypeParameter */ || parent2 && !(isInterfaceDeclaration(parent2) || isClassLike(parent2) || isTypeAliasDeclaration(parent2) || isJSDocTypedefTag(parent2))) {
|
|
90886
90979
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText);
|
|
90887
90980
|
}
|
|
@@ -91958,11 +92051,11 @@ function createTypeChecker(host) {
|
|
|
91958
92051
|
return ambientModulesCache;
|
|
91959
92052
|
}
|
|
91960
92053
|
function checkGrammarImportClause(node) {
|
|
91961
|
-
var
|
|
92054
|
+
var _a2;
|
|
91962
92055
|
if (node.isTypeOnly && node.name && node.namedBindings) {
|
|
91963
92056
|
return grammarErrorOnNode(node, Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both);
|
|
91964
92057
|
}
|
|
91965
|
-
if (node.isTypeOnly && ((
|
|
92058
|
+
if (node.isTypeOnly && ((_a2 = node.namedBindings) == null ? void 0 : _a2.kind) === 275 /* NamedImports */) {
|
|
91966
92059
|
return checkGrammarNamedImportsOrExports(node.namedBindings);
|
|
91967
92060
|
}
|
|
91968
92061
|
return false;
|
|
@@ -124056,6 +124149,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124056
124149
|
const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
|
|
124057
124150
|
const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion3 } = createProgramOptions;
|
|
124058
124151
|
let { oldProgram } = createProgramOptions;
|
|
124152
|
+
for (const option of commandLineOptionOfCustomType) {
|
|
124153
|
+
if (hasProperty(options, option.name)) {
|
|
124154
|
+
if (typeof options[option.name] === "string") {
|
|
124155
|
+
throw new Error(`${option.name} is a string value; tsconfig JSON must be parsed with parseJsonSourceFileConfigFileContent or getParsedCommandLineOfConfigFile before passing to createProgram`);
|
|
124156
|
+
}
|
|
124157
|
+
}
|
|
124158
|
+
}
|
|
124059
124159
|
const reportInvalidIgnoreDeprecations = memoize(() => createOptionValueDiagnostic("ignoreDeprecations", Diagnostics.Invalid_value_for_ignoreDeprecations));
|
|
124060
124160
|
let processingDefaultLibFiles;
|
|
124061
124161
|
let processingOtherFiles;
|
|
@@ -126835,8 +126935,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
126835
126935
|
message = Diagnostics.File_is_library_specified_here;
|
|
126836
126936
|
break;
|
|
126837
126937
|
}
|
|
126838
|
-
const target =
|
|
126839
|
-
|
|
126938
|
+
const target = getEmitScriptTarget(options);
|
|
126939
|
+
const targetText = getNameOfScriptTarget(target);
|
|
126940
|
+
configFileNode = target === 2 /* ES2015 */ ? getOptionsSyntaxByValue("target", "es2015") ?? getOptionsSyntaxByValue("target", "es6") : targetText ? getOptionsSyntaxByValue("target", targetText) : void 0;
|
|
126840
126941
|
message = Diagnostics.File_is_default_library_for_target_specified_here;
|
|
126841
126942
|
break;
|
|
126842
126943
|
default:
|
|
@@ -142853,6 +142954,7 @@ __export(ts_refactor_exports, {
|
|
|
142853
142954
|
generateGetAccessorAndSetAccessor: () => ts_refactor_generateGetAccessorAndSetAccessor_exports,
|
|
142854
142955
|
getApplicableRefactors: () => getApplicableRefactors,
|
|
142855
142956
|
getEditsForRefactor: () => getEditsForRefactor,
|
|
142957
|
+
getIdentifierForNode: () => getIdentifierForNode,
|
|
142856
142958
|
getNewStatementsAndRemoveFromOldFile: () => getNewStatementsAndRemoveFromOldFile,
|
|
142857
142959
|
getStatementsToMove: () => getStatementsToMove,
|
|
142858
142960
|
getTopLevelDeclarationStatement: () => getTopLevelDeclarationStatement,
|
|
@@ -144581,6 +144683,15 @@ function refactorKindBeginsWith(known, requested) {
|
|
|
144581
144683
|
return true;
|
|
144582
144684
|
return known.substr(0, requested.length) === requested;
|
|
144583
144685
|
}
|
|
144686
|
+
function getIdentifierForNode(node, scope, checker, file) {
|
|
144687
|
+
return isPropertyAccessExpression(node) && !isClassLike(scope) && !checker.resolveName(
|
|
144688
|
+
node.name.text,
|
|
144689
|
+
node,
|
|
144690
|
+
111551 /* Value */,
|
|
144691
|
+
/*excludeGlobals*/
|
|
144692
|
+
false
|
|
144693
|
+
) && !isPrivateIdentifier(node.name) && !identifierToKeywordKind(node.name) ? node.name.text : getUniqueName(isClassLike(scope) ? "newProperty" : "newLocal", file);
|
|
144694
|
+
}
|
|
144584
144695
|
function addTargetFileImports(oldFile, importsToCopy, targetFileImportsFromOldFile, checker, program, importAdder) {
|
|
144585
144696
|
importsToCopy.forEach(([isValidTypeOnlyUseSite, declaration], symbol) => {
|
|
144586
144697
|
var _a;
|
|
@@ -145551,7 +145662,7 @@ function getSymbolForContextualType(node, checker) {
|
|
|
145551
145662
|
if (element) {
|
|
145552
145663
|
const contextualType = checker.getContextualTypeForObjectLiteralElement(element);
|
|
145553
145664
|
const symbol = contextualType == null ? void 0 : contextualType.getSymbol();
|
|
145554
|
-
if (symbol && !(getCheckFlags(symbol) & 6 /*
|
|
145665
|
+
if (symbol && !(getCheckFlags(symbol) & 6 /* SyntheticMember */)) {
|
|
145555
145666
|
return symbol;
|
|
145556
145667
|
}
|
|
145557
145668
|
}
|
|
@@ -147264,13 +147375,7 @@ function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParame
|
|
|
147264
147375
|
function extractConstantInScope(node, scope, { substitutions }, rangeFacts, context) {
|
|
147265
147376
|
const checker = context.program.getTypeChecker();
|
|
147266
147377
|
const file = scope.getSourceFile();
|
|
147267
|
-
const localNameText =
|
|
147268
|
-
node.name.text,
|
|
147269
|
-
node,
|
|
147270
|
-
111551 /* Value */,
|
|
147271
|
-
/*excludeGlobals*/
|
|
147272
|
-
false
|
|
147273
|
-
) && !isPrivateIdentifier(node.name) && !identifierToKeywordKind(node.name) ? node.name.text : getUniqueName(isClassLike(scope) ? "newProperty" : "newLocal", file);
|
|
147378
|
+
const localNameText = getIdentifierForNode(node, scope, checker, file);
|
|
147274
147379
|
const isJS = isInJSFile(scope);
|
|
147275
147380
|
let variableType = isJS || !checker.isContextSensitive(node) ? void 0 : checker.typeToTypeNode(checker.getContextualType(node), scope, 1 /* NoTruncation */);
|
|
147276
147381
|
let initializer = transformConstantInitializer(skipParentheses(node), substitutions);
|
|
@@ -149838,22 +149943,22 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
149838
149943
|
}
|
|
149839
149944
|
return [];
|
|
149840
149945
|
}
|
|
149841
|
-
function getCodeFixesAtPosition(fileName, start, end,
|
|
149946
|
+
function getCodeFixesAtPosition(fileName, start, end, errorCodes67, formatOptions, preferences = emptyOptions) {
|
|
149842
149947
|
synchronizeHostData();
|
|
149843
149948
|
const sourceFile = getValidSourceFile(fileName);
|
|
149844
149949
|
const span = createTextSpanFromBounds(start, end);
|
|
149845
149950
|
const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host);
|
|
149846
|
-
return flatMap(deduplicate(
|
|
149951
|
+
return flatMap(deduplicate(errorCodes67, equateValues, compareValues), (errorCode) => {
|
|
149847
149952
|
cancellationToken.throwIfCancellationRequested();
|
|
149848
149953
|
return ts_codefix_exports.getFixes({ errorCode, sourceFile, span, program, host, cancellationToken, formatContext, preferences });
|
|
149849
149954
|
});
|
|
149850
149955
|
}
|
|
149851
|
-
function getCombinedCodeFix(scope,
|
|
149956
|
+
function getCombinedCodeFix(scope, fixId54, formatOptions, preferences = emptyOptions) {
|
|
149852
149957
|
synchronizeHostData();
|
|
149853
149958
|
Debug.assert(scope.type === "file");
|
|
149854
149959
|
const sourceFile = getValidSourceFile(scope.fileName);
|
|
149855
149960
|
const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host);
|
|
149856
|
-
return ts_codefix_exports.getAllFixes({ fixId:
|
|
149961
|
+
return ts_codefix_exports.getAllFixes({ fixId: fixId54, sourceFile, program, host, cancellationToken, formatContext, preferences });
|
|
149857
149962
|
}
|
|
149858
149963
|
function organizeImports2(args, formatOptions, preferences = emptyOptions) {
|
|
149859
149964
|
synchronizeHostData();
|
|
@@ -151532,14 +151637,14 @@ function createCodeFixActionWithoutFixAll(fixName8, changes, description3) {
|
|
|
151532
151637
|
void 0
|
|
151533
151638
|
);
|
|
151534
151639
|
}
|
|
151535
|
-
function createCodeFixAction(fixName8, changes, description3,
|
|
151536
|
-
return createCodeFixActionWorker(fixName8, diagnosticToString(description3), changes,
|
|
151640
|
+
function createCodeFixAction(fixName8, changes, description3, fixId54, fixAllDescription, command) {
|
|
151641
|
+
return createCodeFixActionWorker(fixName8, diagnosticToString(description3), changes, fixId54, diagnosticToString(fixAllDescription), command);
|
|
151537
151642
|
}
|
|
151538
|
-
function createCodeFixActionMaybeFixAll(fixName8, changes, description3,
|
|
151539
|
-
return createCodeFixActionWorker(fixName8, diagnosticToString(description3), changes,
|
|
151643
|
+
function createCodeFixActionMaybeFixAll(fixName8, changes, description3, fixId54, fixAllDescription, command) {
|
|
151644
|
+
return createCodeFixActionWorker(fixName8, diagnosticToString(description3), changes, fixId54, fixAllDescription && diagnosticToString(fixAllDescription), command);
|
|
151540
151645
|
}
|
|
151541
|
-
function createCodeFixActionWorker(fixName8, description3, changes,
|
|
151542
|
-
return { fixName: fixName8, description: description3, changes, fixId:
|
|
151646
|
+
function createCodeFixActionWorker(fixName8, description3, changes, fixId54, fixAllDescription, command) {
|
|
151647
|
+
return { fixName: fixName8, description: description3, changes, fixId: fixId54, fixAllDescription, commands: command ? [command] : void 0 };
|
|
151543
151648
|
}
|
|
151544
151649
|
function registerCodeFix(reg) {
|
|
151545
151650
|
for (const error2 of reg.errorCodes) {
|
|
@@ -151547,9 +151652,9 @@ function registerCodeFix(reg) {
|
|
|
151547
151652
|
errorCodeToFixes.add(String(error2), reg);
|
|
151548
151653
|
}
|
|
151549
151654
|
if (reg.fixIds) {
|
|
151550
|
-
for (const
|
|
151551
|
-
Debug.assert(!fixIdToRegistration.has(
|
|
151552
|
-
fixIdToRegistration.set(
|
|
151655
|
+
for (const fixId54 of reg.fixIds) {
|
|
151656
|
+
Debug.assert(!fixIdToRegistration.has(fixId54));
|
|
151657
|
+
fixIdToRegistration.set(fixId54, reg);
|
|
151553
151658
|
}
|
|
151554
151659
|
}
|
|
151555
151660
|
}
|
|
@@ -151558,17 +151663,17 @@ function getSupportedErrorCodes() {
|
|
|
151558
151663
|
return errorCodeToFixesArray ?? (errorCodeToFixesArray = arrayFrom(errorCodeToFixes.keys()));
|
|
151559
151664
|
}
|
|
151560
151665
|
function removeFixIdIfFixAllUnavailable(registration, diagnostics) {
|
|
151561
|
-
const { errorCodes:
|
|
151666
|
+
const { errorCodes: errorCodes67 } = registration;
|
|
151562
151667
|
let maybeFixableDiagnostics = 0;
|
|
151563
151668
|
for (const diag2 of diagnostics) {
|
|
151564
|
-
if (contains(
|
|
151669
|
+
if (contains(errorCodes67, diag2.code))
|
|
151565
151670
|
maybeFixableDiagnostics++;
|
|
151566
151671
|
if (maybeFixableDiagnostics > 1)
|
|
151567
151672
|
break;
|
|
151568
151673
|
}
|
|
151569
151674
|
const fixAllUnavailable = maybeFixableDiagnostics < 2;
|
|
151570
|
-
return ({ fixId:
|
|
151571
|
-
return fixAllUnavailable ? action : { ...action, fixId:
|
|
151675
|
+
return ({ fixId: fixId54, fixAllDescription, ...action }) => {
|
|
151676
|
+
return fixAllUnavailable ? action : { ...action, fixId: fixId54, fixAllDescription };
|
|
151572
151677
|
};
|
|
151573
151678
|
}
|
|
151574
151679
|
function getFixes(context) {
|
|
@@ -151585,24 +151690,30 @@ function createCombinedCodeActions(changes, commands) {
|
|
|
151585
151690
|
function createFileTextChanges(fileName, textChanges2) {
|
|
151586
151691
|
return { fileName, textChanges: textChanges2 };
|
|
151587
151692
|
}
|
|
151588
|
-
function codeFixAll(context,
|
|
151693
|
+
function codeFixAll(context, errorCodes67, use) {
|
|
151589
151694
|
const commands = [];
|
|
151590
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => eachDiagnostic(context,
|
|
151695
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => eachDiagnostic(context, errorCodes67, (diag2) => use(t, diag2, commands)));
|
|
151591
151696
|
return createCombinedCodeActions(changes, commands.length === 0 ? void 0 : commands);
|
|
151592
151697
|
}
|
|
151593
|
-
function eachDiagnostic(context,
|
|
151698
|
+
function eachDiagnostic(context, errorCodes67, cb) {
|
|
151594
151699
|
for (const diag2 of getDiagnostics(context)) {
|
|
151595
|
-
if (contains(
|
|
151700
|
+
if (contains(errorCodes67, diag2.code)) {
|
|
151596
151701
|
cb(diag2);
|
|
151597
151702
|
}
|
|
151598
151703
|
}
|
|
151599
151704
|
}
|
|
151600
151705
|
function getDiagnostics({ program, sourceFile, cancellationToken }) {
|
|
151601
|
-
|
|
151706
|
+
const diagnostics = [
|
|
151602
151707
|
...program.getSemanticDiagnostics(sourceFile, cancellationToken),
|
|
151603
151708
|
...program.getSyntacticDiagnostics(sourceFile, cancellationToken),
|
|
151604
151709
|
...computeSuggestionDiagnostics(sourceFile, program, cancellationToken)
|
|
151605
151710
|
];
|
|
151711
|
+
if (getEmitDeclarations(program.getCompilerOptions())) {
|
|
151712
|
+
diagnostics.push(
|
|
151713
|
+
...program.getDeclarationDiagnostics(sourceFile, cancellationToken)
|
|
151714
|
+
);
|
|
151715
|
+
}
|
|
151716
|
+
return diagnostics;
|
|
151606
151717
|
}
|
|
151607
151718
|
|
|
151608
151719
|
// src/services/codefixes/addConvertToUnknownForNonOverlappingTypes.ts
|
|
@@ -151901,9 +152012,7 @@ function makeChange3(changeTracker, errorCode, sourceFile, checker, insertionSit
|
|
|
151901
152012
|
if (isForOfStatement(insertionSite.parent) && !insertionSite.parent.awaitModifier) {
|
|
151902
152013
|
const exprType = checker.getTypeAtLocation(insertionSite);
|
|
151903
152014
|
const asyncIter = checker.getAsyncIterableType();
|
|
151904
|
-
|
|
151905
|
-
const asyncIterInstantiation = asyncIter && checker.createTypeReference(asyncIter, [anyType, anyType, anyType]);
|
|
151906
|
-
if (asyncIterInstantiation && checker.isTypeAssignableTo(exprType, asyncIterInstantiation)) {
|
|
152015
|
+
if (asyncIter && checker.isTypeAssignableTo(exprType, asyncIter)) {
|
|
151907
152016
|
const forOf = insertionSite.parent;
|
|
151908
152017
|
changeTracker.replaceNode(sourceFile, forOf, factory.updateForOfStatement(forOf, factory.createToken(135 /* AwaitKeyword */), forOf.initializer, forOf.expression, forOf.statement));
|
|
151909
152018
|
return;
|
|
@@ -156292,10 +156401,10 @@ registerCodeFix({
|
|
|
156292
156401
|
const info = errorCodeFixIdMap[errorCode];
|
|
156293
156402
|
if (!info)
|
|
156294
156403
|
return emptyArray;
|
|
156295
|
-
const { descriptions, fixId:
|
|
156404
|
+
const { descriptions, fixId: fixId54, fixAllDescriptions } = info;
|
|
156296
156405
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => dispatchChanges(changes2, context, errorCode, span.start));
|
|
156297
156406
|
return [
|
|
156298
|
-
createCodeFixActionMaybeFixAll(fixName, changes, descriptions,
|
|
156407
|
+
createCodeFixActionMaybeFixAll(fixName, changes, descriptions, fixId54, fixAllDescriptions)
|
|
156299
156408
|
];
|
|
156300
156409
|
},
|
|
156301
156410
|
fixIds: [fixName, fixAddOverrideId, fixRemoveOverrideId],
|
|
@@ -157100,7 +157209,7 @@ registerCodeFix({
|
|
|
157100
157209
|
},
|
|
157101
157210
|
fixIds: [fixMissingMember, fixMissingFunctionDeclaration, fixMissingProperties, fixMissingAttributes],
|
|
157102
157211
|
getAllCodeActions: (context) => {
|
|
157103
|
-
const { program, fixId:
|
|
157212
|
+
const { program, fixId: fixId54 } = context;
|
|
157104
157213
|
const checker = program.getTypeChecker();
|
|
157105
157214
|
const seen = /* @__PURE__ */ new Map();
|
|
157106
157215
|
const typeDeclToMembers = /* @__PURE__ */ new Map();
|
|
@@ -157110,11 +157219,11 @@ registerCodeFix({
|
|
|
157110
157219
|
if (!info || !addToSeen(seen, getNodeId(info.parentDeclaration) + "#" + (info.kind === 3 /* ObjectLiteral */ ? info.identifier : info.token.text))) {
|
|
157111
157220
|
return;
|
|
157112
157221
|
}
|
|
157113
|
-
if (
|
|
157222
|
+
if (fixId54 === fixMissingFunctionDeclaration && (info.kind === 2 /* Function */ || info.kind === 5 /* Signature */)) {
|
|
157114
157223
|
addFunctionDeclaration(changes, context, info);
|
|
157115
|
-
} else if (
|
|
157224
|
+
} else if (fixId54 === fixMissingProperties && info.kind === 3 /* ObjectLiteral */) {
|
|
157116
157225
|
addObjectLiteralProperties(changes, context, info);
|
|
157117
|
-
} else if (
|
|
157226
|
+
} else if (fixId54 === fixMissingAttributes && info.kind === 4 /* JsxAttributes */) {
|
|
157118
157227
|
addJsxAttributes(changes, context, info);
|
|
157119
157228
|
} else {
|
|
157120
157229
|
if (info.kind === 1 /* Enum */) {
|
|
@@ -159036,21 +159145,21 @@ registerCodeFix({
|
|
|
159036
159145
|
actions2.push(fix(type, fixIdNullable, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types));
|
|
159037
159146
|
}
|
|
159038
159147
|
return actions2;
|
|
159039
|
-
function fix(type2,
|
|
159148
|
+
function fix(type2, fixId54, fixAllDescription) {
|
|
159040
159149
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange29(t, sourceFile, typeNode, type2, checker));
|
|
159041
|
-
return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)],
|
|
159150
|
+
return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)], fixId54, fixAllDescription);
|
|
159042
159151
|
}
|
|
159043
159152
|
},
|
|
159044
159153
|
fixIds: [fixIdPlain, fixIdNullable],
|
|
159045
159154
|
getAllCodeActions(context) {
|
|
159046
|
-
const { fixId:
|
|
159155
|
+
const { fixId: fixId54, program, sourceFile } = context;
|
|
159047
159156
|
const checker = program.getTypeChecker();
|
|
159048
159157
|
return codeFixAll(context, errorCodes45, (changes, err) => {
|
|
159049
159158
|
const info = getInfo15(err.file, err.start, checker);
|
|
159050
159159
|
if (!info)
|
|
159051
159160
|
return;
|
|
159052
159161
|
const { typeNode, type } = info;
|
|
159053
|
-
const fixedType = typeNode.kind === 314 /* JSDocNullableType */ &&
|
|
159162
|
+
const fixedType = typeNode.kind === 314 /* JSDocNullableType */ && fixId54 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
|
|
159054
159163
|
doChange29(changes, sourceFile, typeNode, fixedType, checker);
|
|
159055
159164
|
});
|
|
159056
159165
|
}
|
|
@@ -159145,28 +159254,909 @@ function getCallName(sourceFile, start) {
|
|
|
159145
159254
|
return void 0;
|
|
159146
159255
|
}
|
|
159147
159256
|
|
|
159148
|
-
// src/services/codefixes/
|
|
159149
|
-
var fixId36 = "
|
|
159257
|
+
// src/services/codefixes/fixMissingTypeAnnotationOnExports.ts
|
|
159258
|
+
var fixId36 = "fixMissingTypeAnnotationOnExports";
|
|
159259
|
+
var addAnnotationFix = "add-annotation";
|
|
159260
|
+
var addInlineTypeAssertion = "add-type-assertion";
|
|
159261
|
+
var extractExpression = "extract-expression";
|
|
159150
159262
|
var errorCodes47 = [
|
|
159263
|
+
Diagnostics.Function_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations.code,
|
|
159264
|
+
Diagnostics.Method_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations.code,
|
|
159265
|
+
Diagnostics.At_least_one_accessor_must_have_an_explicit_return_type_annotation_with_isolatedDeclarations.code,
|
|
159266
|
+
Diagnostics.Variable_must_have_an_explicit_type_annotation_with_isolatedDeclarations.code,
|
|
159267
|
+
Diagnostics.Parameter_must_have_an_explicit_type_annotation_with_isolatedDeclarations.code,
|
|
159268
|
+
Diagnostics.Property_must_have_an_explicit_type_annotation_with_isolatedDeclarations.code,
|
|
159269
|
+
Diagnostics.Expression_type_can_t_be_inferred_with_isolatedDeclarations.code,
|
|
159270
|
+
Diagnostics.Binding_elements_can_t_be_exported_directly_with_isolatedDeclarations.code,
|
|
159271
|
+
Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations.code,
|
|
159272
|
+
Diagnostics.Enum_member_initializers_must_be_computable_without_references_to_external_symbols_with_isolatedDeclarations.code,
|
|
159273
|
+
Diagnostics.Extends_clause_can_t_contain_an_expression_with_isolatedDeclarations.code,
|
|
159274
|
+
Diagnostics.Objects_that_contain_shorthand_properties_can_t_be_inferred_with_isolatedDeclarations.code,
|
|
159275
|
+
Diagnostics.Objects_that_contain_spread_assignments_can_t_be_inferred_with_isolatedDeclarations.code,
|
|
159276
|
+
Diagnostics.Arrays_with_spread_elements_can_t_inferred_with_isolatedDeclarations.code,
|
|
159277
|
+
Diagnostics.Default_exports_can_t_be_inferred_with_isolatedDeclarations.code,
|
|
159278
|
+
Diagnostics.Only_const_arrays_can_be_inferred_with_isolatedDeclarations.code,
|
|
159279
|
+
Diagnostics.Assigning_properties_to_functions_without_declaring_them_is_not_supported_with_isolatedDeclarations_Add_an_explicit_declaration_for_the_properties_assigned_to_this_function.code,
|
|
159280
|
+
Diagnostics.Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_it_s_type_This_is_not_supported_with_isolatedDeclarations.code,
|
|
159281
|
+
Diagnostics.Add_satisfies_and_a_type_assertion_to_this_expression_satisfies_T_as_T_to_make_the_type_explicit.code
|
|
159282
|
+
];
|
|
159283
|
+
var canHaveTypeAnnotation = /* @__PURE__ */ new Set([
|
|
159284
|
+
177 /* GetAccessor */,
|
|
159285
|
+
174 /* MethodDeclaration */,
|
|
159286
|
+
172 /* PropertyDeclaration */,
|
|
159287
|
+
262 /* FunctionDeclaration */,
|
|
159288
|
+
218 /* FunctionExpression */,
|
|
159289
|
+
219 /* ArrowFunction */,
|
|
159290
|
+
260 /* VariableDeclaration */,
|
|
159291
|
+
169 /* Parameter */,
|
|
159292
|
+
277 /* ExportAssignment */,
|
|
159293
|
+
263 /* ClassDeclaration */,
|
|
159294
|
+
206 /* ObjectBindingPattern */,
|
|
159295
|
+
207 /* ArrayBindingPattern */
|
|
159296
|
+
]);
|
|
159297
|
+
var declarationEmitNodeBuilderFlags2 = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */ | 1073741824 /* WriteComputedProps */;
|
|
159298
|
+
registerCodeFix({
|
|
159299
|
+
errorCodes: errorCodes47,
|
|
159300
|
+
fixIds: [fixId36],
|
|
159301
|
+
getCodeActions(context) {
|
|
159302
|
+
const fixes = [];
|
|
159303
|
+
addCodeAction(addAnnotationFix, fixes, context, 0 /* Full */, (f) => f.addTypeAnnotation(context.span));
|
|
159304
|
+
addCodeAction(addAnnotationFix, fixes, context, 1 /* Relative */, (f) => f.addTypeAnnotation(context.span));
|
|
159305
|
+
addCodeAction(addAnnotationFix, fixes, context, 2 /* Widened */, (f) => f.addTypeAnnotation(context.span));
|
|
159306
|
+
addCodeAction(addInlineTypeAssertion, fixes, context, 0 /* Full */, (f) => f.addInlineAssertion(context.span));
|
|
159307
|
+
addCodeAction(addInlineTypeAssertion, fixes, context, 1 /* Relative */, (f) => f.addInlineAssertion(context.span));
|
|
159308
|
+
addCodeAction(addAnnotationFix, fixes, context, 2 /* Widened */, (f) => f.addInlineAssertion(context.span));
|
|
159309
|
+
addCodeAction(extractExpression, fixes, context, 0 /* Full */, (f) => f.extractAsVariable(context.span));
|
|
159310
|
+
return fixes;
|
|
159311
|
+
},
|
|
159312
|
+
getAllCodeActions: (context) => {
|
|
159313
|
+
const changes = withContext(context, 0 /* Full */, (f) => {
|
|
159314
|
+
eachDiagnostic(context, errorCodes47, (diag2) => {
|
|
159315
|
+
f.addTypeAnnotation(diag2);
|
|
159316
|
+
});
|
|
159317
|
+
});
|
|
159318
|
+
return createCombinedCodeActions(changes.textChanges);
|
|
159319
|
+
}
|
|
159320
|
+
});
|
|
159321
|
+
function addCodeAction(fixName8, fixes, context, typePrintMode, cb) {
|
|
159322
|
+
const changes = withContext(context, typePrintMode, cb);
|
|
159323
|
+
if (changes.result && changes.textChanges.length) {
|
|
159324
|
+
fixes.push(createCodeFixAction(
|
|
159325
|
+
fixName8,
|
|
159326
|
+
changes.textChanges,
|
|
159327
|
+
changes.result,
|
|
159328
|
+
fixId36,
|
|
159329
|
+
Diagnostics.Add_all_missing_type_annotations
|
|
159330
|
+
));
|
|
159331
|
+
}
|
|
159332
|
+
}
|
|
159333
|
+
function withContext(context, typePrintMode, cb) {
|
|
159334
|
+
const emptyInferenceResult = { typeNode: void 0, mutatedTarget: false };
|
|
159335
|
+
const changeTracker = ts_textChanges_exports.ChangeTracker.fromContext(context);
|
|
159336
|
+
const sourceFile = context.sourceFile;
|
|
159337
|
+
const program = context.program;
|
|
159338
|
+
const typeChecker = program.getTypeChecker();
|
|
159339
|
+
const emitResolver = typeChecker.getEmitResolver();
|
|
159340
|
+
const scriptTarget = getEmitScriptTarget(program.getCompilerOptions());
|
|
159341
|
+
const importAdder = createImportAdder(context.sourceFile, context.program, context.preferences, context.host);
|
|
159342
|
+
const fixedNodes = /* @__PURE__ */ new Set();
|
|
159343
|
+
const expandoPropertiesAdded = /* @__PURE__ */ new Set();
|
|
159344
|
+
const typePrinter = createPrinter({
|
|
159345
|
+
preserveSourceNewlines: false
|
|
159346
|
+
});
|
|
159347
|
+
const result = cb({ addTypeAnnotation, addInlineAssertion, extractAsVariable });
|
|
159348
|
+
importAdder.writeFixes(changeTracker);
|
|
159349
|
+
return {
|
|
159350
|
+
result,
|
|
159351
|
+
textChanges: changeTracker.getChanges()
|
|
159352
|
+
};
|
|
159353
|
+
function addTypeAnnotation(span) {
|
|
159354
|
+
const nodeWithDiag = getTokenAtPosition(sourceFile, span.start);
|
|
159355
|
+
const expandoFunction = findExpandoFunction(nodeWithDiag);
|
|
159356
|
+
if (expandoFunction) {
|
|
159357
|
+
if (isFunctionDeclaration(expandoFunction)) {
|
|
159358
|
+
return createNamespaceForExpandoProperties(expandoFunction);
|
|
159359
|
+
}
|
|
159360
|
+
return fixIsolatedDeclarationError(expandoFunction);
|
|
159361
|
+
}
|
|
159362
|
+
const nodeMissingType = findAncestorWithMissingType(nodeWithDiag);
|
|
159363
|
+
if (nodeMissingType) {
|
|
159364
|
+
return fixIsolatedDeclarationError(nodeMissingType);
|
|
159365
|
+
}
|
|
159366
|
+
return void 0;
|
|
159367
|
+
}
|
|
159368
|
+
function createNamespaceForExpandoProperties(expandoFunc) {
|
|
159369
|
+
var _a;
|
|
159370
|
+
if (expandoPropertiesAdded == null ? void 0 : expandoPropertiesAdded.has(expandoFunc))
|
|
159371
|
+
return void 0;
|
|
159372
|
+
expandoPropertiesAdded == null ? void 0 : expandoPropertiesAdded.add(expandoFunc);
|
|
159373
|
+
const type = typeChecker.getTypeAtLocation(expandoFunc);
|
|
159374
|
+
const elements = typeChecker.getPropertiesOfType(type);
|
|
159375
|
+
if (!expandoFunc.name || elements.length === 0)
|
|
159376
|
+
return void 0;
|
|
159377
|
+
const newProperties = [];
|
|
159378
|
+
for (const symbol of elements) {
|
|
159379
|
+
if (!isIdentifierText(symbol.name, getEmitScriptTarget(program.getCompilerOptions())))
|
|
159380
|
+
continue;
|
|
159381
|
+
if (symbol.valueDeclaration && isVariableDeclaration(symbol.valueDeclaration))
|
|
159382
|
+
continue;
|
|
159383
|
+
newProperties.push(factory.createVariableStatement(
|
|
159384
|
+
[factory.createModifier(95 /* ExportKeyword */)],
|
|
159385
|
+
factory.createVariableDeclarationList(
|
|
159386
|
+
[factory.createVariableDeclaration(
|
|
159387
|
+
symbol.name,
|
|
159388
|
+
/*exclamationToken*/
|
|
159389
|
+
void 0,
|
|
159390
|
+
typeToTypeNode2(typeChecker.getTypeOfSymbol(symbol), expandoFunc),
|
|
159391
|
+
/*initializer*/
|
|
159392
|
+
void 0
|
|
159393
|
+
)]
|
|
159394
|
+
)
|
|
159395
|
+
));
|
|
159396
|
+
}
|
|
159397
|
+
if (newProperties.length === 0)
|
|
159398
|
+
return void 0;
|
|
159399
|
+
const modifiers = [];
|
|
159400
|
+
if ((_a = expandoFunc.modifiers) == null ? void 0 : _a.some((modifier) => modifier.kind === 95 /* ExportKeyword */)) {
|
|
159401
|
+
modifiers.push(factory.createModifier(95 /* ExportKeyword */));
|
|
159402
|
+
}
|
|
159403
|
+
modifiers.push(factory.createModifier(138 /* DeclareKeyword */));
|
|
159404
|
+
const namespace = factory.createModuleDeclaration(
|
|
159405
|
+
modifiers,
|
|
159406
|
+
expandoFunc.name,
|
|
159407
|
+
factory.createModuleBlock(newProperties),
|
|
159408
|
+
/*flags*/
|
|
159409
|
+
32 /* Namespace */ | 128 /* ExportContext */ | 33554432 /* Ambient */ | 101441536 /* ContextFlags */
|
|
159410
|
+
);
|
|
159411
|
+
changeTracker.insertNodeAfter(sourceFile, expandoFunc, namespace);
|
|
159412
|
+
return [Diagnostics.Annotate_types_of_properties_expando_function_in_a_namespace];
|
|
159413
|
+
}
|
|
159414
|
+
function needsParenthesizedExpressionForAssertion(node) {
|
|
159415
|
+
return !isEntityNameExpression(node) && !isCallExpression(node) && !isObjectLiteralExpression(node) && !isArrayLiteralExpression(node);
|
|
159416
|
+
}
|
|
159417
|
+
function createAsExpression(node, type) {
|
|
159418
|
+
if (needsParenthesizedExpressionForAssertion(node)) {
|
|
159419
|
+
node = factory.createParenthesizedExpression(node);
|
|
159420
|
+
}
|
|
159421
|
+
return factory.createAsExpression(node, type);
|
|
159422
|
+
}
|
|
159423
|
+
function createSatisfiesAsExpression(node, type) {
|
|
159424
|
+
if (needsParenthesizedExpressionForAssertion(node)) {
|
|
159425
|
+
node = factory.createParenthesizedExpression(node);
|
|
159426
|
+
}
|
|
159427
|
+
return factory.createAsExpression(factory.createSatisfiesExpression(node, getSynthesizedDeepClone(type)), type);
|
|
159428
|
+
}
|
|
159429
|
+
function addInlineAssertion(span) {
|
|
159430
|
+
const nodeWithDiag = getTokenAtPosition(sourceFile, span.start);
|
|
159431
|
+
const expandoFunction = findExpandoFunction(nodeWithDiag);
|
|
159432
|
+
if (expandoFunction)
|
|
159433
|
+
return;
|
|
159434
|
+
const targetNode = findBestFittingNode(nodeWithDiag, span);
|
|
159435
|
+
if (!targetNode || isValueSignatureDeclaration(targetNode) || isValueSignatureDeclaration(targetNode.parent))
|
|
159436
|
+
return;
|
|
159437
|
+
const isExpressionTarget = isExpression(targetNode);
|
|
159438
|
+
const isShorthandPropertyAssignmentTarget = isShorthandPropertyAssignment(targetNode);
|
|
159439
|
+
if (!isShorthandPropertyAssignmentTarget && isDeclaration(targetNode)) {
|
|
159440
|
+
return void 0;
|
|
159441
|
+
}
|
|
159442
|
+
if (findAncestor(targetNode, isBindingPattern)) {
|
|
159443
|
+
return void 0;
|
|
159444
|
+
}
|
|
159445
|
+
if (findAncestor(targetNode, isEnumMember)) {
|
|
159446
|
+
return void 0;
|
|
159447
|
+
}
|
|
159448
|
+
if (isExpressionTarget && findAncestor(targetNode, isHeritageClause)) {
|
|
159449
|
+
return void 0;
|
|
159450
|
+
}
|
|
159451
|
+
if (isSpreadElement(targetNode)) {
|
|
159452
|
+
return void 0;
|
|
159453
|
+
}
|
|
159454
|
+
const variableDeclaration = findAncestor(targetNode, isVariableDeclaration);
|
|
159455
|
+
const type = variableDeclaration && typeChecker.getTypeAtLocation(variableDeclaration);
|
|
159456
|
+
if (type && type.flags & 8192 /* UniqueESSymbol */) {
|
|
159457
|
+
return void 0;
|
|
159458
|
+
}
|
|
159459
|
+
if (!(isExpressionTarget || isShorthandPropertyAssignmentTarget))
|
|
159460
|
+
return void 0;
|
|
159461
|
+
const { typeNode, mutatedTarget } = inferType(targetNode, type);
|
|
159462
|
+
if (!typeNode || mutatedTarget)
|
|
159463
|
+
return void 0;
|
|
159464
|
+
if (isShorthandPropertyAssignmentTarget) {
|
|
159465
|
+
changeTracker.insertNodeAt(
|
|
159466
|
+
sourceFile,
|
|
159467
|
+
targetNode.end,
|
|
159468
|
+
createAsExpression(
|
|
159469
|
+
getSynthesizedDeepClone(targetNode.name),
|
|
159470
|
+
typeNode
|
|
159471
|
+
),
|
|
159472
|
+
{
|
|
159473
|
+
prefix: ": "
|
|
159474
|
+
}
|
|
159475
|
+
);
|
|
159476
|
+
} else if (isExpressionTarget) {
|
|
159477
|
+
changeTracker.replaceNode(
|
|
159478
|
+
sourceFile,
|
|
159479
|
+
targetNode,
|
|
159480
|
+
createSatisfiesAsExpression(
|
|
159481
|
+
getSynthesizedDeepClone(targetNode),
|
|
159482
|
+
typeNode
|
|
159483
|
+
)
|
|
159484
|
+
);
|
|
159485
|
+
} else {
|
|
159486
|
+
Debug.assertNever(targetNode);
|
|
159487
|
+
}
|
|
159488
|
+
return [Diagnostics.Add_satisfies_and_an_inline_type_assertion_with_0, typeToStringForDiag(typeNode)];
|
|
159489
|
+
}
|
|
159490
|
+
function extractAsVariable(span) {
|
|
159491
|
+
const nodeWithDiag = getTokenAtPosition(sourceFile, span.start);
|
|
159492
|
+
const targetNode = findBestFittingNode(nodeWithDiag, span);
|
|
159493
|
+
if (!targetNode || isValueSignatureDeclaration(targetNode) || isValueSignatureDeclaration(targetNode.parent))
|
|
159494
|
+
return;
|
|
159495
|
+
const isExpressionTarget = isExpression(targetNode);
|
|
159496
|
+
if (!isExpressionTarget)
|
|
159497
|
+
return;
|
|
159498
|
+
if (isArrayLiteralExpression(targetNode)) {
|
|
159499
|
+
changeTracker.replaceNode(
|
|
159500
|
+
sourceFile,
|
|
159501
|
+
targetNode,
|
|
159502
|
+
createAsExpression(targetNode, factory.createTypeReferenceNode("const"))
|
|
159503
|
+
);
|
|
159504
|
+
return [Diagnostics.Mark_array_literal_as_const];
|
|
159505
|
+
}
|
|
159506
|
+
const parentPropertyAssignment = findAncestor(targetNode, isPropertyAssignment);
|
|
159507
|
+
if (parentPropertyAssignment) {
|
|
159508
|
+
if (parentPropertyAssignment === targetNode.parent && isEntityNameExpression(targetNode))
|
|
159509
|
+
return;
|
|
159510
|
+
const tempName = factory.createUniqueName(
|
|
159511
|
+
getIdentifierForNode(targetNode, sourceFile, typeChecker, sourceFile),
|
|
159512
|
+
16 /* Optimistic */
|
|
159513
|
+
);
|
|
159514
|
+
let replacementTarget = targetNode;
|
|
159515
|
+
let initializationNode = targetNode;
|
|
159516
|
+
if (isSpreadElement(replacementTarget)) {
|
|
159517
|
+
replacementTarget = walkUpParenthesizedExpressions(replacementTarget.parent);
|
|
159518
|
+
if (isConstAssertion2(replacementTarget.parent)) {
|
|
159519
|
+
initializationNode = replacementTarget = replacementTarget.parent;
|
|
159520
|
+
} else {
|
|
159521
|
+
initializationNode = createAsExpression(
|
|
159522
|
+
replacementTarget,
|
|
159523
|
+
factory.createTypeReferenceNode("const")
|
|
159524
|
+
);
|
|
159525
|
+
}
|
|
159526
|
+
}
|
|
159527
|
+
if (isEntityNameExpression(replacementTarget))
|
|
159528
|
+
return void 0;
|
|
159529
|
+
const variableDefinition = factory.createVariableStatement(
|
|
159530
|
+
/*modifiers*/
|
|
159531
|
+
void 0,
|
|
159532
|
+
factory.createVariableDeclarationList([
|
|
159533
|
+
factory.createVariableDeclaration(
|
|
159534
|
+
tempName,
|
|
159535
|
+
/*exclamationToken*/
|
|
159536
|
+
void 0,
|
|
159537
|
+
/*type*/
|
|
159538
|
+
void 0,
|
|
159539
|
+
initializationNode
|
|
159540
|
+
)
|
|
159541
|
+
], 2 /* Const */)
|
|
159542
|
+
);
|
|
159543
|
+
const statement = findAncestor(targetNode, isStatement);
|
|
159544
|
+
changeTracker.insertNodeBefore(sourceFile, statement, variableDefinition);
|
|
159545
|
+
changeTracker.replaceNode(
|
|
159546
|
+
sourceFile,
|
|
159547
|
+
replacementTarget,
|
|
159548
|
+
factory.createAsExpression(
|
|
159549
|
+
factory.cloneNode(tempName),
|
|
159550
|
+
factory.createTypeQueryNode(
|
|
159551
|
+
factory.cloneNode(tempName)
|
|
159552
|
+
)
|
|
159553
|
+
)
|
|
159554
|
+
);
|
|
159555
|
+
return [Diagnostics.Extract_to_variable_and_replace_with_0_as_typeof_0, typeToStringForDiag(tempName)];
|
|
159556
|
+
}
|
|
159557
|
+
}
|
|
159558
|
+
function findExpandoFunction(node) {
|
|
159559
|
+
const expandoDeclaration = findAncestor(node, (n) => isStatement(n) ? "quit" : isExpandoPropertyDeclaration(n));
|
|
159560
|
+
if (expandoDeclaration && isExpandoPropertyDeclaration(expandoDeclaration)) {
|
|
159561
|
+
let assignmentTarget = expandoDeclaration;
|
|
159562
|
+
if (isBinaryExpression(assignmentTarget)) {
|
|
159563
|
+
assignmentTarget = assignmentTarget.left;
|
|
159564
|
+
if (!isExpandoPropertyDeclaration(assignmentTarget))
|
|
159565
|
+
return void 0;
|
|
159566
|
+
}
|
|
159567
|
+
const targetType = typeChecker.getTypeAtLocation(assignmentTarget.expression);
|
|
159568
|
+
if (!targetType)
|
|
159569
|
+
return;
|
|
159570
|
+
const properties = typeChecker.getPropertiesOfType(targetType);
|
|
159571
|
+
if (some(properties, (p) => p.valueDeclaration === expandoDeclaration || p.valueDeclaration === expandoDeclaration.parent)) {
|
|
159572
|
+
const fn = targetType.symbol.valueDeclaration;
|
|
159573
|
+
if (fn) {
|
|
159574
|
+
if (isFunctionExpressionOrArrowFunction(fn) && isVariableDeclaration(fn.parent)) {
|
|
159575
|
+
return fn.parent;
|
|
159576
|
+
}
|
|
159577
|
+
if (isFunctionDeclaration(fn)) {
|
|
159578
|
+
return fn;
|
|
159579
|
+
}
|
|
159580
|
+
}
|
|
159581
|
+
}
|
|
159582
|
+
}
|
|
159583
|
+
return void 0;
|
|
159584
|
+
}
|
|
159585
|
+
function fixIsolatedDeclarationError(node) {
|
|
159586
|
+
if (fixedNodes == null ? void 0 : fixedNodes.has(node))
|
|
159587
|
+
return void 0;
|
|
159588
|
+
fixedNodes == null ? void 0 : fixedNodes.add(node);
|
|
159589
|
+
switch (node.kind) {
|
|
159590
|
+
case 169 /* Parameter */:
|
|
159591
|
+
case 172 /* PropertyDeclaration */:
|
|
159592
|
+
case 260 /* VariableDeclaration */:
|
|
159593
|
+
return addTypeToVariableLike(node);
|
|
159594
|
+
case 219 /* ArrowFunction */:
|
|
159595
|
+
case 218 /* FunctionExpression */:
|
|
159596
|
+
case 262 /* FunctionDeclaration */:
|
|
159597
|
+
case 174 /* MethodDeclaration */:
|
|
159598
|
+
case 177 /* GetAccessor */:
|
|
159599
|
+
return addTypeToSignatureDeclaration(node, sourceFile);
|
|
159600
|
+
case 277 /* ExportAssignment */:
|
|
159601
|
+
return transformExportAssignment(node);
|
|
159602
|
+
case 263 /* ClassDeclaration */:
|
|
159603
|
+
return transformExtendsClauseWithExpression(node);
|
|
159604
|
+
case 206 /* ObjectBindingPattern */:
|
|
159605
|
+
case 207 /* ArrayBindingPattern */:
|
|
159606
|
+
return transformDestructuringPatterns(node);
|
|
159607
|
+
default:
|
|
159608
|
+
throw new Error(`Cannot find a fix for the given node ${node.kind}`);
|
|
159609
|
+
}
|
|
159610
|
+
}
|
|
159611
|
+
function addTypeToSignatureDeclaration(func, sourceFile2) {
|
|
159612
|
+
if (func.type) {
|
|
159613
|
+
return;
|
|
159614
|
+
}
|
|
159615
|
+
const { typeNode } = inferType(func);
|
|
159616
|
+
if (typeNode) {
|
|
159617
|
+
changeTracker.tryInsertTypeAnnotation(
|
|
159618
|
+
sourceFile2,
|
|
159619
|
+
func,
|
|
159620
|
+
typeNode
|
|
159621
|
+
);
|
|
159622
|
+
return [Diagnostics.Add_return_type_0, typeToStringForDiag(typeNode)];
|
|
159623
|
+
}
|
|
159624
|
+
}
|
|
159625
|
+
function transformExportAssignment(defaultExport) {
|
|
159626
|
+
if (defaultExport.isExportEquals) {
|
|
159627
|
+
return;
|
|
159628
|
+
}
|
|
159629
|
+
const { typeNode } = inferType(defaultExport.expression);
|
|
159630
|
+
if (!typeNode)
|
|
159631
|
+
return void 0;
|
|
159632
|
+
const defaultIdentifier = factory.createUniqueName("_default");
|
|
159633
|
+
changeTracker.replaceNodeWithNodes(sourceFile, defaultExport, [
|
|
159634
|
+
factory.createVariableStatement(
|
|
159635
|
+
/*modifiers*/
|
|
159636
|
+
void 0,
|
|
159637
|
+
factory.createVariableDeclarationList(
|
|
159638
|
+
[factory.createVariableDeclaration(
|
|
159639
|
+
defaultIdentifier,
|
|
159640
|
+
/*exclamationToken*/
|
|
159641
|
+
void 0,
|
|
159642
|
+
typeNode,
|
|
159643
|
+
defaultExport.expression
|
|
159644
|
+
)],
|
|
159645
|
+
2 /* Const */
|
|
159646
|
+
)
|
|
159647
|
+
),
|
|
159648
|
+
factory.updateExportAssignment(defaultExport, defaultExport == null ? void 0 : defaultExport.modifiers, defaultIdentifier)
|
|
159649
|
+
]);
|
|
159650
|
+
return [
|
|
159651
|
+
Diagnostics.Extract_default_export_to_variable
|
|
159652
|
+
];
|
|
159653
|
+
}
|
|
159654
|
+
function transformExtendsClauseWithExpression(classDecl) {
|
|
159655
|
+
var _a, _b;
|
|
159656
|
+
const extendsClause = (_a = classDecl.heritageClauses) == null ? void 0 : _a.find((p) => p.token === 96 /* ExtendsKeyword */);
|
|
159657
|
+
const heritageExpression = extendsClause == null ? void 0 : extendsClause.types[0];
|
|
159658
|
+
if (!heritageExpression) {
|
|
159659
|
+
return void 0;
|
|
159660
|
+
}
|
|
159661
|
+
const { typeNode: heritageTypeNode } = inferType(heritageExpression.expression);
|
|
159662
|
+
if (!heritageTypeNode) {
|
|
159663
|
+
return void 0;
|
|
159664
|
+
}
|
|
159665
|
+
const baseClassName = factory.createUniqueName(
|
|
159666
|
+
classDecl.name ? classDecl.name.text + "Base" : "Anonymous",
|
|
159667
|
+
16 /* Optimistic */
|
|
159668
|
+
);
|
|
159669
|
+
const heritageVariable = factory.createVariableStatement(
|
|
159670
|
+
/*modifiers*/
|
|
159671
|
+
void 0,
|
|
159672
|
+
factory.createVariableDeclarationList(
|
|
159673
|
+
[factory.createVariableDeclaration(
|
|
159674
|
+
baseClassName,
|
|
159675
|
+
/*exclamationToken*/
|
|
159676
|
+
void 0,
|
|
159677
|
+
heritageTypeNode,
|
|
159678
|
+
heritageExpression.expression
|
|
159679
|
+
)],
|
|
159680
|
+
2 /* Const */
|
|
159681
|
+
)
|
|
159682
|
+
);
|
|
159683
|
+
changeTracker.insertNodeBefore(sourceFile, classDecl, heritageVariable);
|
|
159684
|
+
const trailingComments = getTrailingCommentRanges(sourceFile.text, heritageExpression.end);
|
|
159685
|
+
const realEnd = ((_b = trailingComments == null ? void 0 : trailingComments[trailingComments.length - 1]) == null ? void 0 : _b.end) ?? heritageExpression.end;
|
|
159686
|
+
changeTracker.replaceRange(
|
|
159687
|
+
sourceFile,
|
|
159688
|
+
{
|
|
159689
|
+
pos: heritageExpression.getFullStart(),
|
|
159690
|
+
end: realEnd
|
|
159691
|
+
},
|
|
159692
|
+
baseClassName,
|
|
159693
|
+
{
|
|
159694
|
+
prefix: " "
|
|
159695
|
+
}
|
|
159696
|
+
);
|
|
159697
|
+
return [Diagnostics.Extract_base_class_to_variable];
|
|
159698
|
+
}
|
|
159699
|
+
let ExpressionType;
|
|
159700
|
+
((ExpressionType2) => {
|
|
159701
|
+
ExpressionType2[ExpressionType2["Text"] = 0] = "Text";
|
|
159702
|
+
ExpressionType2[ExpressionType2["Computed"] = 1] = "Computed";
|
|
159703
|
+
ExpressionType2[ExpressionType2["ArrayAccess"] = 2] = "ArrayAccess";
|
|
159704
|
+
ExpressionType2[ExpressionType2["Identifier"] = 3] = "Identifier";
|
|
159705
|
+
})(ExpressionType || (ExpressionType = {}));
|
|
159706
|
+
function transformDestructuringPatterns(bindingPattern) {
|
|
159707
|
+
var _a;
|
|
159708
|
+
const enclosingVariableDeclaration = bindingPattern.parent;
|
|
159709
|
+
const enclosingVarStmt = bindingPattern.parent.parent.parent;
|
|
159710
|
+
if (!enclosingVariableDeclaration.initializer)
|
|
159711
|
+
return void 0;
|
|
159712
|
+
let baseExpr;
|
|
159713
|
+
const newNodes = [];
|
|
159714
|
+
if (!isIdentifier(enclosingVariableDeclaration.initializer)) {
|
|
159715
|
+
const tempHolderForReturn = factory.createUniqueName("dest", 16 /* Optimistic */);
|
|
159716
|
+
baseExpr = { expression: { kind: 3 /* Identifier */, identifier: tempHolderForReturn } };
|
|
159717
|
+
newNodes.push(factory.createVariableStatement(
|
|
159718
|
+
/*modifiers*/
|
|
159719
|
+
void 0,
|
|
159720
|
+
factory.createVariableDeclarationList(
|
|
159721
|
+
[factory.createVariableDeclaration(
|
|
159722
|
+
tempHolderForReturn,
|
|
159723
|
+
/*exclamationToken*/
|
|
159724
|
+
void 0,
|
|
159725
|
+
/*type*/
|
|
159726
|
+
void 0,
|
|
159727
|
+
enclosingVariableDeclaration.initializer
|
|
159728
|
+
)],
|
|
159729
|
+
2 /* Const */
|
|
159730
|
+
)
|
|
159731
|
+
));
|
|
159732
|
+
} else {
|
|
159733
|
+
baseExpr = { expression: { kind: 3 /* Identifier */, identifier: enclosingVariableDeclaration.initializer } };
|
|
159734
|
+
}
|
|
159735
|
+
const bindingElements = [];
|
|
159736
|
+
if (isArrayBindingPattern(bindingPattern)) {
|
|
159737
|
+
addArrayBindingPatterns(bindingPattern, bindingElements, baseExpr);
|
|
159738
|
+
} else {
|
|
159739
|
+
addObjectBindingPatterns(bindingPattern, bindingElements, baseExpr);
|
|
159740
|
+
}
|
|
159741
|
+
const expressionToVar = /* @__PURE__ */ new Map();
|
|
159742
|
+
for (const bindingElement of bindingElements) {
|
|
159743
|
+
if (bindingElement.element.propertyName && isComputedPropertyName(bindingElement.element.propertyName)) {
|
|
159744
|
+
const computedExpression = bindingElement.element.propertyName.expression;
|
|
159745
|
+
const identifierForComputedProperty = factory.getGeneratedNameForNode(computedExpression);
|
|
159746
|
+
const variableDecl = factory.createVariableDeclaration(
|
|
159747
|
+
identifierForComputedProperty,
|
|
159748
|
+
/*exclamationToken*/
|
|
159749
|
+
void 0,
|
|
159750
|
+
/*type*/
|
|
159751
|
+
void 0,
|
|
159752
|
+
computedExpression
|
|
159753
|
+
);
|
|
159754
|
+
const variableList = factory.createVariableDeclarationList([variableDecl], 2 /* Const */);
|
|
159755
|
+
const variableStatement = factory.createVariableStatement(
|
|
159756
|
+
/*modifiers*/
|
|
159757
|
+
void 0,
|
|
159758
|
+
variableList
|
|
159759
|
+
);
|
|
159760
|
+
newNodes.push(variableStatement);
|
|
159761
|
+
expressionToVar.set(computedExpression, identifierForComputedProperty);
|
|
159762
|
+
}
|
|
159763
|
+
const name = bindingElement.element.name;
|
|
159764
|
+
if (isArrayBindingPattern(name)) {
|
|
159765
|
+
addArrayBindingPatterns(name, bindingElements, bindingElement);
|
|
159766
|
+
} else if (isObjectBindingPattern(name)) {
|
|
159767
|
+
addObjectBindingPatterns(name, bindingElements, bindingElement);
|
|
159768
|
+
} else {
|
|
159769
|
+
const { typeNode } = inferType(name);
|
|
159770
|
+
let variableInitializer = createChainedExpression(bindingElement, expressionToVar);
|
|
159771
|
+
if (bindingElement.element.initializer) {
|
|
159772
|
+
const propertyName = (_a = bindingElement.element) == null ? void 0 : _a.propertyName;
|
|
159773
|
+
const tempName = factory.createUniqueName(
|
|
159774
|
+
propertyName && isIdentifier(propertyName) ? propertyName.text : "temp",
|
|
159775
|
+
16 /* Optimistic */
|
|
159776
|
+
);
|
|
159777
|
+
newNodes.push(factory.createVariableStatement(
|
|
159778
|
+
/*modifiers*/
|
|
159779
|
+
void 0,
|
|
159780
|
+
factory.createVariableDeclarationList(
|
|
159781
|
+
[factory.createVariableDeclaration(
|
|
159782
|
+
tempName,
|
|
159783
|
+
/*exclamationToken*/
|
|
159784
|
+
void 0,
|
|
159785
|
+
/*type*/
|
|
159786
|
+
void 0,
|
|
159787
|
+
variableInitializer
|
|
159788
|
+
)],
|
|
159789
|
+
2 /* Const */
|
|
159790
|
+
)
|
|
159791
|
+
));
|
|
159792
|
+
variableInitializer = factory.createConditionalExpression(
|
|
159793
|
+
factory.createBinaryExpression(
|
|
159794
|
+
tempName,
|
|
159795
|
+
factory.createToken(37 /* EqualsEqualsEqualsToken */),
|
|
159796
|
+
factory.createIdentifier("undefined")
|
|
159797
|
+
),
|
|
159798
|
+
factory.createToken(58 /* QuestionToken */),
|
|
159799
|
+
bindingElement.element.initializer,
|
|
159800
|
+
factory.createToken(59 /* ColonToken */),
|
|
159801
|
+
variableInitializer
|
|
159802
|
+
);
|
|
159803
|
+
}
|
|
159804
|
+
const exportModifier = hasSyntacticModifier(enclosingVarStmt, 32 /* Export */) ? [factory.createToken(95 /* ExportKeyword */)] : void 0;
|
|
159805
|
+
newNodes.push(factory.createVariableStatement(
|
|
159806
|
+
exportModifier,
|
|
159807
|
+
factory.createVariableDeclarationList(
|
|
159808
|
+
[factory.createVariableDeclaration(
|
|
159809
|
+
name,
|
|
159810
|
+
/*exclamationToken*/
|
|
159811
|
+
void 0,
|
|
159812
|
+
typeNode,
|
|
159813
|
+
variableInitializer
|
|
159814
|
+
)],
|
|
159815
|
+
2 /* Const */
|
|
159816
|
+
)
|
|
159817
|
+
));
|
|
159818
|
+
}
|
|
159819
|
+
}
|
|
159820
|
+
if (enclosingVarStmt.declarationList.declarations.length > 1) {
|
|
159821
|
+
newNodes.push(factory.updateVariableStatement(
|
|
159822
|
+
enclosingVarStmt,
|
|
159823
|
+
enclosingVarStmt.modifiers,
|
|
159824
|
+
factory.updateVariableDeclarationList(
|
|
159825
|
+
enclosingVarStmt.declarationList,
|
|
159826
|
+
enclosingVarStmt.declarationList.declarations.filter((node) => node !== bindingPattern.parent)
|
|
159827
|
+
)
|
|
159828
|
+
));
|
|
159829
|
+
}
|
|
159830
|
+
changeTracker.replaceNodeWithNodes(sourceFile, enclosingVarStmt, newNodes);
|
|
159831
|
+
return [
|
|
159832
|
+
Diagnostics.Extract_binding_expressions_to_variable
|
|
159833
|
+
];
|
|
159834
|
+
}
|
|
159835
|
+
function addArrayBindingPatterns(bindingPattern, bindingElements, parent2) {
|
|
159836
|
+
for (let i = 0; i < bindingPattern.elements.length; ++i) {
|
|
159837
|
+
const element = bindingPattern.elements[i];
|
|
159838
|
+
if (isOmittedExpression(element)) {
|
|
159839
|
+
continue;
|
|
159840
|
+
}
|
|
159841
|
+
bindingElements.push({
|
|
159842
|
+
element,
|
|
159843
|
+
parent: parent2,
|
|
159844
|
+
expression: { kind: 2 /* ArrayAccess */, arrayIndex: i }
|
|
159845
|
+
});
|
|
159846
|
+
}
|
|
159847
|
+
}
|
|
159848
|
+
function addObjectBindingPatterns(bindingPattern, bindingElements, parent2) {
|
|
159849
|
+
for (const bindingElement of bindingPattern.elements) {
|
|
159850
|
+
let name;
|
|
159851
|
+
if (bindingElement.propertyName) {
|
|
159852
|
+
if (isComputedPropertyName(bindingElement.propertyName)) {
|
|
159853
|
+
bindingElements.push({
|
|
159854
|
+
element: bindingElement,
|
|
159855
|
+
parent: parent2,
|
|
159856
|
+
expression: { kind: 1 /* Computed */, computed: bindingElement.propertyName.expression }
|
|
159857
|
+
});
|
|
159858
|
+
continue;
|
|
159859
|
+
} else {
|
|
159860
|
+
name = bindingElement.propertyName.text;
|
|
159861
|
+
}
|
|
159862
|
+
} else {
|
|
159863
|
+
name = bindingElement.name.text;
|
|
159864
|
+
}
|
|
159865
|
+
bindingElements.push({
|
|
159866
|
+
element: bindingElement,
|
|
159867
|
+
parent: parent2,
|
|
159868
|
+
expression: { kind: 0 /* Text */, text: name }
|
|
159869
|
+
});
|
|
159870
|
+
}
|
|
159871
|
+
}
|
|
159872
|
+
function createChainedExpression(expression, expressionToVar) {
|
|
159873
|
+
const reverseTraverse = [expression];
|
|
159874
|
+
while (expression.parent) {
|
|
159875
|
+
expression = expression.parent;
|
|
159876
|
+
reverseTraverse.push(expression);
|
|
159877
|
+
}
|
|
159878
|
+
let chainedExpression = reverseTraverse[reverseTraverse.length - 1].expression.identifier;
|
|
159879
|
+
for (let i = reverseTraverse.length - 2; i >= 0; --i) {
|
|
159880
|
+
const nextSubExpr = reverseTraverse[i].expression;
|
|
159881
|
+
if (nextSubExpr.kind === 0 /* Text */) {
|
|
159882
|
+
chainedExpression = factory.createPropertyAccessChain(
|
|
159883
|
+
chainedExpression,
|
|
159884
|
+
/*questionDotToken*/
|
|
159885
|
+
void 0,
|
|
159886
|
+
factory.createIdentifier(nextSubExpr.text)
|
|
159887
|
+
);
|
|
159888
|
+
} else if (nextSubExpr.kind === 1 /* Computed */) {
|
|
159889
|
+
chainedExpression = factory.createElementAccessExpression(
|
|
159890
|
+
chainedExpression,
|
|
159891
|
+
expressionToVar.get(nextSubExpr.computed)
|
|
159892
|
+
);
|
|
159893
|
+
} else if (nextSubExpr.kind === 2 /* ArrayAccess */) {
|
|
159894
|
+
chainedExpression = factory.createElementAccessExpression(
|
|
159895
|
+
chainedExpression,
|
|
159896
|
+
nextSubExpr.arrayIndex
|
|
159897
|
+
);
|
|
159898
|
+
}
|
|
159899
|
+
}
|
|
159900
|
+
return chainedExpression;
|
|
159901
|
+
}
|
|
159902
|
+
function inferType(node, variableType) {
|
|
159903
|
+
if (typePrintMode === 1 /* Relative */) {
|
|
159904
|
+
return relativeType(node);
|
|
159905
|
+
}
|
|
159906
|
+
let type = isValueSignatureDeclaration(node) ? tryGetReturnType2(node) : typeChecker.getTypeAtLocation(node);
|
|
159907
|
+
if (!type) {
|
|
159908
|
+
return emptyInferenceResult;
|
|
159909
|
+
}
|
|
159910
|
+
if (typePrintMode === 2 /* Widened */) {
|
|
159911
|
+
if (variableType) {
|
|
159912
|
+
type = variableType;
|
|
159913
|
+
}
|
|
159914
|
+
const widenedType = typeChecker.getWidenedLiteralType(type);
|
|
159915
|
+
if (typeChecker.isTypeAssignableTo(widenedType, type)) {
|
|
159916
|
+
return emptyInferenceResult;
|
|
159917
|
+
}
|
|
159918
|
+
type = widenedType;
|
|
159919
|
+
}
|
|
159920
|
+
if (isParameter(node) && emitResolver.requiresAddingImplicitUndefined(node)) {
|
|
159921
|
+
type = typeChecker.getUnionType([typeChecker.getUndefinedType(), type], 0 /* None */);
|
|
159922
|
+
}
|
|
159923
|
+
const flags = (isVariableDeclaration(node) || isPropertyDeclaration(node) && hasSyntacticModifier(node, 256 /* Static */ | 8 /* Readonly */)) && type.flags & 8192 /* UniqueESSymbol */ ? 1048576 /* AllowUniqueESSymbolType */ : 0 /* None */;
|
|
159924
|
+
return {
|
|
159925
|
+
typeNode: typeToTypeNode2(type, findAncestor(node, isDeclaration) ?? sourceFile, flags),
|
|
159926
|
+
mutatedTarget: false
|
|
159927
|
+
};
|
|
159928
|
+
}
|
|
159929
|
+
function createTypeOfFromEntityNameExpression(node) {
|
|
159930
|
+
return factory.createTypeQueryNode(getSynthesizedDeepClone(node));
|
|
159931
|
+
}
|
|
159932
|
+
function typeFromArraySpreadElements(node, name = "temp") {
|
|
159933
|
+
const isConstContext = !!findAncestor(node, isConstAssertion2);
|
|
159934
|
+
if (!isConstContext)
|
|
159935
|
+
return emptyInferenceResult;
|
|
159936
|
+
return typeFromSpreads(
|
|
159937
|
+
node,
|
|
159938
|
+
name,
|
|
159939
|
+
isConstContext,
|
|
159940
|
+
(n) => n.elements,
|
|
159941
|
+
isSpreadElement,
|
|
159942
|
+
factory.createSpreadElement,
|
|
159943
|
+
(props) => factory.createArrayLiteralExpression(
|
|
159944
|
+
props,
|
|
159945
|
+
/*multiLine*/
|
|
159946
|
+
true
|
|
159947
|
+
),
|
|
159948
|
+
(types) => factory.createTupleTypeNode(types.map(factory.createRestTypeNode))
|
|
159949
|
+
);
|
|
159950
|
+
}
|
|
159951
|
+
function typeFromObjectSpreadAssignment(node, name = "temp") {
|
|
159952
|
+
const isConstContext = !!findAncestor(node, isConstAssertion2);
|
|
159953
|
+
return typeFromSpreads(
|
|
159954
|
+
node,
|
|
159955
|
+
name,
|
|
159956
|
+
isConstContext,
|
|
159957
|
+
(n) => n.properties,
|
|
159958
|
+
isSpreadAssignment,
|
|
159959
|
+
factory.createSpreadAssignment,
|
|
159960
|
+
(props) => factory.createObjectLiteralExpression(
|
|
159961
|
+
props,
|
|
159962
|
+
/*multiLine*/
|
|
159963
|
+
true
|
|
159964
|
+
),
|
|
159965
|
+
factory.createIntersectionTypeNode
|
|
159966
|
+
);
|
|
159967
|
+
}
|
|
159968
|
+
function typeFromSpreads(node, name, isConstContext, getChildren, isSpread, createSpread, makeNodeOfKind, finalType) {
|
|
159969
|
+
const intersectionTypes = [];
|
|
159970
|
+
const newSpreads = [];
|
|
159971
|
+
let currentVariableProperties;
|
|
159972
|
+
const statement = findAncestor(node, isStatement);
|
|
159973
|
+
for (const prop of getChildren(node)) {
|
|
159974
|
+
if (isSpread(prop)) {
|
|
159975
|
+
finalizesVariablePart();
|
|
159976
|
+
if (isEntityNameExpression(prop.expression)) {
|
|
159977
|
+
intersectionTypes.push(createTypeOfFromEntityNameExpression(prop.expression));
|
|
159978
|
+
newSpreads.push(prop);
|
|
159979
|
+
} else {
|
|
159980
|
+
makeVariable(prop.expression);
|
|
159981
|
+
}
|
|
159982
|
+
} else {
|
|
159983
|
+
(currentVariableProperties ?? (currentVariableProperties = [])).push(prop);
|
|
159984
|
+
}
|
|
159985
|
+
}
|
|
159986
|
+
if (newSpreads.length === 0) {
|
|
159987
|
+
return emptyInferenceResult;
|
|
159988
|
+
}
|
|
159989
|
+
finalizesVariablePart();
|
|
159990
|
+
changeTracker.replaceNode(sourceFile, node, makeNodeOfKind(newSpreads));
|
|
159991
|
+
return {
|
|
159992
|
+
typeNode: finalType(intersectionTypes),
|
|
159993
|
+
mutatedTarget: true
|
|
159994
|
+
};
|
|
159995
|
+
function makeVariable(expression) {
|
|
159996
|
+
const tempName = factory.createUniqueName(
|
|
159997
|
+
name + "_Part" + (newSpreads.length + 1),
|
|
159998
|
+
16 /* Optimistic */
|
|
159999
|
+
);
|
|
160000
|
+
const initializer = !isConstContext ? expression : factory.createAsExpression(
|
|
160001
|
+
expression,
|
|
160002
|
+
factory.createTypeReferenceNode("const")
|
|
160003
|
+
);
|
|
160004
|
+
const variableDefinition = factory.createVariableStatement(
|
|
160005
|
+
/*modifiers*/
|
|
160006
|
+
void 0,
|
|
160007
|
+
factory.createVariableDeclarationList([
|
|
160008
|
+
factory.createVariableDeclaration(
|
|
160009
|
+
tempName,
|
|
160010
|
+
/*exclamationToken*/
|
|
160011
|
+
void 0,
|
|
160012
|
+
/*type*/
|
|
160013
|
+
void 0,
|
|
160014
|
+
initializer
|
|
160015
|
+
)
|
|
160016
|
+
], 2 /* Const */)
|
|
160017
|
+
);
|
|
160018
|
+
changeTracker.insertNodeBefore(sourceFile, statement, variableDefinition);
|
|
160019
|
+
intersectionTypes.push(createTypeOfFromEntityNameExpression(tempName));
|
|
160020
|
+
newSpreads.push(createSpread(tempName));
|
|
160021
|
+
}
|
|
160022
|
+
function finalizesVariablePart() {
|
|
160023
|
+
if (currentVariableProperties) {
|
|
160024
|
+
makeVariable(makeNodeOfKind(
|
|
160025
|
+
currentVariableProperties
|
|
160026
|
+
));
|
|
160027
|
+
currentVariableProperties = void 0;
|
|
160028
|
+
}
|
|
160029
|
+
}
|
|
160030
|
+
}
|
|
160031
|
+
function isConstAssertion2(location) {
|
|
160032
|
+
return isAssertionExpression(location) && isConstTypeReference(location.type);
|
|
160033
|
+
}
|
|
160034
|
+
function relativeType(node) {
|
|
160035
|
+
if (isParameter(node)) {
|
|
160036
|
+
return emptyInferenceResult;
|
|
160037
|
+
}
|
|
160038
|
+
if (isShorthandPropertyAssignment(node)) {
|
|
160039
|
+
return {
|
|
160040
|
+
typeNode: createTypeOfFromEntityNameExpression(node.name),
|
|
160041
|
+
mutatedTarget: false
|
|
160042
|
+
};
|
|
160043
|
+
}
|
|
160044
|
+
if (isEntityNameExpression(node)) {
|
|
160045
|
+
return {
|
|
160046
|
+
typeNode: createTypeOfFromEntityNameExpression(node),
|
|
160047
|
+
mutatedTarget: false
|
|
160048
|
+
};
|
|
160049
|
+
}
|
|
160050
|
+
if (isConstAssertion2(node)) {
|
|
160051
|
+
return relativeType(node.expression);
|
|
160052
|
+
}
|
|
160053
|
+
if (isArrayLiteralExpression(node)) {
|
|
160054
|
+
const variableDecl = findAncestor(node, isVariableDeclaration);
|
|
160055
|
+
const partName = variableDecl && isIdentifier(variableDecl.name) ? variableDecl.name.text : void 0;
|
|
160056
|
+
return typeFromArraySpreadElements(node, partName);
|
|
160057
|
+
}
|
|
160058
|
+
if (isObjectLiteralExpression(node)) {
|
|
160059
|
+
const variableDecl = findAncestor(node, isVariableDeclaration);
|
|
160060
|
+
const partName = variableDecl && isIdentifier(variableDecl.name) ? variableDecl.name.text : void 0;
|
|
160061
|
+
return typeFromObjectSpreadAssignment(node, partName);
|
|
160062
|
+
}
|
|
160063
|
+
if (isVariableDeclaration(node) && node.initializer) {
|
|
160064
|
+
return relativeType(node.initializer);
|
|
160065
|
+
}
|
|
160066
|
+
if (isConditionalExpression(node)) {
|
|
160067
|
+
const { typeNode: trueType, mutatedTarget: mTrue } = relativeType(node.whenTrue);
|
|
160068
|
+
if (!trueType)
|
|
160069
|
+
return emptyInferenceResult;
|
|
160070
|
+
const { typeNode: falseType, mutatedTarget: mFalse } = relativeType(node.whenFalse);
|
|
160071
|
+
if (!falseType)
|
|
160072
|
+
return emptyInferenceResult;
|
|
160073
|
+
return {
|
|
160074
|
+
typeNode: factory.createUnionTypeNode([trueType, falseType]),
|
|
160075
|
+
mutatedTarget: mTrue || mFalse
|
|
160076
|
+
};
|
|
160077
|
+
}
|
|
160078
|
+
return emptyInferenceResult;
|
|
160079
|
+
}
|
|
160080
|
+
function typeToTypeNode2(type, enclosingDeclaration, flags = 0 /* None */) {
|
|
160081
|
+
let isTruncated = false;
|
|
160082
|
+
const result2 = typeToAutoImportableTypeNode(typeChecker, importAdder, type, enclosingDeclaration, scriptTarget, declarationEmitNodeBuilderFlags2 | flags, {
|
|
160083
|
+
moduleResolverHost: program,
|
|
160084
|
+
trackSymbol() {
|
|
160085
|
+
return true;
|
|
160086
|
+
},
|
|
160087
|
+
reportTruncationError() {
|
|
160088
|
+
isTruncated = true;
|
|
160089
|
+
}
|
|
160090
|
+
});
|
|
160091
|
+
return isTruncated ? factory.createKeywordTypeNode(133 /* AnyKeyword */) : result2;
|
|
160092
|
+
}
|
|
160093
|
+
function tryGetReturnType2(node) {
|
|
160094
|
+
const signature = typeChecker.getSignatureFromDeclaration(node);
|
|
160095
|
+
if (signature) {
|
|
160096
|
+
return typeChecker.getReturnTypeOfSignature(signature);
|
|
160097
|
+
}
|
|
160098
|
+
}
|
|
160099
|
+
function addTypeToVariableLike(decl) {
|
|
160100
|
+
const { typeNode } = inferType(decl);
|
|
160101
|
+
if (typeNode) {
|
|
160102
|
+
if (decl.type) {
|
|
160103
|
+
changeTracker.replaceNode(getSourceFileOfNode(decl), decl.type, typeNode);
|
|
160104
|
+
} else {
|
|
160105
|
+
changeTracker.tryInsertTypeAnnotation(getSourceFileOfNode(decl), decl, typeNode);
|
|
160106
|
+
}
|
|
160107
|
+
return [Diagnostics.Add_annotation_of_type_0, typeToStringForDiag(typeNode)];
|
|
160108
|
+
}
|
|
160109
|
+
}
|
|
160110
|
+
function typeToStringForDiag(node) {
|
|
160111
|
+
setEmitFlags(node, 1 /* SingleLine */);
|
|
160112
|
+
const result2 = typePrinter.printNode(4 /* Unspecified */, node, sourceFile);
|
|
160113
|
+
if (result2.length > defaultMaximumTruncationLength) {
|
|
160114
|
+
return result2.substring(0, defaultMaximumTruncationLength - "...".length) + "...";
|
|
160115
|
+
}
|
|
160116
|
+
setEmitFlags(node, 0 /* None */);
|
|
160117
|
+
return result2;
|
|
160118
|
+
}
|
|
160119
|
+
}
|
|
160120
|
+
function findAncestorWithMissingType(node) {
|
|
160121
|
+
return findAncestor(node, (n) => {
|
|
160122
|
+
return canHaveTypeAnnotation.has(n.kind) && (!isObjectBindingPattern(n) && !isArrayBindingPattern(n) || isVariableDeclaration(n.parent));
|
|
160123
|
+
});
|
|
160124
|
+
}
|
|
160125
|
+
function findBestFittingNode(node, span) {
|
|
160126
|
+
while (node && node.end < span.start + span.length) {
|
|
160127
|
+
node = node.parent;
|
|
160128
|
+
}
|
|
160129
|
+
while (node.parent.pos === node.pos && node.parent.end === node.end) {
|
|
160130
|
+
node = node.parent;
|
|
160131
|
+
}
|
|
160132
|
+
if (isIdentifier(node) && hasInitializer(node.parent) && node.parent.initializer) {
|
|
160133
|
+
return node.parent.initializer;
|
|
160134
|
+
}
|
|
160135
|
+
return node;
|
|
160136
|
+
}
|
|
160137
|
+
|
|
160138
|
+
// src/services/codefixes/fixAwaitInSyncFunction.ts
|
|
160139
|
+
var fixId37 = "fixAwaitInSyncFunction";
|
|
160140
|
+
var errorCodes48 = [
|
|
159151
160141
|
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
159152
160142
|
Diagnostics.await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
159153
160143
|
Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
159154
160144
|
Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function.code
|
|
159155
160145
|
];
|
|
159156
160146
|
registerCodeFix({
|
|
159157
|
-
errorCodes:
|
|
160147
|
+
errorCodes: errorCodes48,
|
|
159158
160148
|
getCodeActions(context) {
|
|
159159
160149
|
const { sourceFile, span } = context;
|
|
159160
160150
|
const nodes = getNodes3(sourceFile, span.start);
|
|
159161
160151
|
if (!nodes)
|
|
159162
160152
|
return void 0;
|
|
159163
160153
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange31(t, sourceFile, nodes));
|
|
159164
|
-
return [createCodeFixAction(
|
|
160154
|
+
return [createCodeFixAction(fixId37, changes, Diagnostics.Add_async_modifier_to_containing_function, fixId37, Diagnostics.Add_all_missing_async_modifiers)];
|
|
159165
160155
|
},
|
|
159166
|
-
fixIds: [
|
|
160156
|
+
fixIds: [fixId37],
|
|
159167
160157
|
getAllCodeActions: function getAllCodeActionsToFixAwaitInSyncFunction(context) {
|
|
159168
160158
|
const seen = /* @__PURE__ */ new Map();
|
|
159169
|
-
return codeFixAll(context,
|
|
160159
|
+
return codeFixAll(context, errorCodes48, (changes, diag2) => {
|
|
159170
160160
|
const nodes = getNodes3(diag2.file, diag2.start);
|
|
159171
160161
|
if (!nodes || !addToSeen(seen, getNodeId(nodes.insertBefore)))
|
|
159172
160162
|
return;
|
|
@@ -159220,21 +160210,21 @@ function doChange31(changes, sourceFile, { insertBefore, returnType }) {
|
|
|
159220
160210
|
}
|
|
159221
160211
|
|
|
159222
160212
|
// src/services/codefixes/fixPropertyOverrideAccessor.ts
|
|
159223
|
-
var
|
|
160213
|
+
var errorCodes49 = [
|
|
159224
160214
|
Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code,
|
|
159225
160215
|
Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor.code
|
|
159226
160216
|
];
|
|
159227
|
-
var
|
|
160217
|
+
var fixId38 = "fixPropertyOverrideAccessor";
|
|
159228
160218
|
registerCodeFix({
|
|
159229
|
-
errorCodes:
|
|
160219
|
+
errorCodes: errorCodes49,
|
|
159230
160220
|
getCodeActions(context) {
|
|
159231
160221
|
const edits = doChange32(context.sourceFile, context.span.start, context.span.length, context.errorCode, context);
|
|
159232
160222
|
if (edits) {
|
|
159233
|
-
return [createCodeFixAction(
|
|
160223
|
+
return [createCodeFixAction(fixId38, edits, Diagnostics.Generate_get_and_set_accessors, fixId38, Diagnostics.Generate_get_and_set_accessors_for_all_overriding_properties)];
|
|
159234
160224
|
}
|
|
159235
160225
|
},
|
|
159236
|
-
fixIds: [
|
|
159237
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
160226
|
+
fixIds: [fixId38],
|
|
160227
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes49, (changes, diag2) => {
|
|
159238
160228
|
const edits = doChange32(diag2.file, diag2.start, diag2.length, diag2.code, context);
|
|
159239
160229
|
if (edits) {
|
|
159240
160230
|
for (const edit of edits) {
|
|
@@ -159272,8 +160262,8 @@ function doChange32(file, start, length2, code, context) {
|
|
|
159272
160262
|
}
|
|
159273
160263
|
|
|
159274
160264
|
// src/services/codefixes/inferFromUsage.ts
|
|
159275
|
-
var
|
|
159276
|
-
var
|
|
160265
|
+
var fixId39 = "inferFromUsage";
|
|
160266
|
+
var errorCodes50 = [
|
|
159277
160267
|
// Variable declarations
|
|
159278
160268
|
Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code,
|
|
159279
160269
|
// Variable uses
|
|
@@ -159307,7 +160297,7 @@ var errorCodes49 = [
|
|
|
159307
160297
|
Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code
|
|
159308
160298
|
];
|
|
159309
160299
|
registerCodeFix({
|
|
159310
|
-
errorCodes:
|
|
160300
|
+
errorCodes: errorCodes50,
|
|
159311
160301
|
getCodeActions(context) {
|
|
159312
160302
|
const { sourceFile, program, span: { start }, errorCode, cancellationToken, host, preferences } = context;
|
|
159313
160303
|
const token = getTokenAtPosition(sourceFile, start);
|
|
@@ -159327,13 +160317,13 @@ registerCodeFix({
|
|
|
159327
160317
|
);
|
|
159328
160318
|
});
|
|
159329
160319
|
const name = declaration && getNameOfDeclaration(declaration);
|
|
159330
|
-
return !name || changes.length === 0 ? void 0 : [createCodeFixAction(
|
|
160320
|
+
return !name || changes.length === 0 ? void 0 : [createCodeFixAction(fixId39, changes, [getDiagnostic(errorCode, token), getTextOfNode(name)], fixId39, Diagnostics.Infer_all_types_from_usage)];
|
|
159331
160321
|
},
|
|
159332
|
-
fixIds: [
|
|
160322
|
+
fixIds: [fixId39],
|
|
159333
160323
|
getAllCodeActions(context) {
|
|
159334
160324
|
const { sourceFile, program, cancellationToken, host, preferences } = context;
|
|
159335
160325
|
const markSeen = nodeSeenTracker();
|
|
159336
|
-
return codeFixAll(context,
|
|
160326
|
+
return codeFixAll(context, errorCodes50, (changes, err) => {
|
|
159337
160327
|
doChange33(changes, sourceFile, getTokenAtPosition(err.file, err.start), err.code, program, cancellationToken, markSeen, host, preferences);
|
|
159338
160328
|
});
|
|
159339
160329
|
}
|
|
@@ -160272,13 +161262,13 @@ function inferTypeFromReferences(program, references, cancellationToken) {
|
|
|
160272
161262
|
}
|
|
160273
161263
|
|
|
160274
161264
|
// src/services/codefixes/fixReturnTypeInAsyncFunction.ts
|
|
160275
|
-
var
|
|
160276
|
-
var
|
|
161265
|
+
var fixId40 = "fixReturnTypeInAsyncFunction";
|
|
161266
|
+
var errorCodes51 = [
|
|
160277
161267
|
Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0.code
|
|
160278
161268
|
];
|
|
160279
161269
|
registerCodeFix({
|
|
160280
|
-
errorCodes:
|
|
160281
|
-
fixIds: [
|
|
161270
|
+
errorCodes: errorCodes51,
|
|
161271
|
+
fixIds: [fixId40],
|
|
160282
161272
|
getCodeActions: function getCodeActionsToFixReturnTypeInAsyncFunction(context) {
|
|
160283
161273
|
const { sourceFile, program, span } = context;
|
|
160284
161274
|
const checker = program.getTypeChecker();
|
|
@@ -160289,14 +161279,14 @@ registerCodeFix({
|
|
|
160289
161279
|
const { returnTypeNode, returnType, promisedTypeNode, promisedType } = info;
|
|
160290
161280
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange34(t, sourceFile, returnTypeNode, promisedTypeNode));
|
|
160291
161281
|
return [createCodeFixAction(
|
|
160292
|
-
|
|
161282
|
+
fixId40,
|
|
160293
161283
|
changes,
|
|
160294
161284
|
[Diagnostics.Replace_0_with_Promise_1, checker.typeToString(returnType), checker.typeToString(promisedType)],
|
|
160295
|
-
|
|
161285
|
+
fixId40,
|
|
160296
161286
|
Diagnostics.Fix_all_incorrect_return_type_of_an_async_functions
|
|
160297
161287
|
)];
|
|
160298
161288
|
},
|
|
160299
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
161289
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes51, (changes, diag2) => {
|
|
160300
161290
|
const info = getInfo16(diag2.file, context.program.getTypeChecker(), diag2.start);
|
|
160301
161291
|
if (info) {
|
|
160302
161292
|
doChange34(changes, diag2.file, info.returnTypeNode, info.promisedTypeNode);
|
|
@@ -160332,13 +161322,13 @@ function doChange34(changes, sourceFile, returnTypeNode, promisedTypeNode) {
|
|
|
160332
161322
|
|
|
160333
161323
|
// src/services/codefixes/disableJsDiagnostics.ts
|
|
160334
161324
|
var fixName4 = "disableJsDiagnostics";
|
|
160335
|
-
var
|
|
160336
|
-
var
|
|
161325
|
+
var fixId41 = "disableJsDiagnostics";
|
|
161326
|
+
var errorCodes52 = mapDefined(Object.keys(Diagnostics), (key) => {
|
|
160337
161327
|
const diag2 = Diagnostics[key];
|
|
160338
161328
|
return diag2.category === 1 /* Error */ ? diag2.code : void 0;
|
|
160339
161329
|
});
|
|
160340
161330
|
registerCodeFix({
|
|
160341
|
-
errorCodes:
|
|
161331
|
+
errorCodes: errorCodes52,
|
|
160342
161332
|
getCodeActions: function getCodeActionsToDisableJsDiagnostics(context) {
|
|
160343
161333
|
const { sourceFile, program, span, host, formatContext } = context;
|
|
160344
161334
|
if (!isInJSFile(sourceFile) || !isCheckJsEnabledForFile(sourceFile, program.getCompilerOptions())) {
|
|
@@ -160359,14 +161349,14 @@ registerCodeFix({
|
|
|
160359
161349
|
)
|
|
160360
161350
|
];
|
|
160361
161351
|
if (ts_textChanges_exports.isValidLocationToAddComment(sourceFile, span.start)) {
|
|
160362
|
-
fixes.unshift(createCodeFixAction(fixName4, ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange8(t, sourceFile, span.start)), Diagnostics.Ignore_this_error_message,
|
|
161352
|
+
fixes.unshift(createCodeFixAction(fixName4, ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange8(t, sourceFile, span.start)), Diagnostics.Ignore_this_error_message, fixId41, Diagnostics.Add_ts_ignore_to_all_error_messages));
|
|
160363
161353
|
}
|
|
160364
161354
|
return fixes;
|
|
160365
161355
|
},
|
|
160366
|
-
fixIds: [
|
|
161356
|
+
fixIds: [fixId41],
|
|
160367
161357
|
getAllCodeActions: (context) => {
|
|
160368
161358
|
const seenLines = /* @__PURE__ */ new Set();
|
|
160369
|
-
return codeFixAll(context,
|
|
161359
|
+
return codeFixAll(context, errorCodes52, (changes, diag2) => {
|
|
160370
161360
|
if (ts_textChanges_exports.isValidLocationToAddComment(diag2.file, diag2.start)) {
|
|
160371
161361
|
makeChange8(changes, diag2.file, diag2.start, seenLines);
|
|
160372
161362
|
}
|
|
@@ -161365,9 +162355,9 @@ var fixName6 = "strictClassInitialization";
|
|
|
161365
162355
|
var fixIdAddDefiniteAssignmentAssertions = "addMissingPropertyDefiniteAssignmentAssertions";
|
|
161366
162356
|
var fixIdAddUndefinedType = "addMissingPropertyUndefinedType";
|
|
161367
162357
|
var fixIdAddInitializer = "addMissingPropertyInitializer";
|
|
161368
|
-
var
|
|
162358
|
+
var errorCodes53 = [Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor.code];
|
|
161369
162359
|
registerCodeFix({
|
|
161370
|
-
errorCodes:
|
|
162360
|
+
errorCodes: errorCodes53,
|
|
161371
162361
|
getCodeActions: function getCodeActionsForStrictClassInitializationErrors(context) {
|
|
161372
162362
|
const info = getInfo17(context.sourceFile, context.span.start);
|
|
161373
162363
|
if (!info)
|
|
@@ -161380,7 +162370,7 @@ registerCodeFix({
|
|
|
161380
162370
|
},
|
|
161381
162371
|
fixIds: [fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer],
|
|
161382
162372
|
getAllCodeActions: (context) => {
|
|
161383
|
-
return codeFixAll(context,
|
|
162373
|
+
return codeFixAll(context, errorCodes53, (changes, diag2) => {
|
|
161384
162374
|
const info = getInfo17(diag2.file, diag2.start);
|
|
161385
162375
|
if (!info)
|
|
161386
162376
|
return;
|
|
@@ -161510,20 +162500,20 @@ function getDefaultValueFromType(checker, type) {
|
|
|
161510
162500
|
}
|
|
161511
162501
|
|
|
161512
162502
|
// src/services/codefixes/requireInTs.ts
|
|
161513
|
-
var
|
|
161514
|
-
var
|
|
162503
|
+
var fixId42 = "requireInTs";
|
|
162504
|
+
var errorCodes54 = [Diagnostics.require_call_may_be_converted_to_an_import.code];
|
|
161515
162505
|
registerCodeFix({
|
|
161516
|
-
errorCodes:
|
|
162506
|
+
errorCodes: errorCodes54,
|
|
161517
162507
|
getCodeActions(context) {
|
|
161518
162508
|
const info = getInfo18(context.sourceFile, context.program, context.span.start);
|
|
161519
162509
|
if (!info) {
|
|
161520
162510
|
return void 0;
|
|
161521
162511
|
}
|
|
161522
162512
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange35(t, context.sourceFile, info));
|
|
161523
|
-
return [createCodeFixAction(
|
|
162513
|
+
return [createCodeFixAction(fixId42, changes, Diagnostics.Convert_require_to_import, fixId42, Diagnostics.Convert_all_require_to_import)];
|
|
161524
162514
|
},
|
|
161525
|
-
fixIds: [
|
|
161526
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
162515
|
+
fixIds: [fixId42],
|
|
162516
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes54, (changes, diag2) => {
|
|
161527
162517
|
const info = getInfo18(diag2.file, context.program, diag2.start);
|
|
161528
162518
|
if (info) {
|
|
161529
162519
|
doChange35(changes, context.sourceFile, info);
|
|
@@ -161598,20 +162588,20 @@ function tryCreateNamedImportsFromObjectBindingPattern(node) {
|
|
|
161598
162588
|
}
|
|
161599
162589
|
|
|
161600
162590
|
// src/services/codefixes/useDefaultImport.ts
|
|
161601
|
-
var
|
|
161602
|
-
var
|
|
162591
|
+
var fixId43 = "useDefaultImport";
|
|
162592
|
+
var errorCodes55 = [Diagnostics.Import_may_be_converted_to_a_default_import.code];
|
|
161603
162593
|
registerCodeFix({
|
|
161604
|
-
errorCodes:
|
|
162594
|
+
errorCodes: errorCodes55,
|
|
161605
162595
|
getCodeActions(context) {
|
|
161606
162596
|
const { sourceFile, span: { start } } = context;
|
|
161607
162597
|
const info = getInfo19(sourceFile, start);
|
|
161608
162598
|
if (!info)
|
|
161609
162599
|
return void 0;
|
|
161610
162600
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange36(t, sourceFile, info, context.preferences));
|
|
161611
|
-
return [createCodeFixAction(
|
|
162601
|
+
return [createCodeFixAction(fixId43, changes, Diagnostics.Convert_to_default_import, fixId43, Diagnostics.Convert_all_to_default_imports)];
|
|
161612
162602
|
},
|
|
161613
|
-
fixIds: [
|
|
161614
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
162603
|
+
fixIds: [fixId43],
|
|
162604
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes55, (changes, diag2) => {
|
|
161615
162605
|
const info = getInfo19(diag2.file, diag2.start);
|
|
161616
162606
|
if (info)
|
|
161617
162607
|
doChange36(changes, diag2.file, info, context.preferences);
|
|
@@ -161640,21 +162630,21 @@ function doChange36(changes, sourceFile, info, preferences) {
|
|
|
161640
162630
|
}
|
|
161641
162631
|
|
|
161642
162632
|
// src/services/codefixes/useBigintLiteral.ts
|
|
161643
|
-
var
|
|
161644
|
-
var
|
|
162633
|
+
var fixId44 = "useBigintLiteral";
|
|
162634
|
+
var errorCodes56 = [
|
|
161645
162635
|
Diagnostics.Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers.code
|
|
161646
162636
|
];
|
|
161647
162637
|
registerCodeFix({
|
|
161648
|
-
errorCodes:
|
|
162638
|
+
errorCodes: errorCodes56,
|
|
161649
162639
|
getCodeActions: function getCodeActionsToUseBigintLiteral(context) {
|
|
161650
162640
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange9(t, context.sourceFile, context.span));
|
|
161651
162641
|
if (changes.length > 0) {
|
|
161652
|
-
return [createCodeFixAction(
|
|
162642
|
+
return [createCodeFixAction(fixId44, changes, Diagnostics.Convert_to_a_bigint_numeric_literal, fixId44, Diagnostics.Convert_all_to_bigint_numeric_literals)];
|
|
161653
162643
|
}
|
|
161654
162644
|
},
|
|
161655
|
-
fixIds: [
|
|
162645
|
+
fixIds: [fixId44],
|
|
161656
162646
|
getAllCodeActions: (context) => {
|
|
161657
|
-
return codeFixAll(context,
|
|
162647
|
+
return codeFixAll(context, errorCodes56, (changes, diag2) => makeChange9(changes, diag2.file, diag2));
|
|
161658
162648
|
}
|
|
161659
162649
|
});
|
|
161660
162650
|
function makeChange9(changeTracker, sourceFile, span) {
|
|
@@ -161668,18 +162658,18 @@ function makeChange9(changeTracker, sourceFile, span) {
|
|
|
161668
162658
|
|
|
161669
162659
|
// src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts
|
|
161670
162660
|
var fixIdAddMissingTypeof = "fixAddModuleReferTypeMissingTypeof";
|
|
161671
|
-
var
|
|
161672
|
-
var
|
|
162661
|
+
var fixId45 = fixIdAddMissingTypeof;
|
|
162662
|
+
var errorCodes57 = [Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0.code];
|
|
161673
162663
|
registerCodeFix({
|
|
161674
|
-
errorCodes:
|
|
162664
|
+
errorCodes: errorCodes57,
|
|
161675
162665
|
getCodeActions: function getCodeActionsToAddMissingTypeof(context) {
|
|
161676
162666
|
const { sourceFile, span } = context;
|
|
161677
162667
|
const importType = getImportTypeNode(sourceFile, span.start);
|
|
161678
162668
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange37(t, sourceFile, importType));
|
|
161679
|
-
return [createCodeFixAction(
|
|
162669
|
+
return [createCodeFixAction(fixId45, changes, Diagnostics.Add_missing_typeof, fixId45, Diagnostics.Add_missing_typeof)];
|
|
161680
162670
|
},
|
|
161681
|
-
fixIds: [
|
|
161682
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
162671
|
+
fixIds: [fixId45],
|
|
162672
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes57, (changes, diag2) => doChange37(changes, context.sourceFile, getImportTypeNode(diag2.file, diag2.start)))
|
|
161683
162673
|
});
|
|
161684
162674
|
function getImportTypeNode(sourceFile, pos) {
|
|
161685
162675
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
@@ -161702,9 +162692,9 @@ function doChange37(changes, sourceFile, importType) {
|
|
|
161702
162692
|
|
|
161703
162693
|
// src/services/codefixes/wrapJsxInFragment.ts
|
|
161704
162694
|
var fixID2 = "wrapJsxInFragment";
|
|
161705
|
-
var
|
|
162695
|
+
var errorCodes58 = [Diagnostics.JSX_expressions_must_have_one_parent_element.code];
|
|
161706
162696
|
registerCodeFix({
|
|
161707
|
-
errorCodes:
|
|
162697
|
+
errorCodes: errorCodes58,
|
|
161708
162698
|
getCodeActions: function getCodeActionsToWrapJsxInFragment(context) {
|
|
161709
162699
|
const { sourceFile, span } = context;
|
|
161710
162700
|
const node = findNodeToFix(sourceFile, span.start);
|
|
@@ -161714,7 +162704,7 @@ registerCodeFix({
|
|
|
161714
162704
|
return [createCodeFixAction(fixID2, changes, Diagnostics.Wrap_in_JSX_fragment, fixID2, Diagnostics.Wrap_all_unparented_JSX_in_JSX_fragment)];
|
|
161715
162705
|
},
|
|
161716
162706
|
fixIds: [fixID2],
|
|
161717
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
162707
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes58, (changes, diag2) => {
|
|
161718
162708
|
const node = findNodeToFix(context.sourceFile, diag2.start);
|
|
161719
162709
|
if (!node)
|
|
161720
162710
|
return void 0;
|
|
@@ -161759,16 +162749,16 @@ function flattenInvalidBinaryExpr(node) {
|
|
|
161759
162749
|
}
|
|
161760
162750
|
|
|
161761
162751
|
// src/services/codefixes/wrapDecoratorInParentheses.ts
|
|
161762
|
-
var
|
|
161763
|
-
var
|
|
162752
|
+
var fixId46 = "wrapDecoratorInParentheses";
|
|
162753
|
+
var errorCodes59 = [Diagnostics.Expression_must_be_enclosed_in_parentheses_to_be_used_as_a_decorator.code];
|
|
161764
162754
|
registerCodeFix({
|
|
161765
|
-
errorCodes:
|
|
162755
|
+
errorCodes: errorCodes59,
|
|
161766
162756
|
getCodeActions: function getCodeActionsToWrapDecoratorExpressionInParentheses(context) {
|
|
161767
162757
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange10(t, context.sourceFile, context.span.start));
|
|
161768
|
-
return [createCodeFixAction(
|
|
162758
|
+
return [createCodeFixAction(fixId46, changes, Diagnostics.Wrap_in_parentheses, fixId46, Diagnostics.Wrap_all_invalid_decorator_expressions_in_parentheses)];
|
|
161769
162759
|
},
|
|
161770
|
-
fixIds: [
|
|
161771
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
162760
|
+
fixIds: [fixId46],
|
|
162761
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes59, (changes, diag2) => makeChange10(changes, diag2.file, diag2.start))
|
|
161772
162762
|
});
|
|
161773
162763
|
function makeChange10(changeTracker, sourceFile, pos) {
|
|
161774
162764
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
@@ -161779,10 +162769,10 @@ function makeChange10(changeTracker, sourceFile, pos) {
|
|
|
161779
162769
|
}
|
|
161780
162770
|
|
|
161781
162771
|
// src/services/codefixes/convertToMappedObjectType.ts
|
|
161782
|
-
var
|
|
161783
|
-
var
|
|
162772
|
+
var fixId47 = "fixConvertToMappedObjectType";
|
|
162773
|
+
var errorCodes60 = [Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead.code];
|
|
161784
162774
|
registerCodeFix({
|
|
161785
|
-
errorCodes:
|
|
162775
|
+
errorCodes: errorCodes60,
|
|
161786
162776
|
getCodeActions: function getCodeActionsToConvertToMappedTypeObject(context) {
|
|
161787
162777
|
const { sourceFile, span } = context;
|
|
161788
162778
|
const info = getInfo20(sourceFile, span.start);
|
|
@@ -161790,10 +162780,10 @@ registerCodeFix({
|
|
|
161790
162780
|
return void 0;
|
|
161791
162781
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange39(t, sourceFile, info));
|
|
161792
162782
|
const name = idText(info.container.name);
|
|
161793
|
-
return [createCodeFixAction(
|
|
162783
|
+
return [createCodeFixAction(fixId47, changes, [Diagnostics.Convert_0_to_mapped_object_type, name], fixId47, [Diagnostics.Convert_0_to_mapped_object_type, name])];
|
|
161794
162784
|
},
|
|
161795
|
-
fixIds: [
|
|
161796
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
162785
|
+
fixIds: [fixId47],
|
|
162786
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes60, (changes, diag2) => {
|
|
161797
162787
|
const info = getInfo20(diag2.file, diag2.start);
|
|
161798
162788
|
if (info)
|
|
161799
162789
|
doChange39(changes, diag2.file, info);
|
|
@@ -161841,12 +162831,12 @@ function doChange39(changes, sourceFile, { indexSignature, container }) {
|
|
|
161841
162831
|
}
|
|
161842
162832
|
|
|
161843
162833
|
// src/services/codefixes/removeAccidentalCallParentheses.ts
|
|
161844
|
-
var
|
|
161845
|
-
var
|
|
162834
|
+
var fixId48 = "removeAccidentalCallParentheses";
|
|
162835
|
+
var errorCodes61 = [
|
|
161846
162836
|
Diagnostics.This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without.code
|
|
161847
162837
|
];
|
|
161848
162838
|
registerCodeFix({
|
|
161849
|
-
errorCodes:
|
|
162839
|
+
errorCodes: errorCodes61,
|
|
161850
162840
|
getCodeActions(context) {
|
|
161851
162841
|
const callExpression = findAncestor(getTokenAtPosition(context.sourceFile, context.span.start), isCallExpression);
|
|
161852
162842
|
if (!callExpression) {
|
|
@@ -161855,27 +162845,27 @@ registerCodeFix({
|
|
|
161855
162845
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
|
|
161856
162846
|
t.deleteRange(context.sourceFile, { pos: callExpression.expression.end, end: callExpression.end });
|
|
161857
162847
|
});
|
|
161858
|
-
return [createCodeFixActionWithoutFixAll(
|
|
162848
|
+
return [createCodeFixActionWithoutFixAll(fixId48, changes, Diagnostics.Remove_parentheses)];
|
|
161859
162849
|
},
|
|
161860
|
-
fixIds: [
|
|
162850
|
+
fixIds: [fixId48]
|
|
161861
162851
|
});
|
|
161862
162852
|
|
|
161863
162853
|
// src/services/codefixes/removeUnnecessaryAwait.ts
|
|
161864
|
-
var
|
|
161865
|
-
var
|
|
162854
|
+
var fixId49 = "removeUnnecessaryAwait";
|
|
162855
|
+
var errorCodes62 = [
|
|
161866
162856
|
Diagnostics.await_has_no_effect_on_the_type_of_this_expression.code
|
|
161867
162857
|
];
|
|
161868
162858
|
registerCodeFix({
|
|
161869
|
-
errorCodes:
|
|
162859
|
+
errorCodes: errorCodes62,
|
|
161870
162860
|
getCodeActions: function getCodeActionsToRemoveUnnecessaryAwait(context) {
|
|
161871
162861
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange11(t, context.sourceFile, context.span));
|
|
161872
162862
|
if (changes.length > 0) {
|
|
161873
|
-
return [createCodeFixAction(
|
|
162863
|
+
return [createCodeFixAction(fixId49, changes, Diagnostics.Remove_unnecessary_await, fixId49, Diagnostics.Remove_all_unnecessary_uses_of_await)];
|
|
161874
162864
|
}
|
|
161875
162865
|
},
|
|
161876
|
-
fixIds: [
|
|
162866
|
+
fixIds: [fixId49],
|
|
161877
162867
|
getAllCodeActions: (context) => {
|
|
161878
|
-
return codeFixAll(context,
|
|
162868
|
+
return codeFixAll(context, errorCodes62, (changes, diag2) => makeChange11(changes, diag2.file, diag2));
|
|
161879
162869
|
}
|
|
161880
162870
|
});
|
|
161881
162871
|
function makeChange11(changeTracker, sourceFile, span) {
|
|
@@ -161903,20 +162893,20 @@ function makeChange11(changeTracker, sourceFile, span) {
|
|
|
161903
162893
|
}
|
|
161904
162894
|
|
|
161905
162895
|
// src/services/codefixes/splitTypeOnlyImport.ts
|
|
161906
|
-
var
|
|
161907
|
-
var
|
|
162896
|
+
var errorCodes63 = [Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both.code];
|
|
162897
|
+
var fixId50 = "splitTypeOnlyImport";
|
|
161908
162898
|
registerCodeFix({
|
|
161909
|
-
errorCodes:
|
|
161910
|
-
fixIds: [
|
|
162899
|
+
errorCodes: errorCodes63,
|
|
162900
|
+
fixIds: [fixId50],
|
|
161911
162901
|
getCodeActions: function getCodeActionsToSplitTypeOnlyImport(context) {
|
|
161912
162902
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
|
|
161913
162903
|
return splitTypeOnlyImport(t, getImportDeclaration2(context.sourceFile, context.span), context);
|
|
161914
162904
|
});
|
|
161915
162905
|
if (changes.length) {
|
|
161916
|
-
return [createCodeFixAction(
|
|
162906
|
+
return [createCodeFixAction(fixId50, changes, Diagnostics.Split_into_two_separate_import_declarations, fixId50, Diagnostics.Split_all_invalid_type_only_imports)];
|
|
161917
162907
|
}
|
|
161918
162908
|
},
|
|
161919
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
162909
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes63, (changes, error2) => {
|
|
161920
162910
|
splitTypeOnlyImport(changes, getImportDeclaration2(context.sourceFile, error2), context);
|
|
161921
162911
|
})
|
|
161922
162912
|
});
|
|
@@ -161965,23 +162955,23 @@ function splitTypeOnlyImport(changes, importDeclaration, context) {
|
|
|
161965
162955
|
}
|
|
161966
162956
|
|
|
161967
162957
|
// src/services/codefixes/convertConstToLet.ts
|
|
161968
|
-
var
|
|
161969
|
-
var
|
|
162958
|
+
var fixId51 = "fixConvertConstToLet";
|
|
162959
|
+
var errorCodes64 = [Diagnostics.Cannot_assign_to_0_because_it_is_a_constant.code];
|
|
161970
162960
|
registerCodeFix({
|
|
161971
|
-
errorCodes:
|
|
162961
|
+
errorCodes: errorCodes64,
|
|
161972
162962
|
getCodeActions: function getCodeActionsToConvertConstToLet(context) {
|
|
161973
162963
|
const { sourceFile, span, program } = context;
|
|
161974
162964
|
const info = getInfo21(sourceFile, span.start, program);
|
|
161975
162965
|
if (info === void 0)
|
|
161976
162966
|
return;
|
|
161977
162967
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange40(t, sourceFile, info.token));
|
|
161978
|
-
return [createCodeFixActionMaybeFixAll(
|
|
162968
|
+
return [createCodeFixActionMaybeFixAll(fixId51, changes, Diagnostics.Convert_const_to_let, fixId51, Diagnostics.Convert_all_const_to_let)];
|
|
161979
162969
|
},
|
|
161980
162970
|
getAllCodeActions: (context) => {
|
|
161981
162971
|
const { program } = context;
|
|
161982
162972
|
const seen = /* @__PURE__ */ new Map();
|
|
161983
162973
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
161984
|
-
eachDiagnostic(context,
|
|
162974
|
+
eachDiagnostic(context, errorCodes64, (diag2) => {
|
|
161985
162975
|
const info = getInfo21(diag2.file, diag2.start, program);
|
|
161986
162976
|
if (info) {
|
|
161987
162977
|
if (addToSeen(seen, getSymbolId(info.symbol))) {
|
|
@@ -161992,7 +162982,7 @@ registerCodeFix({
|
|
|
161992
162982
|
});
|
|
161993
162983
|
}));
|
|
161994
162984
|
},
|
|
161995
|
-
fixIds: [
|
|
162985
|
+
fixIds: [fixId51]
|
|
161996
162986
|
});
|
|
161997
162987
|
function getInfo21(sourceFile, pos, program) {
|
|
161998
162988
|
var _a;
|
|
@@ -162013,11 +163003,11 @@ function doChange40(changes, sourceFile, token) {
|
|
|
162013
163003
|
}
|
|
162014
163004
|
|
|
162015
163005
|
// src/services/codefixes/fixExpectedComma.ts
|
|
162016
|
-
var
|
|
163006
|
+
var fixId52 = "fixExpectedComma";
|
|
162017
163007
|
var expectedErrorCode = Diagnostics._0_expected.code;
|
|
162018
|
-
var
|
|
163008
|
+
var errorCodes65 = [expectedErrorCode];
|
|
162019
163009
|
registerCodeFix({
|
|
162020
|
-
errorCodes:
|
|
163010
|
+
errorCodes: errorCodes65,
|
|
162021
163011
|
getCodeActions(context) {
|
|
162022
163012
|
const { sourceFile } = context;
|
|
162023
163013
|
const info = getInfo22(sourceFile, context.span.start, context.errorCode);
|
|
@@ -162025,15 +163015,15 @@ registerCodeFix({
|
|
|
162025
163015
|
return void 0;
|
|
162026
163016
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange41(t, sourceFile, info));
|
|
162027
163017
|
return [createCodeFixAction(
|
|
162028
|
-
|
|
163018
|
+
fixId52,
|
|
162029
163019
|
changes,
|
|
162030
163020
|
[Diagnostics.Change_0_to_1, ";", ","],
|
|
162031
|
-
|
|
163021
|
+
fixId52,
|
|
162032
163022
|
[Diagnostics.Change_0_to_1, ";", ","]
|
|
162033
163023
|
)];
|
|
162034
163024
|
},
|
|
162035
|
-
fixIds: [
|
|
162036
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
163025
|
+
fixIds: [fixId52],
|
|
163026
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes65, (changes, diag2) => {
|
|
162037
163027
|
const info = getInfo22(diag2.file, diag2.start, diag2.code);
|
|
162038
163028
|
if (info)
|
|
162039
163029
|
doChange41(changes, context.sourceFile, info);
|
|
@@ -162050,22 +163040,22 @@ function doChange41(changes, sourceFile, { node }) {
|
|
|
162050
163040
|
|
|
162051
163041
|
// src/services/codefixes/fixAddVoidToPromise.ts
|
|
162052
163042
|
var fixName7 = "addVoidToPromise";
|
|
162053
|
-
var
|
|
162054
|
-
var
|
|
163043
|
+
var fixId53 = "addVoidToPromise";
|
|
163044
|
+
var errorCodes66 = [
|
|
162055
163045
|
Diagnostics.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments.code,
|
|
162056
163046
|
Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise.code
|
|
162057
163047
|
];
|
|
162058
163048
|
registerCodeFix({
|
|
162059
|
-
errorCodes:
|
|
162060
|
-
fixIds: [
|
|
163049
|
+
errorCodes: errorCodes66,
|
|
163050
|
+
fixIds: [fixId53],
|
|
162061
163051
|
getCodeActions(context) {
|
|
162062
163052
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange12(t, context.sourceFile, context.span, context.program));
|
|
162063
163053
|
if (changes.length > 0) {
|
|
162064
|
-
return [createCodeFixAction(fixName7, changes, Diagnostics.Add_void_to_Promise_resolved_without_a_value,
|
|
163054
|
+
return [createCodeFixAction(fixName7, changes, Diagnostics.Add_void_to_Promise_resolved_without_a_value, fixId53, Diagnostics.Add_void_to_all_Promises_resolved_without_a_value)];
|
|
162065
163055
|
}
|
|
162066
163056
|
},
|
|
162067
163057
|
getAllCodeActions(context) {
|
|
162068
|
-
return codeFixAll(context,
|
|
163058
|
+
return codeFixAll(context, errorCodes66, (changes, diag2) => makeChange12(changes, diag2.file, diag2, context.program, /* @__PURE__ */ new Set()));
|
|
162069
163059
|
}
|
|
162070
163060
|
});
|
|
162071
163061
|
function makeChange12(changes, sourceFile, span, program, seen) {
|
|
@@ -169395,7 +170385,7 @@ var Core;
|
|
|
169395
170385
|
baseSymbol = void 0;
|
|
169396
170386
|
}
|
|
169397
170387
|
}
|
|
169398
|
-
return search.includes(baseSymbol || rootSymbol || sym) ? { symbol: rootSymbol && !(getCheckFlags(sym) & 6 /*
|
|
170388
|
+
return search.includes(baseSymbol || rootSymbol || sym) ? { symbol: rootSymbol && !(getCheckFlags(sym) & 6 /* SyntheticMember */) ? rootSymbol : sym, kind } : void 0;
|
|
169399
170389
|
},
|
|
169400
170390
|
/*allowBaseTypes*/
|
|
169401
170391
|
(rootSymbol) => !(search.parents && !search.parents.some((parent2) => explicitlyInheritsFrom(rootSymbol.parent, parent2, state.inheritsFromCache, checker)))
|
|
@@ -173220,7 +174210,7 @@ function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeCheck
|
|
|
173220
174210
|
if (flags & 131072 /* Signature */)
|
|
173221
174211
|
return "index" /* indexSignatureElement */;
|
|
173222
174212
|
if (flags & 4 /* Property */) {
|
|
173223
|
-
if (flags & 33554432 /* Transient */ && symbol.links.checkFlags & 6 /*
|
|
174213
|
+
if (flags & 33554432 /* Transient */ && symbol.links.checkFlags & 6 /* SyntheticMember */) {
|
|
173224
174214
|
const unionPropertyKind = forEach(typeChecker.getRootSymbols(symbol), (rootSymbol) => {
|
|
173225
174215
|
const rootSymbolFlags = rootSymbol.getFlags();
|
|
173226
174216
|
if (rootSymbolFlags & (98308 /* PropertyOrAccessor */ | 3 /* Variable */)) {
|
|
@@ -173248,6 +174238,8 @@ function getNormalizedSymbolModifiers(symbol) {
|
|
|
173248
174238
|
if (modifiers) {
|
|
173249
174239
|
return modifiers.split(",");
|
|
173250
174240
|
}
|
|
174241
|
+
} else if (symbol.flags & 64 /* Interface */) {
|
|
174242
|
+
return ["declare" /* ambientModifier */];
|
|
173251
174243
|
}
|
|
173252
174244
|
return [];
|
|
173253
174245
|
}
|
|
@@ -178152,6 +179144,7 @@ __export(ts_exports2, {
|
|
|
178152
179144
|
collectExternalModuleInfo: () => collectExternalModuleInfo,
|
|
178153
179145
|
combine: () => combine,
|
|
178154
179146
|
combinePaths: () => combinePaths,
|
|
179147
|
+
commandLineOptionOfCustomType: () => commandLineOptionOfCustomType,
|
|
178155
179148
|
commentPragmas: () => commentPragmas,
|
|
178156
179149
|
commonOptionsWithBuild: () => commonOptionsWithBuild,
|
|
178157
179150
|
commonPackageFolders: () => commonPackageFolders,
|
|
@@ -178768,6 +179761,8 @@ __export(ts_exports2, {
|
|
|
178768
179761
|
getNameOfDeclaration: () => getNameOfDeclaration,
|
|
178769
179762
|
getNameOfExpando: () => getNameOfExpando,
|
|
178770
179763
|
getNameOfJSDocTypedef: () => getNameOfJSDocTypedef,
|
|
179764
|
+
getNameOfModuleKind: () => getNameOfModuleKind,
|
|
179765
|
+
getNameOfModuleResolutionKind: () => getNameOfModuleResolutionKind,
|
|
178771
179766
|
getNameOfScriptTarget: () => getNameOfScriptTarget,
|
|
178772
179767
|
getNameOrArgument: () => getNameOrArgument,
|
|
178773
179768
|
getNameTable: () => getNameTable,
|
|
@@ -179776,6 +180771,7 @@ __export(ts_exports2, {
|
|
|
179776
180771
|
moduleOptionDeclaration: () => moduleOptionDeclaration,
|
|
179777
180772
|
moduleResolutionIsEqualTo: () => moduleResolutionIsEqualTo,
|
|
179778
180773
|
moduleResolutionNameAndModeGetter: () => moduleResolutionNameAndModeGetter,
|
|
180774
|
+
moduleResolutionOptionDeclaration: () => moduleResolutionOptionDeclaration,
|
|
179779
180775
|
moduleResolutionOptionDeclarations: () => moduleResolutionOptionDeclarations,
|
|
179780
180776
|
moduleResolutionSupportsPackageJsonExportsAndImports: () => moduleResolutionSupportsPackageJsonExportsAndImports,
|
|
179781
180777
|
moduleResolutionUsesNodeModules: () => moduleResolutionUsesNodeModules,
|
|
@@ -190839,10 +191835,10 @@ ${e.message}`;
|
|
|
190839
191835
|
}
|
|
190840
191836
|
return simplifiedResult ? codeActions.map((codeAction) => this.mapCodeFixAction(codeAction)) : codeActions;
|
|
190841
191837
|
}
|
|
190842
|
-
getCombinedCodeFix({ scope, fixId:
|
|
191838
|
+
getCombinedCodeFix({ scope, fixId: fixId54 }, simplifiedResult) {
|
|
190843
191839
|
Debug.assert(scope.type === "file");
|
|
190844
191840
|
const { file, project } = this.getFileAndProject(scope.args);
|
|
190845
|
-
const res = project.getLanguageService().getCombinedCodeFix({ type: "file", fileName: file },
|
|
191841
|
+
const res = project.getLanguageService().getCombinedCodeFix({ type: "file", fileName: file }, fixId54, this.getFormatOptions(file), this.getPreferences(file));
|
|
190846
191842
|
if (simplifiedResult) {
|
|
190847
191843
|
return { changes: this.mapTextChangesToCodeEdits(res.changes), commands: res.commands };
|
|
190848
191844
|
} else {
|
|
@@ -190881,8 +191877,8 @@ ${e.message}`;
|
|
|
190881
191877
|
mapCodeAction({ description: description3, changes, commands }) {
|
|
190882
191878
|
return { description: description3, changes: this.mapTextChangesToCodeEdits(changes), commands };
|
|
190883
191879
|
}
|
|
190884
|
-
mapCodeFixAction({ fixName: fixName8, description: description3, changes, commands, fixId:
|
|
190885
|
-
return { fixName: fixName8, description: description3, changes: this.mapTextChangesToCodeEdits(changes), commands, fixId:
|
|
191880
|
+
mapCodeFixAction({ fixName: fixName8, description: description3, changes, commands, fixId: fixId54, fixAllDescription }) {
|
|
191881
|
+
return { fixName: fixName8, description: description3, changes: this.mapTextChangesToCodeEdits(changes), commands, fixId: fixId54, fixAllDescription };
|
|
190886
191882
|
}
|
|
190887
191883
|
mapTextChangesToCodeEdits(textChanges2) {
|
|
190888
191884
|
return textChanges2.map((change) => this.mapTextChangeToCodeEdit(change));
|
|
@@ -192580,6 +193576,7 @@ if (typeof console !== "undefined") {
|
|
|
192580
193576
|
collectExternalModuleInfo,
|
|
192581
193577
|
combine,
|
|
192582
193578
|
combinePaths,
|
|
193579
|
+
commandLineOptionOfCustomType,
|
|
192583
193580
|
commentPragmas,
|
|
192584
193581
|
commonOptionsWithBuild,
|
|
192585
193582
|
commonPackageFolders,
|
|
@@ -193196,6 +194193,8 @@ if (typeof console !== "undefined") {
|
|
|
193196
194193
|
getNameOfDeclaration,
|
|
193197
194194
|
getNameOfExpando,
|
|
193198
194195
|
getNameOfJSDocTypedef,
|
|
194196
|
+
getNameOfModuleKind,
|
|
194197
|
+
getNameOfModuleResolutionKind,
|
|
193199
194198
|
getNameOfScriptTarget,
|
|
193200
194199
|
getNameOrArgument,
|
|
193201
194200
|
getNameTable,
|
|
@@ -194204,6 +195203,7 @@ if (typeof console !== "undefined") {
|
|
|
194204
195203
|
moduleOptionDeclaration,
|
|
194205
195204
|
moduleResolutionIsEqualTo,
|
|
194206
195205
|
moduleResolutionNameAndModeGetter,
|
|
195206
|
+
moduleResolutionOptionDeclaration,
|
|
194207
195207
|
moduleResolutionOptionDeclarations,
|
|
194208
195208
|
moduleResolutionSupportsPackageJsonExportsAndImports,
|
|
194209
195209
|
moduleResolutionUsesNodeModules,
|