@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/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.5";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240501`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -7716,6 +7716,16 @@ var Diagnostics = {
|
|
|
7716
7716
|
Export_0_from_module_1: diag(90059, 3 /* Message */, "Export_0_from_module_1_90059", "Export '{0}' from module '{1}'"),
|
|
7717
7717
|
Export_all_referenced_locals: diag(90060, 3 /* Message */, "Export_all_referenced_locals_90060", "Export all referenced locals"),
|
|
7718
7718
|
Update_modifiers_of_0: diag(90061, 3 /* Message */, "Update_modifiers_of_0_90061", "Update modifiers of '{0}'"),
|
|
7719
|
+
Add_annotation_of_type_0: diag(90062, 3 /* Message */, "Add_annotation_of_type_0_90062", "Add annotation of type '{0}'"),
|
|
7720
|
+
Add_return_type_0: diag(90063, 3 /* Message */, "Add_return_type_0_90063", "Add return type '{0}'"),
|
|
7721
|
+
Extract_base_class_to_variable: diag(90064, 3 /* Message */, "Extract_base_class_to_variable_90064", "Extract base class to variable"),
|
|
7722
|
+
Extract_default_export_to_variable: diag(90065, 3 /* Message */, "Extract_default_export_to_variable_90065", "Extract default export to variable"),
|
|
7723
|
+
Extract_binding_expressions_to_variable: diag(90066, 3 /* Message */, "Extract_binding_expressions_to_variable_90066", "Extract binding expressions to variable"),
|
|
7724
|
+
Add_all_missing_type_annotations: diag(90067, 3 /* Message */, "Add_all_missing_type_annotations_90067", "Add all missing type annotations"),
|
|
7725
|
+
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}'"),
|
|
7726
|
+
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}'"),
|
|
7727
|
+
Mark_array_literal_as_const: diag(90070, 3 /* Message */, "Mark_array_literal_as_const_90070", "Mark array literal as const"),
|
|
7728
|
+
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"),
|
|
7719
7729
|
Convert_function_to_an_ES2015_class: diag(95001, 3 /* Message */, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
|
|
7720
7730
|
Convert_0_to_1_in_0: diag(95003, 3 /* Message */, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
|
|
7721
7731
|
Extract_to_0_in_1: diag(95004, 3 /* Message */, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
|
|
@@ -13524,7 +13534,7 @@ function entityNameToString(name) {
|
|
|
13524
13534
|
return Debug.assertNever(name.name);
|
|
13525
13535
|
}
|
|
13526
13536
|
case 311 /* JSDocMemberName */:
|
|
13527
|
-
return entityNameToString(name.left) + entityNameToString(name.right);
|
|
13537
|
+
return entityNameToString(name.left) + "#" + entityNameToString(name.right);
|
|
13528
13538
|
case 295 /* JsxNamespacedName */:
|
|
13529
13539
|
return entityNameToString(name.namespace) + ":" + entityNameToString(name.name);
|
|
13530
13540
|
default:
|
|
@@ -17026,7 +17036,7 @@ function getDeclarationModifierFlagsFromSymbol(s, isWrite = false) {
|
|
|
17026
17036
|
const flags = getCombinedModifierFlags(declaration);
|
|
17027
17037
|
return s.parent && s.parent.flags & 32 /* Class */ ? flags : flags & ~7 /* AccessibilityModifier */;
|
|
17028
17038
|
}
|
|
17029
|
-
if (getCheckFlags(s) & 6 /*
|
|
17039
|
+
if (getCheckFlags(s) & 6 /* SyntheticMember */) {
|
|
17030
17040
|
const checkFlags = s.links.checkFlags;
|
|
17031
17041
|
const accessModifier = checkFlags & 1024 /* ContainsPrivate */ ? 2 /* Private */ : checkFlags & 256 /* ContainsPublic */ ? 1 /* Public */ : 4 /* Protected */;
|
|
17032
17042
|
const staticModifier = checkFlags & 2048 /* ContainsStatic */ ? 256 /* Static */ : 0;
|
|
@@ -17822,7 +17832,19 @@ function getStrictOptionValue(compilerOptions, flag) {
|
|
|
17822
17832
|
return compilerOptions[flag] === void 0 ? !!compilerOptions.strict : !!compilerOptions[flag];
|
|
17823
17833
|
}
|
|
17824
17834
|
function getNameOfScriptTarget(scriptTarget) {
|
|
17825
|
-
|
|
17835
|
+
const entries = [...targetOptionDeclaration.type].reverse();
|
|
17836
|
+
return forEach(entries, ([key, value]) => value === scriptTarget ? key : void 0);
|
|
17837
|
+
}
|
|
17838
|
+
function getNameOfModuleKind(moduleKind) {
|
|
17839
|
+
const entries = [...moduleOptionDeclaration.type].reverse();
|
|
17840
|
+
return forEach(entries, ([key, value]) => value === moduleKind ? key : void 0);
|
|
17841
|
+
}
|
|
17842
|
+
function getNameOfModuleResolutionKind(moduleResolution) {
|
|
17843
|
+
if (moduleResolution === 2 /* Node10 */) {
|
|
17844
|
+
return "node10";
|
|
17845
|
+
}
|
|
17846
|
+
const entries = [...moduleResolutionOptionDeclaration.type].reverse();
|
|
17847
|
+
return forEach(entries, ([key, value]) => value === moduleResolution ? key : void 0);
|
|
17826
17848
|
}
|
|
17827
17849
|
function getEmitStandardClassFields(compilerOptions) {
|
|
17828
17850
|
return compilerOptions.useDefineForClassFields !== false && getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */;
|
|
@@ -35930,6 +35952,25 @@ var moduleOptionDeclaration = {
|
|
|
35930
35952
|
description: Diagnostics.Specify_what_module_code_is_generated,
|
|
35931
35953
|
defaultValueDescription: void 0
|
|
35932
35954
|
};
|
|
35955
|
+
var moduleResolutionOptionDeclaration = {
|
|
35956
|
+
name: "moduleResolution",
|
|
35957
|
+
type: new Map(Object.entries({
|
|
35958
|
+
// N.B. The first entry specifies the value shown in `tsc --init`
|
|
35959
|
+
node10: 2 /* Node10 */,
|
|
35960
|
+
node: 2 /* Node10 */,
|
|
35961
|
+
classic: 1 /* Classic */,
|
|
35962
|
+
node16: 3 /* Node16 */,
|
|
35963
|
+
nodenext: 99 /* NodeNext */,
|
|
35964
|
+
bundler: 100 /* Bundler */
|
|
35965
|
+
})),
|
|
35966
|
+
deprecatedKeys: /* @__PURE__ */ new Set(["node"]),
|
|
35967
|
+
affectsSourceFile: true,
|
|
35968
|
+
affectsModuleResolution: true,
|
|
35969
|
+
paramType: Diagnostics.STRATEGY,
|
|
35970
|
+
category: Diagnostics.Modules,
|
|
35971
|
+
description: Diagnostics.Specify_how_TypeScript_looks_up_a_file_from_a_given_module_specifier,
|
|
35972
|
+
defaultValueDescription: Diagnostics.module_AMD_or_UMD_or_System_or_ES6_then_Classic_Otherwise_Node
|
|
35973
|
+
};
|
|
35933
35974
|
var commandOptionsWithoutBuild = [
|
|
35934
35975
|
// CommandLine only options
|
|
35935
35976
|
{
|
|
@@ -36371,25 +36412,7 @@ var commandOptionsWithoutBuild = [
|
|
|
36371
36412
|
defaultValueDescription: false
|
|
36372
36413
|
},
|
|
36373
36414
|
// Module Resolution
|
|
36374
|
-
|
|
36375
|
-
name: "moduleResolution",
|
|
36376
|
-
type: new Map(Object.entries({
|
|
36377
|
-
// N.B. The first entry specifies the value shown in `tsc --init`
|
|
36378
|
-
node10: 2 /* Node10 */,
|
|
36379
|
-
node: 2 /* Node10 */,
|
|
36380
|
-
classic: 1 /* Classic */,
|
|
36381
|
-
node16: 3 /* Node16 */,
|
|
36382
|
-
nodenext: 99 /* NodeNext */,
|
|
36383
|
-
bundler: 100 /* Bundler */
|
|
36384
|
-
})),
|
|
36385
|
-
deprecatedKeys: /* @__PURE__ */ new Set(["node"]),
|
|
36386
|
-
affectsSourceFile: true,
|
|
36387
|
-
affectsModuleResolution: true,
|
|
36388
|
-
paramType: Diagnostics.STRATEGY,
|
|
36389
|
-
category: Diagnostics.Modules,
|
|
36390
|
-
description: Diagnostics.Specify_how_TypeScript_looks_up_a_file_from_a_given_module_specifier,
|
|
36391
|
-
defaultValueDescription: Diagnostics.module_AMD_or_UMD_or_System_or_ES6_then_Classic_Otherwise_Node
|
|
36392
|
-
},
|
|
36415
|
+
moduleResolutionOptionDeclaration,
|
|
36393
36416
|
{
|
|
36394
36417
|
name: "baseUrl",
|
|
36395
36418
|
type: "string",
|
|
@@ -36958,6 +36981,10 @@ var configDirTemplateSubstitutionOptions = optionDeclarations.filter(
|
|
|
36958
36981
|
var configDirTemplateSubstitutionWatchOptions = optionsForWatch.filter(
|
|
36959
36982
|
(option) => option.allowConfigDirTemplateSubstitution || !option.isCommandLineOnly && option.isFilePath
|
|
36960
36983
|
);
|
|
36984
|
+
var commandLineOptionOfCustomType = optionDeclarations.filter(isCommandLineOptionOfCustomType);
|
|
36985
|
+
function isCommandLineOptionOfCustomType(option) {
|
|
36986
|
+
return !isString(option.type);
|
|
36987
|
+
}
|
|
36961
36988
|
var optionsForBuild = [
|
|
36962
36989
|
{
|
|
36963
36990
|
name: "verbose",
|
|
@@ -45401,6 +45428,7 @@ function isInstantiatedModule(node, preserveConstEnums) {
|
|
|
45401
45428
|
return moduleState === 1 /* Instantiated */ || preserveConstEnums && moduleState === 2 /* ConstEnumOnly */;
|
|
45402
45429
|
}
|
|
45403
45430
|
function createTypeChecker(host) {
|
|
45431
|
+
var _a;
|
|
45404
45432
|
var deferredDiagnosticsCallbacks = [];
|
|
45405
45433
|
var addLazyDiagnostic = (arg) => {
|
|
45406
45434
|
deferredDiagnosticsCallbacks.push(arg);
|
|
@@ -45427,6 +45455,7 @@ function createTypeChecker(host) {
|
|
|
45427
45455
|
var compilerOptions = host.getCompilerOptions();
|
|
45428
45456
|
var languageVersion = getEmitScriptTarget(compilerOptions);
|
|
45429
45457
|
var moduleKind = getEmitModuleKind(compilerOptions);
|
|
45458
|
+
var moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
45430
45459
|
var legacyDecorators = !!compilerOptions.experimentalDecorators;
|
|
45431
45460
|
var useDefineForClassFields = getUseDefineForClassFields(compilerOptions);
|
|
45432
45461
|
var emitStandardClassFields = getEmitStandardClassFields(compilerOptions);
|
|
@@ -45439,6 +45468,7 @@ function createTypeChecker(host) {
|
|
|
45439
45468
|
var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
|
|
45440
45469
|
var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
|
|
45441
45470
|
var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
|
|
45471
|
+
var noUncheckedIndexedAccess = compilerOptions.noUncheckedIndexedAccess;
|
|
45442
45472
|
var checkBinaryExpression = createCheckBinaryExpression();
|
|
45443
45473
|
var emitResolver = createResolver();
|
|
45444
45474
|
var nodeBuilder = createNodeBuilder();
|
|
@@ -45553,6 +45583,7 @@ function createTypeChecker(host) {
|
|
|
45553
45583
|
getBaseTypes,
|
|
45554
45584
|
getBaseTypeOfLiteralType,
|
|
45555
45585
|
getWidenedType,
|
|
45586
|
+
getWidenedLiteralType,
|
|
45556
45587
|
getTypeFromTypeNode: (nodeIn) => {
|
|
45557
45588
|
const node = getParseTreeNode(nodeIn, isTypeNode);
|
|
45558
45589
|
return node ? getTypeFromTypeNode(node) : errorType;
|
|
@@ -45781,14 +45812,6 @@ function createTypeChecker(host) {
|
|
|
45781
45812
|
return void 0;
|
|
45782
45813
|
return type;
|
|
45783
45814
|
},
|
|
45784
|
-
createTypeReference: (target, typeArguments) => {
|
|
45785
|
-
if (target !== emptyGenericType && getObjectFlags(target) & 3 /* ClassOrInterface */) {
|
|
45786
|
-
const interfaceType = target;
|
|
45787
|
-
if (some(interfaceType.typeParameters)) {
|
|
45788
|
-
return createTypeReference(interfaceType, typeArguments);
|
|
45789
|
-
}
|
|
45790
|
-
}
|
|
45791
|
-
},
|
|
45792
45815
|
isSymbolAccessible,
|
|
45793
45816
|
isArrayType,
|
|
45794
45817
|
isTupleType,
|
|
@@ -46259,6 +46282,7 @@ function createTypeChecker(host) {
|
|
|
46259
46282
|
};
|
|
46260
46283
|
var anyIterationTypes = createIterationTypes(anyType, anyType, anyType);
|
|
46261
46284
|
var anyIterationTypesExceptNext = createIterationTypes(anyType, anyType, unknownType);
|
|
46285
|
+
var defaultIterationTypes = createIterationTypes(neverType, anyType, undefinedType);
|
|
46262
46286
|
var asyncIterationTypesResolver = {
|
|
46263
46287
|
iterableCacheKey: "iterationTypesOfAsyncIterable",
|
|
46264
46288
|
iteratorCacheKey: "iterationTypesOfAsyncIterator",
|
|
@@ -46412,6 +46436,32 @@ function createTypeChecker(host) {
|
|
|
46412
46436
|
[".jsx", ".jsx"],
|
|
46413
46437
|
[".json", ".json"]
|
|
46414
46438
|
];
|
|
46439
|
+
var typeScriptSettingsSymbol = createSymbol(64 /* Interface */, "TypeScriptSettings", 2097152 /* SyntheticInterface */);
|
|
46440
|
+
typeScriptSettingsSymbol.declarations = [];
|
|
46441
|
+
typeScriptSettingsSymbol.members = createSymbolTable([
|
|
46442
|
+
createProperty("version", getStringLiteralType(version), 8 /* Readonly */),
|
|
46443
|
+
createProperty("versionMajorMinor", getStringLiteralType(versionMajorMinor), 8 /* Readonly */),
|
|
46444
|
+
createProperty("locale", compilerOptions.locale ? getStringLiteralType(compilerOptions.locale) : undefinedType, 8 /* Readonly */),
|
|
46445
|
+
createProperty("target", getStringLiteralType(getNameOfScriptTarget(languageVersion) ?? ""), 8 /* Readonly */),
|
|
46446
|
+
createProperty("module", getStringLiteralType(getNameOfModuleKind(moduleKind) ?? ""), 8 /* Readonly */),
|
|
46447
|
+
createProperty("moduleResolution", getStringLiteralType(getNameOfModuleResolutionKind(moduleResolutionKind) ?? ""), 8 /* Readonly */),
|
|
46448
|
+
createProperty("customConditions", createTupleType(
|
|
46449
|
+
((_a = compilerOptions.customConditions) == null ? void 0 : _a.map((cond) => getStringLiteralType(cond))) ?? emptyArray,
|
|
46450
|
+
/*elementFlags*/
|
|
46451
|
+
void 0,
|
|
46452
|
+
/*readonly*/
|
|
46453
|
+
true
|
|
46454
|
+
), 8 /* Readonly */),
|
|
46455
|
+
createProperty("esModuleInterop", getESModuleInterop(compilerOptions) ? trueType : falseType, 8 /* Readonly */),
|
|
46456
|
+
createProperty("exactOptionalPropertyTypes", exactOptionalPropertyTypes ? trueType : falseType, 8 /* Readonly */),
|
|
46457
|
+
createProperty("noImplicitAny", noImplicitAny ? trueType : falseType, 8 /* Readonly */),
|
|
46458
|
+
createProperty("noUncheckedIndexedAccess", noUncheckedIndexedAccess ? trueType : falseType, 8 /* Readonly */),
|
|
46459
|
+
createProperty("strictBindCallApply", strictBindCallApply ? trueType : falseType, 8 /* Readonly */),
|
|
46460
|
+
createProperty("strictFunctionTypes", strictFunctionTypes ? trueType : falseType, 8 /* Readonly */),
|
|
46461
|
+
createProperty("strictNullChecks", strictNullChecks ? trueType : falseType, 8 /* Readonly */),
|
|
46462
|
+
createProperty("useDefineForClassFields", useDefineForClassFields ? trueType : falseType, 8 /* Readonly */)
|
|
46463
|
+
]);
|
|
46464
|
+
globals.set(typeScriptSettingsSymbol.escapedName, typeScriptSettingsSymbol);
|
|
46415
46465
|
initializeTypeChecker();
|
|
46416
46466
|
return checker;
|
|
46417
46467
|
function getCachedType(key) {
|
|
@@ -46586,8 +46636,8 @@ function createTypeChecker(host) {
|
|
|
46586
46636
|
symbol.links.type = type;
|
|
46587
46637
|
return symbol;
|
|
46588
46638
|
}
|
|
46589
|
-
function createProperty(name, type) {
|
|
46590
|
-
const symbol = createSymbol(4 /* Property */, name);
|
|
46639
|
+
function createProperty(name, type, checkFlags) {
|
|
46640
|
+
const symbol = createSymbol(4 /* Property */, name, checkFlags);
|
|
46591
46641
|
symbol.links.type = type;
|
|
46592
46642
|
return symbol;
|
|
46593
46643
|
}
|
|
@@ -46769,9 +46819,9 @@ function createTypeChecker(host) {
|
|
|
46769
46819
|
});
|
|
46770
46820
|
}
|
|
46771
46821
|
function mergeModuleAugmentation(moduleName) {
|
|
46772
|
-
var
|
|
46822
|
+
var _a2, _b, _c;
|
|
46773
46823
|
const moduleAugmentation = moduleName.parent;
|
|
46774
|
-
if (((
|
|
46824
|
+
if (((_a2 = moduleAugmentation.symbol.declarations) == null ? void 0 : _a2[0]) !== moduleAugmentation) {
|
|
46775
46825
|
Debug.assert(moduleAugmentation.symbol.declarations.length > 1);
|
|
46776
46826
|
return;
|
|
46777
46827
|
}
|
|
@@ -47084,7 +47134,7 @@ function createTypeChecker(host) {
|
|
|
47084
47134
|
}
|
|
47085
47135
|
function onSuccessfullyResolvedSymbol(errorLocation, result, meaning, lastLocation, associatedDeclarationForContainingInitializerOrBindingName, withinDeferredContext) {
|
|
47086
47136
|
addLazyDiagnostic(() => {
|
|
47087
|
-
var
|
|
47137
|
+
var _a2;
|
|
47088
47138
|
const name = result.escapedName;
|
|
47089
47139
|
const isInExternalModule = lastLocation && isSourceFile(lastLocation) && isExternalOrCommonJsModule(lastLocation);
|
|
47090
47140
|
if (errorLocation && (meaning & 2 /* BlockScopedVariable */ || (meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */)) {
|
|
@@ -47124,7 +47174,7 @@ function createTypeChecker(host) {
|
|
|
47124
47174
|
const isGlobal = getSymbol(globals, name, meaning) === result;
|
|
47125
47175
|
const nonValueSymbol = isGlobal && isSourceFile(lastLocation) && lastLocation.locals && getSymbol(lastLocation.locals, name, ~111551 /* Value */);
|
|
47126
47176
|
if (nonValueSymbol) {
|
|
47127
|
-
const importDecl = (
|
|
47177
|
+
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 */);
|
|
47128
47178
|
if (importDecl && !isTypeOnlyImportDeclaration(importDecl)) {
|
|
47129
47179
|
error(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));
|
|
47130
47180
|
}
|
|
@@ -47375,12 +47425,12 @@ function createTypeChecker(host) {
|
|
|
47375
47425
|
return false;
|
|
47376
47426
|
}
|
|
47377
47427
|
function checkResolvedBlockScopedVariable(result, errorLocation) {
|
|
47378
|
-
var
|
|
47428
|
+
var _a2;
|
|
47379
47429
|
Debug.assert(!!(result.flags & 2 /* BlockScopedVariable */ || result.flags & 32 /* Class */ || result.flags & 384 /* Enum */));
|
|
47380
47430
|
if (result.flags & (16 /* Function */ | 1 /* FunctionScopedVariable */ | 67108864 /* Assignment */) && result.flags & 32 /* Class */) {
|
|
47381
47431
|
return;
|
|
47382
47432
|
}
|
|
47383
|
-
const declaration = (
|
|
47433
|
+
const declaration = (_a2 = result.declarations) == null ? void 0 : _a2.find(
|
|
47384
47434
|
(d) => isBlockOrCatchScoped(d) || isClassLike(d) || d.kind === 266 /* EnumDeclaration */
|
|
47385
47435
|
);
|
|
47386
47436
|
if (declaration === void 0)
|
|
@@ -47562,14 +47612,14 @@ function createTypeChecker(host) {
|
|
|
47562
47612
|
}
|
|
47563
47613
|
}
|
|
47564
47614
|
function getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias) {
|
|
47565
|
-
var
|
|
47615
|
+
var _a2;
|
|
47566
47616
|
let exportDefaultSymbol;
|
|
47567
47617
|
if (isShorthandAmbientModuleSymbol(moduleSymbol)) {
|
|
47568
47618
|
exportDefaultSymbol = moduleSymbol;
|
|
47569
47619
|
} else {
|
|
47570
47620
|
exportDefaultSymbol = resolveExportByName(moduleSymbol, "default" /* Default */, node, dontResolveAlias);
|
|
47571
47621
|
}
|
|
47572
|
-
const file = (
|
|
47622
|
+
const file = (_a2 = moduleSymbol.declarations) == null ? void 0 : _a2.find(isSourceFile);
|
|
47573
47623
|
const specifier = getModuleSpecifierForImportOrExport(node);
|
|
47574
47624
|
if (!specifier) {
|
|
47575
47625
|
return exportDefaultSymbol;
|
|
@@ -47635,8 +47685,8 @@ function createTypeChecker(host) {
|
|
|
47635
47685
|
}
|
|
47636
47686
|
}
|
|
47637
47687
|
function reportNonDefaultExport(moduleSymbol, node) {
|
|
47638
|
-
var
|
|
47639
|
-
if ((
|
|
47688
|
+
var _a2, _b, _c;
|
|
47689
|
+
if ((_a2 = moduleSymbol.exports) == null ? void 0 : _a2.has(node.symbol.escapedName)) {
|
|
47640
47690
|
error(
|
|
47641
47691
|
node.name,
|
|
47642
47692
|
Diagnostics.Module_0_has_no_default_export_Did_you_mean_to_use_import_1_from_0_instead,
|
|
@@ -47649,8 +47699,8 @@ function createTypeChecker(host) {
|
|
|
47649
47699
|
if (exportStar) {
|
|
47650
47700
|
const defaultExport = (_c = exportStar.declarations) == null ? void 0 : _c.find(
|
|
47651
47701
|
(decl) => {
|
|
47652
|
-
var
|
|
47653
|
-
return !!(isExportDeclaration(decl) && decl.moduleSpecifier && ((_b2 = (
|
|
47702
|
+
var _a3, _b2;
|
|
47703
|
+
return !!(isExportDeclaration(decl) && decl.moduleSpecifier && ((_b2 = (_a3 = resolveExternalModuleName(decl, decl.moduleSpecifier)) == null ? void 0 : _a3.exports) == null ? void 0 : _b2.has("default" /* Default */)));
|
|
47654
47704
|
}
|
|
47655
47705
|
);
|
|
47656
47706
|
if (defaultExport) {
|
|
@@ -47717,11 +47767,11 @@ function createTypeChecker(host) {
|
|
|
47717
47767
|
return result;
|
|
47718
47768
|
}
|
|
47719
47769
|
function getExportOfModule(symbol, name, specifier, dontResolveAlias) {
|
|
47720
|
-
var
|
|
47770
|
+
var _a2;
|
|
47721
47771
|
if (symbol.flags & 1536 /* Module */) {
|
|
47722
47772
|
const exportSymbol = getExportsOfSymbol(symbol).get(name.escapedText);
|
|
47723
47773
|
const resolved = resolveSymbol(exportSymbol, dontResolveAlias);
|
|
47724
|
-
const exportStarDeclaration = (
|
|
47774
|
+
const exportStarDeclaration = (_a2 = getSymbolLinks(symbol).typeOnlyExportStarMap) == null ? void 0 : _a2.get(name.escapedText);
|
|
47725
47775
|
markSymbolOfAliasDeclarationIfTypeOnly(
|
|
47726
47776
|
specifier,
|
|
47727
47777
|
exportSymbol,
|
|
@@ -47743,7 +47793,7 @@ function createTypeChecker(host) {
|
|
|
47743
47793
|
}
|
|
47744
47794
|
}
|
|
47745
47795
|
function getExternalModuleMember(node, specifier, dontResolveAlias = false) {
|
|
47746
|
-
var
|
|
47796
|
+
var _a2;
|
|
47747
47797
|
const moduleSpecifier = getExternalModuleRequireArgument(node) || node.moduleSpecifier;
|
|
47748
47798
|
const moduleSymbol = resolveExternalModuleName(node, moduleSpecifier);
|
|
47749
47799
|
const name = !isPropertyAccessExpression(specifier) && specifier.propertyName || specifier.name;
|
|
@@ -47777,7 +47827,7 @@ function createTypeChecker(host) {
|
|
|
47777
47827
|
symbolFromVariable = resolveSymbol(symbolFromVariable, dontResolveAlias);
|
|
47778
47828
|
let symbolFromModule = getExportOfModule(targetSymbol, name, specifier, dontResolveAlias);
|
|
47779
47829
|
if (symbolFromModule === void 0 && name.escapedText === "default" /* Default */) {
|
|
47780
|
-
const file = (
|
|
47830
|
+
const file = (_a2 = moduleSymbol.declarations) == null ? void 0 : _a2.find(isSourceFile);
|
|
47781
47831
|
if (isOnlyImportableAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
47782
47832
|
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
47783
47833
|
}
|
|
@@ -47791,7 +47841,7 @@ function createTypeChecker(host) {
|
|
|
47791
47841
|
}
|
|
47792
47842
|
}
|
|
47793
47843
|
function errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name) {
|
|
47794
|
-
var
|
|
47844
|
+
var _a2;
|
|
47795
47845
|
const moduleName = getFullyQualifiedName(moduleSymbol, node);
|
|
47796
47846
|
const declarationName = declarationNameToString(name);
|
|
47797
47847
|
const suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
|
|
@@ -47802,7 +47852,7 @@ function createTypeChecker(host) {
|
|
|
47802
47852
|
addRelatedInfo(diagnostic, createDiagnosticForNode(suggestion.valueDeclaration, Diagnostics._0_is_declared_here, suggestionName));
|
|
47803
47853
|
}
|
|
47804
47854
|
} else {
|
|
47805
|
-
if ((
|
|
47855
|
+
if ((_a2 = moduleSymbol.exports) == null ? void 0 : _a2.has("default" /* Default */)) {
|
|
47806
47856
|
error(
|
|
47807
47857
|
name,
|
|
47808
47858
|
Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead,
|
|
@@ -47815,8 +47865,8 @@ function createTypeChecker(host) {
|
|
|
47815
47865
|
}
|
|
47816
47866
|
}
|
|
47817
47867
|
function reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName) {
|
|
47818
|
-
var
|
|
47819
|
-
const localSymbol = (_b = (
|
|
47868
|
+
var _a2, _b;
|
|
47869
|
+
const localSymbol = (_b = (_a2 = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _a2.locals) == null ? void 0 : _b.get(name.escapedText);
|
|
47820
47870
|
const exports2 = moduleSymbol.exports;
|
|
47821
47871
|
if (localSymbol) {
|
|
47822
47872
|
const exportedEqualsSymbol = exports2 == null ? void 0 : exports2.get("export=" /* ExportEquals */);
|
|
@@ -48083,9 +48133,9 @@ function createTypeChecker(host) {
|
|
|
48083
48133
|
return markSymbolOfAliasDeclarationIfTypeOnlyWorker(links, immediateTarget, overwriteEmpty) || markSymbolOfAliasDeclarationIfTypeOnlyWorker(links, finalTarget, overwriteEmpty);
|
|
48084
48134
|
}
|
|
48085
48135
|
function markSymbolOfAliasDeclarationIfTypeOnlyWorker(aliasDeclarationLinks, target, overwriteEmpty) {
|
|
48086
|
-
var
|
|
48136
|
+
var _a2;
|
|
48087
48137
|
if (target && (aliasDeclarationLinks.typeOnlyDeclaration === void 0 || overwriteEmpty && aliasDeclarationLinks.typeOnlyDeclaration === false)) {
|
|
48088
|
-
const exportSymbol = ((
|
|
48138
|
+
const exportSymbol = ((_a2 = target.exports) == null ? void 0 : _a2.get("export=" /* ExportEquals */)) ?? target;
|
|
48089
48139
|
const typeOnly = exportSymbol.declarations && find(exportSymbol.declarations, isTypeOnlyImportOrExportDeclaration);
|
|
48090
48140
|
aliasDeclarationLinks.typeOnlyDeclaration = typeOnly ?? getSymbolLinks(exportSymbol).typeOnlyDeclaration ?? false;
|
|
48091
48141
|
}
|
|
@@ -48382,7 +48432,7 @@ function createTypeChecker(host) {
|
|
|
48382
48432
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
|
|
48383
48433
|
}
|
|
48384
48434
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
48385
|
-
var
|
|
48435
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
48386
48436
|
if (startsWith(moduleReference, "@types/")) {
|
|
48387
48437
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
48388
48438
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -48397,13 +48447,13 @@ function createTypeChecker(host) {
|
|
|
48397
48447
|
return ambientModule;
|
|
48398
48448
|
}
|
|
48399
48449
|
const currentSourceFile = getSourceFileOfNode(location);
|
|
48400
|
-
const contextSpecifier = isStringLiteralLike(location) ? location : ((
|
|
48450
|
+
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(
|
|
48401
48451
|
location.initializer,
|
|
48402
48452
|
/*requireStringLiteralLikeArgument*/
|
|
48403
48453
|
true
|
|
48404
48454
|
) ? 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);
|
|
48405
48455
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : host.getDefaultResolutionModeForFile(currentSourceFile);
|
|
48406
|
-
const
|
|
48456
|
+
const moduleResolutionKind2 = getEmitModuleResolutionKind(compilerOptions);
|
|
48407
48457
|
const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
|
|
48408
48458
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
48409
48459
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -48439,7 +48489,7 @@ function createTypeChecker(host) {
|
|
|
48439
48489
|
moduleReference
|
|
48440
48490
|
);
|
|
48441
48491
|
}
|
|
48442
|
-
if (
|
|
48492
|
+
if (moduleResolutionKind2 === 3 /* Node16 */ || moduleResolutionKind2 === 99 /* NodeNext */) {
|
|
48443
48493
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
48444
48494
|
const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
48445
48495
|
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !hasResolutionModeOverride(overrideHost)) {
|
|
@@ -48543,8 +48593,8 @@ function createTypeChecker(host) {
|
|
|
48543
48593
|
error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
48544
48594
|
} else {
|
|
48545
48595
|
const isExtensionlessRelativePathImport = pathIsRelative(moduleReference) && !hasExtension(moduleReference);
|
|
48546
|
-
const resolutionIsNode16OrNext =
|
|
48547
|
-
if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) &&
|
|
48596
|
+
const resolutionIsNode16OrNext = moduleResolutionKind2 === 3 /* Node16 */ || moduleResolutionKind2 === 99 /* NodeNext */;
|
|
48597
|
+
if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind2 !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
48548
48598
|
error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
48549
48599
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
48550
48600
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
@@ -48630,7 +48680,7 @@ function createTypeChecker(host) {
|
|
|
48630
48680
|
return links.cjsExportMerged = merged;
|
|
48631
48681
|
}
|
|
48632
48682
|
function resolveESModuleSymbol(moduleSymbol, referencingLocation, dontResolveAlias, suppressInteropError) {
|
|
48633
|
-
var
|
|
48683
|
+
var _a2;
|
|
48634
48684
|
const symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias);
|
|
48635
48685
|
if (!dontResolveAlias && symbol) {
|
|
48636
48686
|
if (!suppressInteropError && !(symbol.flags & (1536 /* Module */ | 3 /* Variable */)) && !getDeclarationOfKind(symbol, 307 /* SourceFile */)) {
|
|
@@ -48646,7 +48696,7 @@ function createTypeChecker(host) {
|
|
|
48646
48696
|
if (defaultOnlyType) {
|
|
48647
48697
|
return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent);
|
|
48648
48698
|
}
|
|
48649
|
-
const targetFile = (
|
|
48699
|
+
const targetFile = (_a2 = moduleSymbol == null ? void 0 : moduleSymbol.declarations) == null ? void 0 : _a2.find(isSourceFile);
|
|
48650
48700
|
const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(getEmitSyntaxForModuleSpecifierExpression(reference), host.getImpliedNodeFormatForEmit(targetFile));
|
|
48651
48701
|
if (getESModuleInterop(compilerOptions) || isEsmCjsRef) {
|
|
48652
48702
|
let sigs = getSignaturesOfStructuredType(type, 0 /* Call */);
|
|
@@ -48855,8 +48905,8 @@ function createTypeChecker(host) {
|
|
|
48855
48905
|
return getMergedSymbol(symbol.parent && getLateBoundSymbol(symbol.parent));
|
|
48856
48906
|
}
|
|
48857
48907
|
function getFunctionExpressionParentSymbolOrSymbol(symbol) {
|
|
48858
|
-
var
|
|
48859
|
-
return ((
|
|
48908
|
+
var _a2, _b;
|
|
48909
|
+
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;
|
|
48860
48910
|
}
|
|
48861
48911
|
function getAlternativeContainingModules(symbol, enclosingDeclaration) {
|
|
48862
48912
|
const containingFile = getSourceFileOfNode(enclosingDeclaration);
|
|
@@ -49010,11 +49060,11 @@ function createTypeChecker(host) {
|
|
|
49010
49060
|
return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && getSymbolFlags(symbol, !includeTypeOnlyMembers) & 111551 /* Value */);
|
|
49011
49061
|
}
|
|
49012
49062
|
function createType(flags) {
|
|
49013
|
-
var
|
|
49063
|
+
var _a2;
|
|
49014
49064
|
const result = new Type7(checker, flags);
|
|
49015
49065
|
typeCount++;
|
|
49016
49066
|
result.id = typeCount;
|
|
49017
|
-
(
|
|
49067
|
+
(_a2 = tracing) == null ? void 0 : _a2.recordType(result);
|
|
49018
49068
|
return result;
|
|
49019
49069
|
}
|
|
49020
49070
|
function createTypeWithSymbol(flags, symbol) {
|
|
@@ -49433,7 +49483,7 @@ function createTypeChecker(host) {
|
|
|
49433
49483
|
}
|
|
49434
49484
|
return { accessibility: 0 /* Accessible */, aliasesToMakeVisible };
|
|
49435
49485
|
function getIsDeclarationVisible(declaration) {
|
|
49436
|
-
var
|
|
49486
|
+
var _a2, _b;
|
|
49437
49487
|
if (!isDeclarationVisible(declaration)) {
|
|
49438
49488
|
const anyImportSyntax = getAnyImportSyntax(declaration);
|
|
49439
49489
|
if (anyImportSyntax && !hasSyntacticModifier(anyImportSyntax, 32 /* Export */) && // import clause without export
|
|
@@ -49445,7 +49495,7 @@ function createTypeChecker(host) {
|
|
|
49445
49495
|
} else if (isLateVisibilityPaintedStatement(declaration) && !hasSyntacticModifier(declaration, 32 /* Export */) && isDeclarationVisible(declaration.parent)) {
|
|
49446
49496
|
return addVisibleAlias(declaration, declaration);
|
|
49447
49497
|
} else if (isBindingElement(declaration)) {
|
|
49448
|
-
if (symbol.flags & 2097152 /* Alias */ && isInJSFile(declaration) && ((
|
|
49498
|
+
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)) {
|
|
49449
49499
|
return addVisibleAlias(declaration, declaration.parent.parent.parent.parent);
|
|
49450
49500
|
} else if (symbol.flags & 2 /* BlockScopedVariable */) {
|
|
49451
49501
|
const variableStatement = findAncestor(declaration, isVariableStatement);
|
|
@@ -49764,7 +49814,7 @@ function createTypeChecker(host) {
|
|
|
49764
49814
|
return typeNode;
|
|
49765
49815
|
}
|
|
49766
49816
|
function typeToTypeNodeWorker(type, context) {
|
|
49767
|
-
var
|
|
49817
|
+
var _a2, _b;
|
|
49768
49818
|
if (cancellationToken && cancellationToken.throwIfCancellationRequested) {
|
|
49769
49819
|
cancellationToken.throwIfCancellationRequested();
|
|
49770
49820
|
}
|
|
@@ -49898,7 +49948,7 @@ function createTypeChecker(host) {
|
|
|
49898
49948
|
if (!context.encounteredError && !(context.flags & 32768 /* AllowThisInObjectLiteral */)) {
|
|
49899
49949
|
context.encounteredError = true;
|
|
49900
49950
|
}
|
|
49901
|
-
(_b = (
|
|
49951
|
+
(_b = (_a2 = context.tracker).reportInaccessibleThisError) == null ? void 0 : _b.call(_a2);
|
|
49902
49952
|
}
|
|
49903
49953
|
context.approximateLength += 4;
|
|
49904
49954
|
return factory.createThisTypeNode();
|
|
@@ -50063,9 +50113,9 @@ function createTypeChecker(host) {
|
|
|
50063
50113
|
return factory.createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode);
|
|
50064
50114
|
}
|
|
50065
50115
|
function typeToTypeNodeOrCircularityElision(type2) {
|
|
50066
|
-
var
|
|
50116
|
+
var _a3, _b2, _c;
|
|
50067
50117
|
if (type2.flags & 1048576 /* Union */) {
|
|
50068
|
-
if ((
|
|
50118
|
+
if ((_a3 = context.visitedTypes) == null ? void 0 : _a3.has(getTypeId(type2))) {
|
|
50069
50119
|
if (!(context.flags & 131072 /* AllowAnonymousIdentifier */)) {
|
|
50070
50120
|
context.encounteredError = true;
|
|
50071
50121
|
(_c = (_b2 = context.tracker) == null ? void 0 : _b2.reportCyclicStructureError) == null ? void 0 : _c.call(_b2);
|
|
@@ -50083,13 +50133,13 @@ function createTypeChecker(host) {
|
|
|
50083
50133
|
return !!type2.target && isMappedTypeHomomorphic(type2.target) && !isMappedTypeHomomorphic(type2);
|
|
50084
50134
|
}
|
|
50085
50135
|
function createMappedTypeNodeFromType(type2) {
|
|
50086
|
-
var
|
|
50136
|
+
var _a3;
|
|
50087
50137
|
Debug.assert(!!(type2.flags & 524288 /* Object */));
|
|
50088
50138
|
const readonlyToken = type2.declaration.readonlyToken ? factory.createToken(type2.declaration.readonlyToken.kind) : void 0;
|
|
50089
50139
|
const questionToken = type2.declaration.questionToken ? factory.createToken(type2.declaration.questionToken.kind) : void 0;
|
|
50090
50140
|
let appropriateConstraintTypeNode;
|
|
50091
50141
|
let newTypeVariable;
|
|
50092
|
-
const needsModifierPreservingWrapper = !isMappedTypeWithKeyofConstraintDeclaration(type2) && !(getModifiersTypeFromMappedType(type2).flags & 2 /* Unknown */) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && !(getConstraintTypeFromMappedType(type2).flags & 262144 /* TypeParameter */ && ((
|
|
50142
|
+
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 */);
|
|
50093
50143
|
if (isMappedTypeWithKeyofConstraintDeclaration(type2)) {
|
|
50094
50144
|
if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
50095
50145
|
const newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
|
|
@@ -50148,7 +50198,7 @@ function createTypeChecker(host) {
|
|
|
50148
50198
|
return result;
|
|
50149
50199
|
}
|
|
50150
50200
|
function createAnonymousTypeNode(type2) {
|
|
50151
|
-
var
|
|
50201
|
+
var _a3, _b2;
|
|
50152
50202
|
const typeId = type2.id;
|
|
50153
50203
|
const symbol = type2.symbol;
|
|
50154
50204
|
if (symbol) {
|
|
@@ -50162,7 +50212,7 @@ function createTypeChecker(host) {
|
|
|
50162
50212
|
return typeNode;
|
|
50163
50213
|
}
|
|
50164
50214
|
}
|
|
50165
|
-
if ((
|
|
50215
|
+
if ((_a3 = context.visitedTypes) == null ? void 0 : _a3.has(typeId)) {
|
|
50166
50216
|
return createElidedInformationPlaceholder(context);
|
|
50167
50217
|
}
|
|
50168
50218
|
return visitAndTransformType(type2, createTypeNodeFromObjectType);
|
|
@@ -50192,19 +50242,19 @@ function createTypeChecker(host) {
|
|
|
50192
50242
|
return createTypeNodeFromObjectType(type2);
|
|
50193
50243
|
}
|
|
50194
50244
|
function shouldWriteTypeOfFunctionSymbol() {
|
|
50195
|
-
var
|
|
50245
|
+
var _a4;
|
|
50196
50246
|
const isStaticMethodSymbol = !!(symbol.flags & 8192 /* Method */) && // typeof static method
|
|
50197
50247
|
some(symbol.declarations, (declaration) => isStatic(declaration));
|
|
50198
50248
|
const isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || // is exported function symbol
|
|
50199
50249
|
forEach(symbol.declarations, (declaration) => declaration.parent.kind === 307 /* SourceFile */ || declaration.parent.kind === 268 /* ModuleBlock */));
|
|
50200
50250
|
if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
|
|
50201
|
-
return (!!(context.flags & 4096 /* UseTypeOfFunction */) || ((
|
|
50251
|
+
return (!!(context.flags & 4096 /* UseTypeOfFunction */) || ((_a4 = context.visitedTypes) == null ? void 0 : _a4.has(typeId))) && // it is type of the symbol uses itself recursively
|
|
50202
50252
|
(!(context.flags & 8 /* UseStructuralFallback */) || isValueSymbolAccessible(symbol, context.enclosingDeclaration));
|
|
50203
50253
|
}
|
|
50204
50254
|
}
|
|
50205
50255
|
}
|
|
50206
50256
|
function visitAndTransformType(type2, transform) {
|
|
50207
|
-
var
|
|
50257
|
+
var _a3, _b2, _c;
|
|
50208
50258
|
const typeId = type2.id;
|
|
50209
50259
|
const isConstructorObject = getObjectFlags(type2) & 16 /* Anonymous */ && type2.symbol && type2.symbol.flags & 32 /* Class */;
|
|
50210
50260
|
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;
|
|
@@ -50219,7 +50269,7 @@ function createTypeChecker(host) {
|
|
|
50219
50269
|
if (links) {
|
|
50220
50270
|
links.serializedTypes || (links.serializedTypes = /* @__PURE__ */ new Map());
|
|
50221
50271
|
}
|
|
50222
|
-
const cachedResult = (
|
|
50272
|
+
const cachedResult = (_a3 = links == null ? void 0 : links.serializedTypes) == null ? void 0 : _a3.get(key);
|
|
50223
50273
|
if (cachedResult) {
|
|
50224
50274
|
(_b2 = cachedResult.trackedSymbols) == null ? void 0 : _b2.forEach(
|
|
50225
50275
|
([symbol, enclosingDeclaration, meaning]) => context.tracker.trackSymbol(
|
|
@@ -50397,36 +50447,7 @@ function createTypeChecker(host) {
|
|
|
50397
50447
|
}
|
|
50398
50448
|
let typeArgumentNodes;
|
|
50399
50449
|
if (typeArguments.length > 0) {
|
|
50400
|
-
|
|
50401
|
-
if (type2.target.typeParameters) {
|
|
50402
|
-
typeParameterCount = Math.min(type2.target.typeParameters.length, typeArguments.length);
|
|
50403
|
-
if (isReferenceToType(type2, getGlobalIterableType(
|
|
50404
|
-
/*reportErrors*/
|
|
50405
|
-
false
|
|
50406
|
-
)) || isReferenceToType(type2, getGlobalIterableIteratorType(
|
|
50407
|
-
/*reportErrors*/
|
|
50408
|
-
false
|
|
50409
|
-
)) || isReferenceToType(type2, getGlobalAsyncIterableType(
|
|
50410
|
-
/*reportErrors*/
|
|
50411
|
-
false
|
|
50412
|
-
)) || isReferenceToType(type2, getGlobalAsyncIterableIteratorType(
|
|
50413
|
-
/*reportErrors*/
|
|
50414
|
-
false
|
|
50415
|
-
))) {
|
|
50416
|
-
if (!type2.node || !isTypeReferenceNode(type2.node) || !type2.node.typeArguments || type2.node.typeArguments.length < typeParameterCount) {
|
|
50417
|
-
while (typeParameterCount > 0) {
|
|
50418
|
-
const typeArgument = typeArguments[typeParameterCount - 1];
|
|
50419
|
-
const defaultType = getDefaultFromTypeParameter(type2.target.typeParameters[typeParameterCount - 1]);
|
|
50420
|
-
if (!defaultType || !isTypeIdenticalTo(typeArgument, defaultType)) {
|
|
50421
|
-
break;
|
|
50422
|
-
}
|
|
50423
|
-
typeParameterCount--;
|
|
50424
|
-
}
|
|
50425
|
-
}
|
|
50426
|
-
}
|
|
50427
|
-
} else {
|
|
50428
|
-
typeParameterCount = 0;
|
|
50429
|
-
}
|
|
50450
|
+
const typeParameterCount = (type2.target.typeParameters || emptyArray).length;
|
|
50430
50451
|
typeArgumentNodes = mapToTypeNodes(typeArguments.slice(i, typeParameterCount), context);
|
|
50431
50452
|
}
|
|
50432
50453
|
const flags = context.flags;
|
|
@@ -50567,11 +50588,11 @@ function createTypeChecker(host) {
|
|
|
50567
50588
|
return factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
50568
50589
|
}
|
|
50569
50590
|
function shouldUsePlaceholderForProperty(propertySymbol, context) {
|
|
50570
|
-
var
|
|
50571
|
-
return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((
|
|
50591
|
+
var _a2;
|
|
50592
|
+
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 */));
|
|
50572
50593
|
}
|
|
50573
50594
|
function addPropertyToElementList(propertySymbol, context, typeElements) {
|
|
50574
|
-
var
|
|
50595
|
+
var _a2;
|
|
50575
50596
|
const propertyIsReverseMapped = !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */);
|
|
50576
50597
|
const propertyType = shouldUsePlaceholderForProperty(propertySymbol, context) ? anyType : getNonMissingTypeOfSymbol(propertySymbol);
|
|
50577
50598
|
const saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
@@ -50593,7 +50614,7 @@ function createTypeChecker(host) {
|
|
|
50593
50614
|
context.tracker.reportNonSerializableProperty(symbolToString(propertySymbol));
|
|
50594
50615
|
}
|
|
50595
50616
|
}
|
|
50596
|
-
context.enclosingDeclaration = propertySymbol.valueDeclaration || ((
|
|
50617
|
+
context.enclosingDeclaration = propertySymbol.valueDeclaration || ((_a2 = propertySymbol.declarations) == null ? void 0 : _a2[0]) || saveEnclosingDeclaration;
|
|
50597
50618
|
const propertyName = getPropertyNameNodeForSymbol(propertySymbol, context);
|
|
50598
50619
|
context.enclosingDeclaration = saveEnclosingDeclaration;
|
|
50599
50620
|
context.approximateLength += symbolName(propertySymbol).length + 1;
|
|
@@ -50661,8 +50682,8 @@ function createTypeChecker(host) {
|
|
|
50661
50682
|
);
|
|
50662
50683
|
typeElements.push(preserveCommentsOn(propertySignature));
|
|
50663
50684
|
function preserveCommentsOn(node) {
|
|
50664
|
-
var
|
|
50665
|
-
const jsdocPropertyTag = (
|
|
50685
|
+
var _a3;
|
|
50686
|
+
const jsdocPropertyTag = (_a3 = propertySymbol.declarations) == null ? void 0 : _a3.find((d) => d.kind === 348 /* JSDocPropertyTag */);
|
|
50666
50687
|
if (jsdocPropertyTag) {
|
|
50667
50688
|
const commentText = getTextOfJSDocComment(jsdocPropertyTag.comment);
|
|
50668
50689
|
if (commentText) {
|
|
@@ -50769,7 +50790,7 @@ function createTypeChecker(host) {
|
|
|
50769
50790
|
);
|
|
50770
50791
|
}
|
|
50771
50792
|
function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
|
|
50772
|
-
var
|
|
50793
|
+
var _a2;
|
|
50773
50794
|
const flags = context.flags;
|
|
50774
50795
|
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
50775
50796
|
context.approximateLength += 3;
|
|
@@ -50859,7 +50880,7 @@ function createTypeChecker(host) {
|
|
|
50859
50880
|
if (typeArguments) {
|
|
50860
50881
|
node.typeArguments = factory.createNodeArray(typeArguments);
|
|
50861
50882
|
}
|
|
50862
|
-
if (((
|
|
50883
|
+
if (((_a2 = signature.declaration) == null ? void 0 : _a2.kind) === 323 /* JSDocSignature */ && signature.declaration.parent.kind === 339 /* JSDocOverloadTag */) {
|
|
50863
50884
|
const comment = getTextOfNode(
|
|
50864
50885
|
signature.declaration.parent.parent,
|
|
50865
50886
|
/*includeTrivia*/
|
|
@@ -51191,11 +51212,11 @@ function createTypeChecker(host) {
|
|
|
51191
51212
|
return typeParameterNodes;
|
|
51192
51213
|
}
|
|
51193
51214
|
function lookupTypeParameterNodes(chain, index, context) {
|
|
51194
|
-
var
|
|
51215
|
+
var _a2;
|
|
51195
51216
|
Debug.assert(chain && 0 <= index && index < chain.length);
|
|
51196
51217
|
const symbol = chain[index];
|
|
51197
51218
|
const symbolId = getSymbolId(symbol);
|
|
51198
|
-
if ((
|
|
51219
|
+
if ((_a2 = context.typeParameterSymbolList) == null ? void 0 : _a2.has(symbolId)) {
|
|
51199
51220
|
return void 0;
|
|
51200
51221
|
}
|
|
51201
51222
|
(context.typeParameterSymbolList || (context.typeParameterSymbolList = /* @__PURE__ */ new Set())).add(symbolId);
|
|
@@ -51430,7 +51451,7 @@ function createTypeChecker(host) {
|
|
|
51430
51451
|
return false;
|
|
51431
51452
|
}
|
|
51432
51453
|
function typeParameterToName(type, context) {
|
|
51433
|
-
var
|
|
51454
|
+
var _a2, _b;
|
|
51434
51455
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && context.typeParameterNames) {
|
|
51435
51456
|
const cached = context.typeParameterNames.get(getTypeId(type));
|
|
51436
51457
|
if (cached) {
|
|
@@ -51449,7 +51470,7 @@ function createTypeChecker(host) {
|
|
|
51449
51470
|
}
|
|
51450
51471
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
51451
51472
|
const rawtext = result.escapedText;
|
|
51452
|
-
let i = ((
|
|
51473
|
+
let i = ((_a2 = context.typeParameterNamesByTextNextNameCount) == null ? void 0 : _a2.get(rawtext)) || 0;
|
|
51453
51474
|
let text = rawtext;
|
|
51454
51475
|
while (((_b = context.typeParameterNamesByText) == null ? void 0 : _b.has(text)) || typeParameterShadowsOtherTypeParameterInScope(text, context, type)) {
|
|
51455
51476
|
i++;
|
|
@@ -51625,7 +51646,7 @@ function createTypeChecker(host) {
|
|
|
51625
51646
|
return enclosingDeclaration;
|
|
51626
51647
|
}
|
|
51627
51648
|
function serializeTypeForDeclaration(context, declaration, type, symbol) {
|
|
51628
|
-
var
|
|
51649
|
+
var _a2;
|
|
51629
51650
|
const addUndefined = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
|
|
51630
51651
|
const enclosingDeclaration = context.enclosingDeclaration;
|
|
51631
51652
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
@@ -51642,7 +51663,7 @@ function createTypeChecker(host) {
|
|
|
51642
51663
|
if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)))) {
|
|
51643
51664
|
context.flags |= 1048576 /* AllowUniqueESSymbolType */;
|
|
51644
51665
|
}
|
|
51645
|
-
const decl = declaration ?? symbol.valueDeclaration ?? ((
|
|
51666
|
+
const decl = declaration ?? symbol.valueDeclaration ?? ((_a2 = symbol.declarations) == null ? void 0 : _a2[0]);
|
|
51646
51667
|
const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
|
|
51647
51668
|
if (decl && hasInferredType(decl) && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
|
|
51648
51669
|
syntacticNodeBuilder.serializeTypeOfDeclaration(decl, context);
|
|
@@ -52003,7 +52024,7 @@ function createTypeChecker(host) {
|
|
|
52003
52024
|
}
|
|
52004
52025
|
}
|
|
52005
52026
|
function symbolTableToDeclarationStatements(symbolTable, context) {
|
|
52006
|
-
var
|
|
52027
|
+
var _a2;
|
|
52007
52028
|
const serializePropertySymbolForClass = makeSerializePropertySymbol(
|
|
52008
52029
|
factory.createPropertyDeclaration,
|
|
52009
52030
|
174 /* MethodDeclaration */,
|
|
@@ -52025,14 +52046,14 @@ function createTypeChecker(host) {
|
|
|
52025
52046
|
...oldcontext,
|
|
52026
52047
|
usedSymbolNames: new Set(oldcontext.usedSymbolNames),
|
|
52027
52048
|
remappedSymbolNames: /* @__PURE__ */ new Map(),
|
|
52028
|
-
remappedSymbolReferences: new Map((
|
|
52049
|
+
remappedSymbolReferences: new Map((_a2 = oldcontext.remappedSymbolReferences) == null ? void 0 : _a2.entries()),
|
|
52029
52050
|
tracker: void 0
|
|
52030
52051
|
};
|
|
52031
52052
|
const tracker = {
|
|
52032
52053
|
...oldcontext.tracker.inner,
|
|
52033
52054
|
trackSymbol: (sym, decl, meaning) => {
|
|
52034
|
-
var
|
|
52035
|
-
if ((
|
|
52055
|
+
var _a3, _b;
|
|
52056
|
+
if ((_a3 = context.remappedSymbolNames) == null ? void 0 : _a3.has(getSymbolId(sym)))
|
|
52036
52057
|
return false;
|
|
52037
52058
|
const accessibleResult = isSymbolAccessible(
|
|
52038
52059
|
sym,
|
|
@@ -52267,7 +52288,7 @@ function createTypeChecker(host) {
|
|
|
52267
52288
|
}
|
|
52268
52289
|
}
|
|
52269
52290
|
function serializeSymbolWorker(symbol, isPrivate, propertyAsAlias, escapedSymbolName = symbol.escapedName) {
|
|
52270
|
-
var
|
|
52291
|
+
var _a3, _b, _c, _d, _e, _f;
|
|
52271
52292
|
const symbolName2 = unescapeLeadingUnderscores(escapedSymbolName);
|
|
52272
52293
|
const isDefault = escapedSymbolName === "default" /* Default */;
|
|
52273
52294
|
if (isPrivate && !(context.flags & 131072 /* AllowAnonymousIdentifier */) && isStringANonContextualKeyword(symbolName2) && !isDefault) {
|
|
@@ -52298,7 +52319,7 @@ function createTypeChecker(host) {
|
|
|
52298
52319
|
} else {
|
|
52299
52320
|
const type = getTypeOfSymbol(symbol);
|
|
52300
52321
|
const localName = getInternalSymbolName(symbol, symbolName2);
|
|
52301
|
-
if (type.symbol && type.symbol !== symbol && type.symbol.flags & 16 /* Function */ && some(type.symbol.declarations, isFunctionExpressionOrArrowFunction) && (((
|
|
52322
|
+
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))) {
|
|
52302
52323
|
if (!context.remappedSymbolReferences) {
|
|
52303
52324
|
context.remappedSymbolReferences = /* @__PURE__ */ new Map();
|
|
52304
52325
|
}
|
|
@@ -52477,11 +52498,11 @@ function createTypeChecker(host) {
|
|
|
52477
52498
|
results.push(node);
|
|
52478
52499
|
}
|
|
52479
52500
|
function serializeTypeAlias(symbol, symbolName2, modifierFlags) {
|
|
52480
|
-
var
|
|
52501
|
+
var _a3;
|
|
52481
52502
|
const aliasType = getDeclaredTypeOfTypeAlias(symbol);
|
|
52482
52503
|
const typeParams = getSymbolLinks(symbol).typeParameters;
|
|
52483
52504
|
const typeParamDecls = map(typeParams, (p) => typeParameterToDeclaration(p, context));
|
|
52484
|
-
const jsdocAliasDecl = (
|
|
52505
|
+
const jsdocAliasDecl = (_a3 = symbol.declarations) == null ? void 0 : _a3.find(isJSDocTypeAlias);
|
|
52485
52506
|
const commentText = getTextOfJSDocComment(jsdocAliasDecl ? jsdocAliasDecl.comment || jsdocAliasDecl.parent.comment : void 0);
|
|
52486
52507
|
const oldFlags = context.flags;
|
|
52487
52508
|
context.flags |= 8388608 /* InTypeAlias */;
|
|
@@ -52568,12 +52589,12 @@ function createTypeChecker(host) {
|
|
|
52568
52589
|
/*isTypeOnly*/
|
|
52569
52590
|
false,
|
|
52570
52591
|
factory.createNamedExports(mapDefined(filter(mergedMembers, (n) => n.escapedName !== "export=" /* ExportEquals */), (s) => {
|
|
52571
|
-
var
|
|
52592
|
+
var _a3, _b;
|
|
52572
52593
|
const name = unescapeLeadingUnderscores(s.escapedName);
|
|
52573
52594
|
const localName2 = getInternalSymbolName(s, name);
|
|
52574
52595
|
const aliasDecl = s.declarations && getDeclarationOfAliasSymbol(s);
|
|
52575
52596
|
if (containingFile && (aliasDecl ? containingFile !== getSourceFileOfNode(aliasDecl) : !some(s.declarations, (d) => getSourceFileOfNode(d) === containingFile))) {
|
|
52576
|
-
(_b = (
|
|
52597
|
+
(_b = (_a3 = context.tracker) == null ? void 0 : _a3.reportNonlocalAugmentation) == null ? void 0 : _b.call(_a3, containingFile, symbol, s);
|
|
52577
52598
|
return void 0;
|
|
52578
52599
|
}
|
|
52579
52600
|
const target = aliasDecl && getTargetOfAliasDeclaration(
|
|
@@ -52739,8 +52760,8 @@ function createTypeChecker(host) {
|
|
|
52739
52760
|
return void 0;
|
|
52740
52761
|
}
|
|
52741
52762
|
function serializeAsClass(symbol, localName, modifierFlags) {
|
|
52742
|
-
var
|
|
52743
|
-
const originalDecl = (
|
|
52763
|
+
var _a3, _b;
|
|
52764
|
+
const originalDecl = (_a3 = symbol.declarations) == null ? void 0 : _a3.find(isClassLike);
|
|
52744
52765
|
const oldEnclosing = context.enclosingDeclaration;
|
|
52745
52766
|
context.enclosingDeclaration = originalDecl || oldEnclosing;
|
|
52746
52767
|
const localParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);
|
|
@@ -52837,7 +52858,7 @@ function createTypeChecker(host) {
|
|
|
52837
52858
|
});
|
|
52838
52859
|
}
|
|
52839
52860
|
function serializeAsAlias(symbol, localName, modifierFlags) {
|
|
52840
|
-
var
|
|
52861
|
+
var _a3, _b, _c, _d, _e, _f;
|
|
52841
52862
|
const node = getDeclarationOfAliasSymbol(symbol);
|
|
52842
52863
|
if (!node)
|
|
52843
52864
|
return Debug.fail();
|
|
@@ -52857,7 +52878,7 @@ function createTypeChecker(host) {
|
|
|
52857
52878
|
includePrivateSymbol(target);
|
|
52858
52879
|
switch (node.kind) {
|
|
52859
52880
|
case 208 /* BindingElement */:
|
|
52860
|
-
if (((_b = (
|
|
52881
|
+
if (((_b = (_a3 = node.parent) == null ? void 0 : _a3.parent) == null ? void 0 : _b.kind) === 260 /* VariableDeclaration */) {
|
|
52861
52882
|
const specifier2 = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
52862
52883
|
const { propertyName } = node;
|
|
52863
52884
|
addResult(
|
|
@@ -53080,7 +53101,7 @@ function createTypeChecker(host) {
|
|
|
53080
53101
|
);
|
|
53081
53102
|
}
|
|
53082
53103
|
function serializeMaybeAliasAssignment(symbol) {
|
|
53083
|
-
var
|
|
53104
|
+
var _a3;
|
|
53084
53105
|
if (symbol.flags & 4194304 /* Prototype */) {
|
|
53085
53106
|
return false;
|
|
53086
53107
|
}
|
|
@@ -53153,7 +53174,7 @@ function createTypeChecker(host) {
|
|
|
53153
53174
|
if (isTypeRepresentableAsFunctionNamespaceMerge(typeToSerialize, symbol)) {
|
|
53154
53175
|
serializeAsFunctionNamespaceMerge(typeToSerialize, symbol, varName, isExportAssignmentCompatibleSymbolName ? 0 /* None */ : 32 /* Export */);
|
|
53155
53176
|
} else {
|
|
53156
|
-
const flags = ((
|
|
53177
|
+
const flags = ((_a3 = context.enclosingDeclaration) == null ? void 0 : _a3.kind) === 267 /* ModuleDeclaration */ && (!(symbol.flags & 98304 /* Accessor */) || symbol.flags & 65536 /* SetAccessor */) ? 1 /* Let */ : 2 /* Const */;
|
|
53157
53178
|
const statement = factory.createVariableStatement(
|
|
53158
53179
|
/*modifiers*/
|
|
53159
53180
|
void 0,
|
|
@@ -53193,9 +53214,9 @@ function createTypeChecker(host) {
|
|
|
53193
53214
|
}
|
|
53194
53215
|
}
|
|
53195
53216
|
function isTypeRepresentableAsFunctionNamespaceMerge(typeToSerialize, hostSymbol) {
|
|
53196
|
-
var
|
|
53217
|
+
var _a3;
|
|
53197
53218
|
const ctxSrc = getSourceFileOfNode(context.enclosingDeclaration);
|
|
53198
|
-
return getObjectFlags(typeToSerialize) & (16 /* Anonymous */ | 32 /* Mapped */) && !some((
|
|
53219
|
+
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
|
|
53199
53220
|
!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
|
|
53200
53221
|
!!(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
|
|
53201
53222
|
!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) => {
|
|
@@ -53210,7 +53231,7 @@ function createTypeChecker(host) {
|
|
|
53210
53231
|
}
|
|
53211
53232
|
function makeSerializePropertySymbol(createProperty2, methodKind, useAccessors) {
|
|
53212
53233
|
return function serializePropertySymbol(p, isStatic2, baseType) {
|
|
53213
|
-
var
|
|
53234
|
+
var _a3, _b, _c, _d, _e;
|
|
53214
53235
|
const modifierFlags = getDeclarationModifierFlagsFromSymbol(p);
|
|
53215
53236
|
const isPrivate = !!(modifierFlags & 2 /* Private */);
|
|
53216
53237
|
if (isStatic2 && p.flags & (788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */)) {
|
|
@@ -53221,7 +53242,7 @@ function createTypeChecker(host) {
|
|
|
53221
53242
|
}
|
|
53222
53243
|
const flag = modifierFlags & ~1024 /* Async */ | (isStatic2 ? 256 /* Static */ : 0);
|
|
53223
53244
|
const name = getPropertyNameNodeForSymbol(p, context);
|
|
53224
|
-
const firstPropertyLikeDecl = (
|
|
53245
|
+
const firstPropertyLikeDecl = (_a3 = p.declarations) == null ? void 0 : _a3.find(or(isPropertyDeclaration, isAccessor, isVariableDeclaration, isPropertySignature, isBinaryExpression, isPropertyAccessExpression));
|
|
53225
53246
|
if (p.flags & 98304 /* Accessor */ && useAccessors) {
|
|
53226
53247
|
const result = [];
|
|
53227
53248
|
if (p.flags & 65536 /* SetAccessor */) {
|
|
@@ -53490,7 +53511,7 @@ function createTypeChecker(host) {
|
|
|
53490
53511
|
}
|
|
53491
53512
|
}
|
|
53492
53513
|
function getUnusedName(input, symbol) {
|
|
53493
|
-
var
|
|
53514
|
+
var _a3, _b;
|
|
53494
53515
|
const id = symbol ? getSymbolId(symbol) : void 0;
|
|
53495
53516
|
if (id) {
|
|
53496
53517
|
if (context.remappedSymbolNames.has(id)) {
|
|
@@ -53502,7 +53523,7 @@ function createTypeChecker(host) {
|
|
|
53502
53523
|
}
|
|
53503
53524
|
let i = 0;
|
|
53504
53525
|
const original = input;
|
|
53505
|
-
while ((
|
|
53526
|
+
while ((_a3 = context.usedSymbolNames) == null ? void 0 : _a3.has(input)) {
|
|
53506
53527
|
i++;
|
|
53507
53528
|
input = `${original}_${i}`;
|
|
53508
53529
|
}
|
|
@@ -53626,8 +53647,8 @@ function createTypeChecker(host) {
|
|
|
53626
53647
|
}
|
|
53627
53648
|
}
|
|
53628
53649
|
function getNameOfSymbolAsWritten(symbol, context) {
|
|
53629
|
-
var
|
|
53630
|
-
if ((
|
|
53650
|
+
var _a2;
|
|
53651
|
+
if ((_a2 = context == null ? void 0 : context.remappedSymbolReferences) == null ? void 0 : _a2.has(getSymbolId(symbol))) {
|
|
53631
53652
|
symbol = context.remappedSymbolReferences.get(getSymbolId(symbol));
|
|
53632
53653
|
}
|
|
53633
53654
|
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`
|
|
@@ -53885,9 +53906,9 @@ function createTypeChecker(host) {
|
|
|
53885
53906
|
return prop ? getTypeOfSymbol(prop) : void 0;
|
|
53886
53907
|
}
|
|
53887
53908
|
function getTypeOfPropertyOrIndexSignatureOfType(type, name) {
|
|
53888
|
-
var
|
|
53909
|
+
var _a2;
|
|
53889
53910
|
let propType;
|
|
53890
|
-
return getTypeOfPropertyOfType(type, name) || (propType = (
|
|
53911
|
+
return getTypeOfPropertyOfType(type, name) || (propType = (_a2 = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a2.type) && addOptionality(
|
|
53891
53912
|
propType,
|
|
53892
53913
|
/*isProperty*/
|
|
53893
53914
|
true,
|
|
@@ -54375,14 +54396,14 @@ function createTypeChecker(host) {
|
|
|
54375
54396
|
return widened;
|
|
54376
54397
|
}
|
|
54377
54398
|
function getJSContainerObjectType(decl, symbol, init) {
|
|
54378
|
-
var
|
|
54399
|
+
var _a2, _b;
|
|
54379
54400
|
if (!isInJSFile(decl) || !init || !isObjectLiteralExpression(init) || init.properties.length) {
|
|
54380
54401
|
return void 0;
|
|
54381
54402
|
}
|
|
54382
54403
|
const exports2 = createSymbolTable();
|
|
54383
54404
|
while (isBinaryExpression(decl) || isPropertyAccessExpression(decl)) {
|
|
54384
54405
|
const s2 = getSymbolOfNode(decl);
|
|
54385
|
-
if ((
|
|
54406
|
+
if ((_a2 = s2 == null ? void 0 : s2.exports) == null ? void 0 : _a2.size) {
|
|
54386
54407
|
mergeSymbolTable(exports2, s2.exports);
|
|
54387
54408
|
}
|
|
54388
54409
|
decl = isBinaryExpression(decl) ? decl.parent : decl.parent.parent;
|
|
@@ -54396,7 +54417,7 @@ function createTypeChecker(host) {
|
|
|
54396
54417
|
return type;
|
|
54397
54418
|
}
|
|
54398
54419
|
function getAnnotatedTypeForAssignmentDeclaration(declaredType, expression, symbol, declaration) {
|
|
54399
|
-
var
|
|
54420
|
+
var _a2;
|
|
54400
54421
|
const typeNode = getEffectiveTypeAnnotationNode(expression.parent);
|
|
54401
54422
|
if (typeNode) {
|
|
54402
54423
|
const type = getWidenedType(getTypeFromTypeNode(typeNode));
|
|
@@ -54412,7 +54433,7 @@ function createTypeChecker(host) {
|
|
|
54412
54433
|
);
|
|
54413
54434
|
}
|
|
54414
54435
|
}
|
|
54415
|
-
if ((
|
|
54436
|
+
if ((_a2 = symbol.parent) == null ? void 0 : _a2.valueDeclaration) {
|
|
54416
54437
|
const possiblyAnnotatedSymbol = getFunctionExpressionParentSymbolOrSymbol(symbol.parent);
|
|
54417
54438
|
if (possiblyAnnotatedSymbol.valueDeclaration) {
|
|
54418
54439
|
const typeNode2 = getEffectiveTypeAnnotationNode(possiblyAnnotatedSymbol.valueDeclaration);
|
|
@@ -54466,13 +54487,13 @@ function createTypeChecker(host) {
|
|
|
54466
54487
|
resolvedSymbol.exports = createSymbolTable();
|
|
54467
54488
|
}
|
|
54468
54489
|
(resolvedSymbol || symbol).exports.forEach((s, name) => {
|
|
54469
|
-
var
|
|
54490
|
+
var _a2;
|
|
54470
54491
|
const exportedMember = members.get(name);
|
|
54471
54492
|
if (exportedMember && exportedMember !== s && !(s.flags & 2097152 /* Alias */)) {
|
|
54472
54493
|
if (s.flags & 111551 /* Value */ && exportedMember.flags & 111551 /* Value */) {
|
|
54473
54494
|
if (s.valueDeclaration && exportedMember.valueDeclaration && getSourceFileOfNode(s.valueDeclaration) !== getSourceFileOfNode(exportedMember.valueDeclaration)) {
|
|
54474
54495
|
const unescapedName = unescapeLeadingUnderscores(s.escapedName);
|
|
54475
|
-
const exportedMemberName = ((
|
|
54496
|
+
const exportedMemberName = ((_a2 = tryCast(exportedMember.valueDeclaration, isNamedDeclaration)) == null ? void 0 : _a2.name) || exportedMember.valueDeclaration;
|
|
54476
54497
|
addRelatedInfo(
|
|
54477
54498
|
error(s.valueDeclaration, Diagnostics.Duplicate_identifier_0, unescapedName),
|
|
54478
54499
|
createDiagnosticForNode(exportedMemberName, Diagnostics._0_was_also_declared_here, unescapedName)
|
|
@@ -55145,8 +55166,11 @@ function createTypeChecker(host) {
|
|
|
55145
55166
|
}
|
|
55146
55167
|
}
|
|
55147
55168
|
function getOuterTypeParametersOfClassOrInterface(symbol) {
|
|
55148
|
-
var
|
|
55149
|
-
|
|
55169
|
+
var _a2;
|
|
55170
|
+
if (getCheckFlags(symbol) & 2097152 /* SyntheticInterface */) {
|
|
55171
|
+
return void 0;
|
|
55172
|
+
}
|
|
55173
|
+
const declaration = symbol.flags & 32 /* Class */ || symbol.flags & 16 /* Function */ ? symbol.valueDeclaration : (_a2 = symbol.declarations) == null ? void 0 : _a2.find((decl) => {
|
|
55150
55174
|
if (decl.kind === 264 /* InterfaceDeclaration */) {
|
|
55151
55175
|
return true;
|
|
55152
55176
|
}
|
|
@@ -55467,13 +55491,13 @@ function createTypeChecker(host) {
|
|
|
55467
55491
|
return links.declaredType;
|
|
55468
55492
|
}
|
|
55469
55493
|
function getDeclaredTypeOfTypeAlias(symbol) {
|
|
55470
|
-
var
|
|
55494
|
+
var _a2;
|
|
55471
55495
|
const links = getSymbolLinks(symbol);
|
|
55472
55496
|
if (!links.declaredType) {
|
|
55473
55497
|
if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) {
|
|
55474
55498
|
return errorType;
|
|
55475
55499
|
}
|
|
55476
|
-
const declaration = Debug.checkDefined((
|
|
55500
|
+
const declaration = Debug.checkDefined((_a2 = symbol.declarations) == null ? void 0 : _a2.find(isTypeAlias), "Type alias symbol with no valid declaration found");
|
|
55477
55501
|
const typeNode = isJSDocTypeAlias(declaration) ? declaration.typeExpression : declaration.type;
|
|
55478
55502
|
let type = typeNode ? getTypeFromTypeNode(typeNode) : errorType;
|
|
55479
55503
|
if (popTypeResolution()) {
|
|
@@ -56372,8 +56396,8 @@ function createTypeChecker(host) {
|
|
|
56372
56396
|
if (symbol === globalThisSymbol) {
|
|
56373
56397
|
const varsOnly = /* @__PURE__ */ new Map();
|
|
56374
56398
|
members.forEach((p) => {
|
|
56375
|
-
var
|
|
56376
|
-
if (!(p.flags & 418 /* BlockScoped */) && !(p.flags & 512 /* ValueModule */ && ((
|
|
56399
|
+
var _a2;
|
|
56400
|
+
if (!(p.flags & 418 /* BlockScoped */) && !(p.flags & 512 /* ValueModule */ && ((_a2 = p.declarations) == null ? void 0 : _a2.length) && every(p.declarations, isAmbientModule))) {
|
|
56377
56401
|
varsOnly.set(p.escapedName, p);
|
|
56378
56402
|
}
|
|
56379
56403
|
});
|
|
@@ -56609,7 +56633,7 @@ function createTypeChecker(host) {
|
|
|
56609
56633
|
}
|
|
56610
56634
|
}
|
|
56611
56635
|
function getTypeOfMappedSymbol(symbol) {
|
|
56612
|
-
var
|
|
56636
|
+
var _a2;
|
|
56613
56637
|
if (!symbol.links.type) {
|
|
56614
56638
|
const mappedType = symbol.links.mappedType;
|
|
56615
56639
|
if (!pushTypeResolution(symbol, 0 /* Type */)) {
|
|
@@ -56628,7 +56652,7 @@ function createTypeChecker(host) {
|
|
|
56628
56652
|
error(currentNode, Diagnostics.Type_of_property_0_circularly_references_itself_in_mapped_type_1, symbolToString(symbol), typeToString(mappedType));
|
|
56629
56653
|
type = errorType;
|
|
56630
56654
|
}
|
|
56631
|
-
(
|
|
56655
|
+
(_a2 = symbol.links).type ?? (_a2.type = type);
|
|
56632
56656
|
}
|
|
56633
56657
|
return symbol.links.type;
|
|
56634
56658
|
}
|
|
@@ -56827,8 +56851,8 @@ function createTypeChecker(host) {
|
|
|
56827
56851
|
return !!typeVariable && isConstTypeVariable(typeVariable, depth);
|
|
56828
56852
|
}
|
|
56829
56853
|
function isConstTypeVariable(type, depth = 0) {
|
|
56830
|
-
var
|
|
56831
|
-
return depth < 5 && !!(type && (type.flags & 262144 /* TypeParameter */ && some((
|
|
56854
|
+
var _a2;
|
|
56855
|
+
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));
|
|
56832
56856
|
}
|
|
56833
56857
|
function getConstraintOfIndexedAccess(type) {
|
|
56834
56858
|
return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : void 0;
|
|
@@ -57119,7 +57143,7 @@ function createTypeChecker(host) {
|
|
|
57119
57143
|
return getReducedType(getApparentType(getReducedType(type)));
|
|
57120
57144
|
}
|
|
57121
57145
|
function createUnionOrIntersectionProperty(containingType, name, skipObjectFunctionPropertyAugment) {
|
|
57122
|
-
var
|
|
57146
|
+
var _a2, _b, _c;
|
|
57123
57147
|
let singleProp;
|
|
57124
57148
|
let propSet;
|
|
57125
57149
|
let indexTypes;
|
|
@@ -57187,7 +57211,7 @@ function createTypeChecker(host) {
|
|
|
57187
57211
|
}
|
|
57188
57212
|
if (!propSet && !(checkFlags & 16 /* ReadPartial */) && !indexTypes) {
|
|
57189
57213
|
if (mergedInstantiations) {
|
|
57190
|
-
const links = (
|
|
57214
|
+
const links = (_a2 = tryCast(singleProp, isTransientSymbol)) == null ? void 0 : _a2.links;
|
|
57191
57215
|
const clone = createSymbolWithType(singleProp, links == null ? void 0 : links.type);
|
|
57192
57216
|
clone.parent = (_c = (_b = singleProp.valueDeclaration) == null ? void 0 : _b.symbol) == null ? void 0 : _c.parent;
|
|
57193
57217
|
clone.links.containingType = containingType;
|
|
@@ -57258,8 +57282,8 @@ function createTypeChecker(host) {
|
|
|
57258
57282
|
return result;
|
|
57259
57283
|
}
|
|
57260
57284
|
function getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment) {
|
|
57261
|
-
var
|
|
57262
|
-
let property = skipObjectFunctionPropertyAugment ? (
|
|
57285
|
+
var _a2, _b, _c;
|
|
57286
|
+
let property = skipObjectFunctionPropertyAugment ? (_a2 = type.propertyCacheWithoutObjectFunctionPropertyAugment) == null ? void 0 : _a2.get(name) : (_b = type.propertyCache) == null ? void 0 : _b.get(name);
|
|
57263
57287
|
if (!property) {
|
|
57264
57288
|
property = createUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment);
|
|
57265
57289
|
if (property) {
|
|
@@ -57360,12 +57384,12 @@ function createTypeChecker(host) {
|
|
|
57360
57384
|
return errorInfo;
|
|
57361
57385
|
}
|
|
57362
57386
|
function getPropertyOfType(type, name, skipObjectFunctionPropertyAugment, includeTypeOnlyMembers) {
|
|
57363
|
-
var
|
|
57387
|
+
var _a2, _b;
|
|
57364
57388
|
type = getReducedApparentType(type);
|
|
57365
57389
|
if (type.flags & 524288 /* Object */) {
|
|
57366
57390
|
const resolved = resolveStructuredTypeMembers(type);
|
|
57367
57391
|
const symbol = resolved.members.get(name);
|
|
57368
|
-
if (symbol && !includeTypeOnlyMembers && ((
|
|
57392
|
+
if (symbol && !includeTypeOnlyMembers && ((_a2 = type.symbol) == null ? void 0 : _a2.flags) & 512 /* ValueModule */ && ((_b = getSymbolLinks(type.symbol).typeOnlyExportStarMap) == null ? void 0 : _b.has(name))) {
|
|
57369
57393
|
return void 0;
|
|
57370
57394
|
}
|
|
57371
57395
|
if (symbol && symbolIsValue(symbol, includeTypeOnlyMembers)) {
|
|
@@ -57417,8 +57441,8 @@ function createTypeChecker(host) {
|
|
|
57417
57441
|
}
|
|
57418
57442
|
let memberName;
|
|
57419
57443
|
if (everyType(type, (t) => {
|
|
57420
|
-
var
|
|
57421
|
-
return !!((
|
|
57444
|
+
var _a2;
|
|
57445
|
+
return !!((_a2 = t.symbol) == null ? void 0 : _a2.parent) && isArrayOrTupleSymbol(t.symbol.parent) && (!memberName ? (memberName = t.symbol.escapedName, true) : memberName === t.symbol.escapedName);
|
|
57422
57446
|
})) {
|
|
57423
57447
|
const arrayArg = mapType(type, (t) => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters[0], t.mapper));
|
|
57424
57448
|
const arrayType = createArrayType(arrayArg, someType(type, (t) => isReadonlyArraySymbol(t.symbol.parent)));
|
|
@@ -57482,8 +57506,8 @@ function createTypeChecker(host) {
|
|
|
57482
57506
|
return findIndexInfo(getIndexInfosOfType(type), keyType);
|
|
57483
57507
|
}
|
|
57484
57508
|
function getIndexTypeOfType(type, keyType) {
|
|
57485
|
-
var
|
|
57486
|
-
return (
|
|
57509
|
+
var _a2;
|
|
57510
|
+
return (_a2 = getIndexInfoOfType(type, keyType)) == null ? void 0 : _a2.type;
|
|
57487
57511
|
}
|
|
57488
57512
|
function getApplicableIndexInfos(type, keyType) {
|
|
57489
57513
|
return getIndexInfosOfType(type).filter((info) => isApplicableIndexType(keyType, info.keyType));
|
|
@@ -57495,12 +57519,12 @@ function createTypeChecker(host) {
|
|
|
57495
57519
|
return getApplicableIndexInfo(type, isLateBoundName(name) ? esSymbolType : getStringLiteralType(unescapeLeadingUnderscores(name)));
|
|
57496
57520
|
}
|
|
57497
57521
|
function getTypeParametersFromDeclaration(declaration) {
|
|
57498
|
-
var
|
|
57522
|
+
var _a2;
|
|
57499
57523
|
let result;
|
|
57500
57524
|
for (const node of getEffectiveTypeParameterDeclarations(declaration)) {
|
|
57501
57525
|
result = appendIfUnique(result, getDeclaredTypeOfTypeParameter(node.symbol));
|
|
57502
57526
|
}
|
|
57503
|
-
return (result == null ? void 0 : result.length) ? result : isFunctionDeclaration(declaration) ? (
|
|
57527
|
+
return (result == null ? void 0 : result.length) ? result : isFunctionDeclaration(declaration) ? (_a2 = getSignatureOfTypeTag(declaration)) == null ? void 0 : _a2.typeParameters : void 0;
|
|
57504
57528
|
}
|
|
57505
57529
|
function symbolsToArray(symbols) {
|
|
57506
57530
|
const result = [];
|
|
@@ -57987,9 +58011,9 @@ function createTypeChecker(host) {
|
|
|
57987
58011
|
return signature;
|
|
57988
58012
|
}
|
|
57989
58013
|
function getOrCreateTypeFromSignature(signature, outerTypeParameters) {
|
|
57990
|
-
var
|
|
58014
|
+
var _a2;
|
|
57991
58015
|
if (!signature.isolatedSignatureType) {
|
|
57992
|
-
const kind = (
|
|
58016
|
+
const kind = (_a2 = signature.declaration) == null ? void 0 : _a2.kind;
|
|
57993
58017
|
const isConstructor = kind === void 0 || kind === 176 /* Constructor */ || kind === 180 /* ConstructSignature */ || kind === 185 /* ConstructorType */;
|
|
57994
58018
|
const type = createObjectType(16 /* Anonymous */ | 134217728 /* SingleSignatureType */, createSymbol(16 /* Function */, "__function" /* Function */));
|
|
57995
58019
|
if (signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
|
@@ -58050,9 +58074,9 @@ function createTypeChecker(host) {
|
|
|
58050
58074
|
return mapDefined(filter(type.symbol && type.symbol.declarations, isTypeParameterDeclaration), getEffectiveConstraintOfTypeParameter)[0];
|
|
58051
58075
|
}
|
|
58052
58076
|
function getInferredTypeParameterConstraint(typeParameter, omitTypeReferences) {
|
|
58053
|
-
var
|
|
58077
|
+
var _a2;
|
|
58054
58078
|
let inferences;
|
|
58055
|
-
if ((
|
|
58079
|
+
if ((_a2 = typeParameter.symbol) == null ? void 0 : _a2.declarations) {
|
|
58056
58080
|
for (const declaration of typeParameter.symbol.declarations) {
|
|
58057
58081
|
if (declaration.parent.kind === 195 /* InferType */) {
|
|
58058
58082
|
const [childTypeParameter = declaration.parent, grandParent] = walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent);
|
|
@@ -58193,10 +58217,10 @@ function createTypeChecker(host) {
|
|
|
58193
58217
|
return type;
|
|
58194
58218
|
}
|
|
58195
58219
|
function getTypeArguments(type) {
|
|
58196
|
-
var
|
|
58220
|
+
var _a2, _b;
|
|
58197
58221
|
if (!type.resolvedTypeArguments) {
|
|
58198
58222
|
if (!pushTypeResolution(type, 6 /* ResolvedTypeArguments */)) {
|
|
58199
|
-
return ((
|
|
58223
|
+
return ((_a2 = type.target.localTypeParameters) == null ? void 0 : _a2.map(() => errorType)) || emptyArray;
|
|
58200
58224
|
}
|
|
58201
58225
|
const node = type.node;
|
|
58202
58226
|
const typeArguments = !node ? emptyArray : node.kind === 183 /* TypeReference */ ? concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : node.kind === 188 /* ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : map(node.elements, getTypeFromTypeNode);
|
|
@@ -58327,8 +58351,8 @@ function createTypeChecker(host) {
|
|
|
58327
58351
|
return checkNoTypeArguments(node, symbol) ? type : errorType;
|
|
58328
58352
|
}
|
|
58329
58353
|
function isLocalTypeAlias(symbol) {
|
|
58330
|
-
var
|
|
58331
|
-
const declaration = (
|
|
58354
|
+
var _a2;
|
|
58355
|
+
const declaration = (_a2 = symbol.declarations) == null ? void 0 : _a2.find(isTypeAlias);
|
|
58332
58356
|
return !!(declaration && getContainingFunction(declaration));
|
|
58333
58357
|
}
|
|
58334
58358
|
function getTypeReferenceName(node) {
|
|
@@ -58756,7 +58780,7 @@ function createTypeChecker(host) {
|
|
|
58756
58780
|
return deferredGlobalAsyncIterableType || (deferredGlobalAsyncIterableType = getGlobalType(
|
|
58757
58781
|
"AsyncIterable",
|
|
58758
58782
|
/*arity*/
|
|
58759
|
-
|
|
58783
|
+
1,
|
|
58760
58784
|
reportErrors2
|
|
58761
58785
|
)) || emptyGenericType;
|
|
58762
58786
|
}
|
|
@@ -58772,7 +58796,7 @@ function createTypeChecker(host) {
|
|
|
58772
58796
|
return deferredGlobalAsyncIterableIteratorType || (deferredGlobalAsyncIterableIteratorType = getGlobalType(
|
|
58773
58797
|
"AsyncIterableIterator",
|
|
58774
58798
|
/*arity*/
|
|
58775
|
-
|
|
58799
|
+
1,
|
|
58776
58800
|
reportErrors2
|
|
58777
58801
|
)) || emptyGenericType;
|
|
58778
58802
|
}
|
|
@@ -58788,7 +58812,7 @@ function createTypeChecker(host) {
|
|
|
58788
58812
|
return deferredGlobalIterableType || (deferredGlobalIterableType = getGlobalType(
|
|
58789
58813
|
"Iterable",
|
|
58790
58814
|
/*arity*/
|
|
58791
|
-
|
|
58815
|
+
1,
|
|
58792
58816
|
reportErrors2
|
|
58793
58817
|
)) || emptyGenericType;
|
|
58794
58818
|
}
|
|
@@ -58804,7 +58828,7 @@ function createTypeChecker(host) {
|
|
|
58804
58828
|
return deferredGlobalIterableIteratorType || (deferredGlobalIterableIteratorType = getGlobalType(
|
|
58805
58829
|
"IterableIterator",
|
|
58806
58830
|
/*arity*/
|
|
58807
|
-
|
|
58831
|
+
1,
|
|
58808
58832
|
reportErrors2
|
|
58809
58833
|
)) || emptyGenericType;
|
|
58810
58834
|
}
|
|
@@ -58986,7 +59010,7 @@ function createTypeChecker(host) {
|
|
|
58986
59010
|
return createTypeFromGenericGlobalType(getGlobalIterableType(
|
|
58987
59011
|
/*reportErrors*/
|
|
58988
59012
|
true
|
|
58989
|
-
), [iteratedType
|
|
59013
|
+
), [iteratedType]);
|
|
58990
59014
|
}
|
|
58991
59015
|
function createArrayType(elementType, readonly) {
|
|
58992
59016
|
return createTypeFromGenericGlobalType(readonly ? globalReadonlyArrayType : globalArrayType, [elementType]);
|
|
@@ -59165,7 +59189,7 @@ function createTypeChecker(host) {
|
|
|
59165
59189
|
return target.objectFlags & 8 /* Tuple */ ? createNormalizedTupleType(target, typeArguments) : createTypeReference(target, typeArguments);
|
|
59166
59190
|
}
|
|
59167
59191
|
function createNormalizedTupleType(target, elementTypes) {
|
|
59168
|
-
var
|
|
59192
|
+
var _a2, _b, _c, _d;
|
|
59169
59193
|
if (!(target.combinedFlags & 14 /* NonRequired */)) {
|
|
59170
59194
|
return createTypeReference(target, elementTypes);
|
|
59171
59195
|
}
|
|
@@ -59186,7 +59210,7 @@ function createTypeChecker(host) {
|
|
|
59186
59210
|
const flags = target.elementFlags[i];
|
|
59187
59211
|
if (flags & 8 /* Variadic */) {
|
|
59188
59212
|
if (type.flags & 1 /* Any */) {
|
|
59189
|
-
addElement(type, 4 /* Rest */, (
|
|
59213
|
+
addElement(type, 4 /* Rest */, (_a2 = target.labeledElementDeclarations) == null ? void 0 : _a2[i]);
|
|
59190
59214
|
} else if (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type)) {
|
|
59191
59215
|
addElement(type, 8 /* Variadic */, (_b = target.labeledElementDeclarations) == null ? void 0 : _b[i]);
|
|
59192
59216
|
} else if (isTupleType(type)) {
|
|
@@ -59199,8 +59223,8 @@ function createTypeChecker(host) {
|
|
|
59199
59223
|
return errorType;
|
|
59200
59224
|
}
|
|
59201
59225
|
forEach(elements, (t, n) => {
|
|
59202
|
-
var
|
|
59203
|
-
return addElement(t, type.target.elementFlags[n], (
|
|
59226
|
+
var _a3;
|
|
59227
|
+
return addElement(t, type.target.elementFlags[n], (_a3 = type.target.labeledElementDeclarations) == null ? void 0 : _a3[n]);
|
|
59204
59228
|
});
|
|
59205
59229
|
} else {
|
|
59206
59230
|
addElement(isArrayLikeType(type) && getIndexTypeOfType(type, numberType) || errorType, 4 /* Rest */, (_c = target.labeledElementDeclarations) == null ? void 0 : _c[i]);
|
|
@@ -59324,7 +59348,7 @@ function createTypeChecker(host) {
|
|
|
59324
59348
|
return includes;
|
|
59325
59349
|
}
|
|
59326
59350
|
function removeSubtypes(types, hasObjectTypes) {
|
|
59327
|
-
var
|
|
59351
|
+
var _a2;
|
|
59328
59352
|
if (types.length < 2) {
|
|
59329
59353
|
return types;
|
|
59330
59354
|
}
|
|
@@ -59354,7 +59378,7 @@ function createTypeChecker(host) {
|
|
|
59354
59378
|
if (count === 1e5) {
|
|
59355
59379
|
const estimatedCount = count / (len - i) * len;
|
|
59356
59380
|
if (estimatedCount > 1e6) {
|
|
59357
|
-
(
|
|
59381
|
+
(_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "removeSubtypes_DepthLimit", { typeIds: types.map((t) => t.id) });
|
|
59358
59382
|
error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
|
|
59359
59383
|
return void 0;
|
|
59360
59384
|
}
|
|
@@ -59819,10 +59843,10 @@ function createTypeChecker(host) {
|
|
|
59819
59843
|
return reduceLeft(types, (n, t) => t.flags & 1048576 /* Union */ ? n * t.types.length : t.flags & 131072 /* Never */ ? 0 : n, 1);
|
|
59820
59844
|
}
|
|
59821
59845
|
function checkCrossProductUnion(types) {
|
|
59822
|
-
var
|
|
59846
|
+
var _a2;
|
|
59823
59847
|
const size = getCrossProductUnionSize(types);
|
|
59824
59848
|
if (size >= 1e5) {
|
|
59825
|
-
(
|
|
59849
|
+
(_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "checkCrossProductUnion_DepthLimit", { typeIds: types.map((t) => t.id), size });
|
|
59826
59850
|
error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
|
|
59827
59851
|
return false;
|
|
59828
59852
|
}
|
|
@@ -60010,7 +60034,7 @@ function createTypeChecker(host) {
|
|
|
60010
60034
|
return links.resolvedType;
|
|
60011
60035
|
}
|
|
60012
60036
|
function getTemplateLiteralType(texts, types) {
|
|
60013
|
-
var
|
|
60037
|
+
var _a2, _b;
|
|
60014
60038
|
const unionIndex = findIndex(types, (t) => !!(t.flags & (131072 /* Never */ | 1048576 /* Union */)));
|
|
60015
60039
|
if (unionIndex >= 0) {
|
|
60016
60040
|
return checkCrossProductUnion(types) ? mapType(types[unionIndex], (t) => getTemplateLiteralType(texts, replaceElement(types, unionIndex, t))) : errorType;
|
|
@@ -60018,7 +60042,7 @@ function createTypeChecker(host) {
|
|
|
60018
60042
|
if (contains(types, wildcardType)) {
|
|
60019
60043
|
return wildcardType;
|
|
60020
60044
|
}
|
|
60021
|
-
if (texts.length === 2 && texts[0] === "" && texts[1] === "" && !(types[0].flags & 2944 /* Literal */) && !((_b = (
|
|
60045
|
+
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)) {
|
|
60022
60046
|
return types[0];
|
|
60023
60047
|
}
|
|
60024
60048
|
const newTypes = [];
|
|
@@ -60522,7 +60546,7 @@ function createTypeChecker(host) {
|
|
|
60522
60546
|
if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
|
|
60523
60547
|
indexType = stringType;
|
|
60524
60548
|
}
|
|
60525
|
-
if (
|
|
60549
|
+
if (noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */)
|
|
60526
60550
|
accessFlags |= 1 /* IncludeUndefined */;
|
|
60527
60551
|
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))) {
|
|
60528
60552
|
if (objectType.flags & 3 /* AnyOrUnknown */) {
|
|
@@ -60770,7 +60794,7 @@ function createTypeChecker(host) {
|
|
|
60770
60794
|
}
|
|
60771
60795
|
}
|
|
60772
60796
|
function getTypeFromImportTypeNode(node) {
|
|
60773
|
-
var
|
|
60797
|
+
var _a2;
|
|
60774
60798
|
const links = getNodeLinks(node);
|
|
60775
60799
|
if (!links.resolvedType) {
|
|
60776
60800
|
if (!isLiteralImportTypeNode(node)) {
|
|
@@ -60784,7 +60808,7 @@ function createTypeChecker(host) {
|
|
|
60784
60808
|
links.resolvedSymbol = unknownSymbol;
|
|
60785
60809
|
return links.resolvedType = errorType;
|
|
60786
60810
|
}
|
|
60787
|
-
const isExportEquals = !!((
|
|
60811
|
+
const isExportEquals = !!((_a2 = innerModuleSymbol.exports) == null ? void 0 : _a2.get("export=" /* ExportEquals */));
|
|
60788
60812
|
const moduleSymbol = resolveExternalModuleSymbol(
|
|
60789
60813
|
innerModuleSymbol,
|
|
60790
60814
|
/*dontResolveAlias*/
|
|
@@ -60989,8 +61013,8 @@ function createTypeChecker(host) {
|
|
|
60989
61013
|
return spread;
|
|
60990
61014
|
}
|
|
60991
61015
|
function isSpreadableProperty(prop) {
|
|
60992
|
-
var
|
|
60993
|
-
return !some(prop.declarations, isPrivateIdentifierClassElementDeclaration) && (!(prop.flags & (8192 /* Method */ | 32768 /* GetAccessor */ | 65536 /* SetAccessor */)) || !((
|
|
61016
|
+
var _a2;
|
|
61017
|
+
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))));
|
|
60994
61018
|
}
|
|
60995
61019
|
function getSpreadSymbol(prop, readonly) {
|
|
60996
61020
|
const isSetonlyAccessor = prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */);
|
|
@@ -61632,12 +61656,12 @@ function createTypeChecker(host) {
|
|
|
61632
61656
|
) : type;
|
|
61633
61657
|
}
|
|
61634
61658
|
function instantiateTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
61635
|
-
var
|
|
61659
|
+
var _a2;
|
|
61636
61660
|
if (!couldContainTypeVariables(type)) {
|
|
61637
61661
|
return type;
|
|
61638
61662
|
}
|
|
61639
61663
|
if (instantiationDepth === 100 || instantiationCount >= 5e6) {
|
|
61640
|
-
(
|
|
61664
|
+
(_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "instantiateType_DepthLimit", { typeId: type.id, instantiationDepth, instantiationCount });
|
|
61641
61665
|
error(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
61642
61666
|
return errorType;
|
|
61643
61667
|
}
|
|
@@ -62811,7 +62835,7 @@ function createTypeChecker(host) {
|
|
|
62811
62835
|
return elements !== normalizedElements ? createNormalizedTupleType(type.target, normalizedElements) : type;
|
|
62812
62836
|
}
|
|
62813
62837
|
function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer) {
|
|
62814
|
-
var
|
|
62838
|
+
var _a2;
|
|
62815
62839
|
let errorInfo;
|
|
62816
62840
|
let relatedInfo;
|
|
62817
62841
|
let maybeKeys;
|
|
@@ -62851,7 +62875,7 @@ function createTypeChecker(host) {
|
|
|
62851
62875
|
false
|
|
62852
62876
|
);
|
|
62853
62877
|
relation.set(id, 4 /* Reported */ | 2 /* Failed */);
|
|
62854
|
-
(
|
|
62878
|
+
(_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth: sourceDepth, targetDepth });
|
|
62855
62879
|
const message = relationCount <= 0 ? Diagnostics.Excessive_complexity_comparing_types_0_and_1 : Diagnostics.Excessive_stack_depth_comparing_types_0_and_1;
|
|
62856
62880
|
const diag2 = error(errorNode || currentNode, message, typeToString(source), typeToString(target));
|
|
62857
62881
|
if (errorOutputContainer) {
|
|
@@ -63226,7 +63250,7 @@ function createTypeChecker(host) {
|
|
|
63226
63250
|
return 0 /* False */;
|
|
63227
63251
|
}
|
|
63228
63252
|
function reportErrorResults(originalSource, originalTarget, source2, target2, headMessage2) {
|
|
63229
|
-
var
|
|
63253
|
+
var _a3, _b;
|
|
63230
63254
|
const sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource);
|
|
63231
63255
|
const targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget);
|
|
63232
63256
|
source2 = originalSource.aliasSymbol || sourceHasBase ? originalSource : source2;
|
|
@@ -63276,7 +63300,7 @@ function createTypeChecker(host) {
|
|
|
63276
63300
|
return;
|
|
63277
63301
|
}
|
|
63278
63302
|
reportRelationError(headMessage2, source2, target2);
|
|
63279
|
-
if (source2.flags & 262144 /* TypeParameter */ && ((_b = (
|
|
63303
|
+
if (source2.flags & 262144 /* TypeParameter */ && ((_b = (_a3 = source2.symbol) == null ? void 0 : _a3.declarations) == null ? void 0 : _b[0]) && !getConstraintOfType(source2)) {
|
|
63280
63304
|
const syntheticParam = cloneTypeParameter(source2);
|
|
63281
63305
|
syntheticParam.constraint = instantiateType(target2, makeUnaryTypeMapper(source2, syntheticParam));
|
|
63282
63306
|
if (hasNonCircularBaseConstraint(syntheticParam)) {
|
|
@@ -63311,10 +63335,10 @@ function createTypeChecker(host) {
|
|
|
63311
63335
|
}
|
|
63312
63336
|
function getTypeOfPropertyInTypes(types, name) {
|
|
63313
63337
|
const appendPropType = (propTypes, type) => {
|
|
63314
|
-
var
|
|
63338
|
+
var _a3;
|
|
63315
63339
|
type = getApparentType(type);
|
|
63316
63340
|
const prop = type.flags & 3145728 /* UnionOrIntersection */ ? getPropertyOfUnionOrIntersectionType(type, name) : getPropertyOfObjectType(type, name);
|
|
63317
|
-
const propType = prop && getTypeOfSymbol(prop) || ((
|
|
63341
|
+
const propType = prop && getTypeOfSymbol(prop) || ((_a3 = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a3.type) || undefinedType;
|
|
63318
63342
|
return append(propTypes, propType);
|
|
63319
63343
|
};
|
|
63320
63344
|
return getUnionType(reduceLeft(
|
|
@@ -63325,7 +63349,7 @@ function createTypeChecker(host) {
|
|
|
63325
63349
|
) || emptyArray);
|
|
63326
63350
|
}
|
|
63327
63351
|
function hasExcessProperties(source2, target2, reportErrors2) {
|
|
63328
|
-
var
|
|
63352
|
+
var _a3;
|
|
63329
63353
|
if (!isExcessPropertyCheckTarget(target2) || !noImplicitAny && getObjectFlags(target2) & 4096 /* JSLiteral */) {
|
|
63330
63354
|
return false;
|
|
63331
63355
|
}
|
|
@@ -63359,7 +63383,7 @@ function createTypeChecker(host) {
|
|
|
63359
63383
|
reportError(Diagnostics.Property_0_does_not_exist_on_type_1, propName, typeToString(errorTarget));
|
|
63360
63384
|
}
|
|
63361
63385
|
} else {
|
|
63362
|
-
const objectLiteralDeclaration = ((
|
|
63386
|
+
const objectLiteralDeclaration = ((_a3 = source2.symbol) == null ? void 0 : _a3.declarations) && firstOrUndefined(source2.symbol.declarations);
|
|
63363
63387
|
let suggestion;
|
|
63364
63388
|
if (prop.valueDeclaration && findAncestor(prop.valueDeclaration, (d) => d === objectLiteralDeclaration) && getSourceFileOfNode(objectLiteralDeclaration) === getSourceFileOfNode(errorNode)) {
|
|
63365
63389
|
const propDeclaration = prop.valueDeclaration;
|
|
@@ -63699,7 +63723,7 @@ function createTypeChecker(host) {
|
|
|
63699
63723
|
return result2;
|
|
63700
63724
|
}
|
|
63701
63725
|
function recursiveTypeRelatedTo(source2, target2, reportErrors2, intersectionState, recursionFlags) {
|
|
63702
|
-
var
|
|
63726
|
+
var _a3, _b, _c;
|
|
63703
63727
|
if (overflow) {
|
|
63704
63728
|
return 0 /* False */;
|
|
63705
63729
|
}
|
|
@@ -63784,7 +63808,7 @@ function createTypeChecker(host) {
|
|
|
63784
63808
|
}
|
|
63785
63809
|
let result2;
|
|
63786
63810
|
if (expandingFlags === 3 /* Both */) {
|
|
63787
|
-
(
|
|
63811
|
+
(_a3 = tracing) == null ? void 0 : _a3.instant(tracing.Phase.CheckTypes, "recursiveTypeRelatedTo_DepthLimit", {
|
|
63788
63812
|
sourceId: source2.id,
|
|
63789
63813
|
sourceIdStack: sourceStack.map((t) => t.id),
|
|
63790
63814
|
targetId: target2.id,
|
|
@@ -64465,7 +64489,7 @@ function createTypeChecker(host) {
|
|
|
64465
64489
|
return 0 /* False */;
|
|
64466
64490
|
}
|
|
64467
64491
|
function typeRelatedToDiscriminatedType(source2, target2) {
|
|
64468
|
-
var
|
|
64492
|
+
var _a3;
|
|
64469
64493
|
const sourceProperties = getPropertiesOfType(source2);
|
|
64470
64494
|
const sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target2);
|
|
64471
64495
|
if (!sourcePropertiesFiltered)
|
|
@@ -64474,7 +64498,7 @@ function createTypeChecker(host) {
|
|
|
64474
64498
|
for (const sourceProperty of sourcePropertiesFiltered) {
|
|
64475
64499
|
numCombinations *= countTypes(getNonMissingTypeOfSymbol(sourceProperty));
|
|
64476
64500
|
if (numCombinations > 25) {
|
|
64477
|
-
(
|
|
64501
|
+
(_a3 = tracing) == null ? void 0 : _a3.instant(tracing.Phase.CheckTypes, "typeRelatedToDiscriminatedType_DepthLimit", { sourceId: source2.id, targetId: target2.id, numCombinations });
|
|
64478
64502
|
return 0 /* False */;
|
|
64479
64503
|
}
|
|
64480
64504
|
}
|
|
@@ -64881,7 +64905,7 @@ function createTypeChecker(host) {
|
|
|
64881
64905
|
return result2;
|
|
64882
64906
|
}
|
|
64883
64907
|
function signaturesRelatedTo(source2, target2, kind, reportErrors2, intersectionState) {
|
|
64884
|
-
var
|
|
64908
|
+
var _a3, _b;
|
|
64885
64909
|
if (relation === identityRelation) {
|
|
64886
64910
|
return signaturesIdenticalTo(source2, target2, kind);
|
|
64887
64911
|
}
|
|
@@ -64937,7 +64961,7 @@ function createTypeChecker(host) {
|
|
|
64937
64961
|
const sourceSignature = first(sourceSignatures);
|
|
64938
64962
|
const targetSignature = first(targetSignatures);
|
|
64939
64963
|
result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, intersectionState, incompatibleReporter(sourceSignature, targetSignature));
|
|
64940
|
-
if (!result2 && reportErrors2 && kind === 1 /* Construct */ && sourceObjectFlags & targetObjectFlags && (((
|
|
64964
|
+
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 */)) {
|
|
64941
64965
|
const constructSignatureToString = (signature) => signatureToString(
|
|
64942
64966
|
signature,
|
|
64943
64967
|
/*enclosingDeclaration*/
|
|
@@ -65255,10 +65279,10 @@ function createTypeChecker(host) {
|
|
|
65255
65279
|
return getVariancesWorker(symbol, getSymbolLinks(symbol).typeParameters);
|
|
65256
65280
|
}
|
|
65257
65281
|
function getVariancesWorker(symbol, typeParameters = emptyArray) {
|
|
65258
|
-
var
|
|
65282
|
+
var _a2, _b;
|
|
65259
65283
|
const links = getSymbolLinks(symbol);
|
|
65260
65284
|
if (!links.variances) {
|
|
65261
|
-
(
|
|
65285
|
+
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.CheckTypes, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
|
|
65262
65286
|
const oldVarianceComputation = inVarianceComputation;
|
|
65263
65287
|
const saveResolutionStart = resolutionStart;
|
|
65264
65288
|
if (!inVarianceComputation) {
|
|
@@ -65316,8 +65340,8 @@ function createTypeChecker(host) {
|
|
|
65316
65340
|
return markerTypes.has(getTypeId(type));
|
|
65317
65341
|
}
|
|
65318
65342
|
function getTypeParameterModifiers(tp) {
|
|
65319
|
-
var
|
|
65320
|
-
return reduceLeft((
|
|
65343
|
+
var _a2;
|
|
65344
|
+
return reduceLeft((_a2 = tp.symbol) == null ? void 0 : _a2.declarations, (modifiers, d) => modifiers | getEffectiveModifierFlags(d), 0 /* None */) & (8192 /* In */ | 16384 /* Out */ | 4096 /* Const */);
|
|
65321
65345
|
}
|
|
65322
65346
|
function hasCovariantVoidArgument(typeArguments, variances) {
|
|
65323
65347
|
for (let i = 0; i < variances.length; i++) {
|
|
@@ -65375,7 +65399,7 @@ function createTypeChecker(host) {
|
|
|
65375
65399
|
return isTypeReferenceWithGenericArguments(source) && isTypeReferenceWithGenericArguments(target) ? getGenericTypeReferenceRelationKey(source, target, postFix, ignoreConstraints) : `${source.id},${target.id}${postFix}`;
|
|
65376
65400
|
}
|
|
65377
65401
|
function forEachProperty(prop, callback) {
|
|
65378
|
-
if (getCheckFlags(prop) & 6 /*
|
|
65402
|
+
if (getCheckFlags(prop) & 6 /* SyntheticMember */) {
|
|
65379
65403
|
for (const t of prop.links.containingType.types) {
|
|
65380
65404
|
const p = getPropertyOfType(t, prop.escapedName);
|
|
65381
65405
|
const result = p && forEachProperty(p, callback);
|
|
@@ -65673,7 +65697,7 @@ function createTypeChecker(host) {
|
|
|
65673
65697
|
return propType;
|
|
65674
65698
|
}
|
|
65675
65699
|
if (everyType(type, isTupleType)) {
|
|
65676
|
-
return getTupleElementTypeOutOfStartCount(type, index,
|
|
65700
|
+
return getTupleElementTypeOutOfStartCount(type, index, noUncheckedIndexedAccess ? undefinedType : void 0);
|
|
65677
65701
|
}
|
|
65678
65702
|
return void 0;
|
|
65679
65703
|
}
|
|
@@ -66992,7 +67016,7 @@ function createTypeChecker(host) {
|
|
|
66992
67016
|
inferFromTypes(sourceNameType, targetNameType);
|
|
66993
67017
|
}
|
|
66994
67018
|
function inferFromObjectTypes(source, target) {
|
|
66995
|
-
var
|
|
67019
|
+
var _a2, _b;
|
|
66996
67020
|
if (getObjectFlags(source) & 4 /* Reference */ && getObjectFlags(target) & 4 /* Reference */ && (source.target === target.target || isArrayType(source) && isArrayType(target))) {
|
|
66997
67021
|
inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target));
|
|
66998
67022
|
return;
|
|
@@ -67039,7 +67063,7 @@ function createTypeChecker(host) {
|
|
|
67039
67063
|
inferFromTypes(sliceTupleType(source, startLength + targetInfo.impliedArity, endLength), elementTypes[startLength + 1]);
|
|
67040
67064
|
}
|
|
67041
67065
|
} else if (elementFlags[startLength] & 8 /* Variadic */ && elementFlags[startLength + 1] & 4 /* Rest */) {
|
|
67042
|
-
const param = (
|
|
67066
|
+
const param = (_a2 = getInferenceInfoForType(elementTypes[startLength])) == null ? void 0 : _a2.typeParameter;
|
|
67043
67067
|
const constraint = param && getBaseConstraintOfType(param);
|
|
67044
67068
|
if (constraint && isTupleType(constraint) && !constraint.target.hasRestElement) {
|
|
67045
67069
|
const impliedArity = constraint.target.fixedLength;
|
|
@@ -67526,8 +67550,8 @@ function createTypeChecker(host) {
|
|
|
67526
67550
|
return unionType.keyPropertyName.length ? unionType.keyPropertyName : void 0;
|
|
67527
67551
|
}
|
|
67528
67552
|
function getConstituentTypeForKeyType(unionType, keyType) {
|
|
67529
|
-
var
|
|
67530
|
-
const result = (
|
|
67553
|
+
var _a2;
|
|
67554
|
+
const result = (_a2 = unionType.constituentMap) == null ? void 0 : _a2.get(getTypeId(getRegularTypeOfLiteralType(keyType)));
|
|
67531
67555
|
return result !== unknownType ? result : void 0;
|
|
67532
67556
|
}
|
|
67533
67557
|
function getMatchingUnionConstituentForType(unionType, type) {
|
|
@@ -67711,12 +67735,12 @@ function createTypeChecker(host) {
|
|
|
67711
67735
|
return defaultExpression ? getUnionType([getNonUndefinedType(type), getTypeOfExpression(defaultExpression)]) : type;
|
|
67712
67736
|
}
|
|
67713
67737
|
function getTypeOfDestructuredProperty(type, name) {
|
|
67714
|
-
var
|
|
67738
|
+
var _a2;
|
|
67715
67739
|
const nameType = getLiteralTypeFromPropertyName(name);
|
|
67716
67740
|
if (!isTypeUsableAsPropertyName(nameType))
|
|
67717
67741
|
return errorType;
|
|
67718
67742
|
const text = getPropertyNameFromType(nameType);
|
|
67719
|
-
return getTypeOfPropertyOfType(type, text) || includeUndefinedInIndexSignature((
|
|
67743
|
+
return getTypeOfPropertyOfType(type, text) || includeUndefinedInIndexSignature((_a2 = getApplicableIndexInfoForName(type, text)) == null ? void 0 : _a2.type) || errorType;
|
|
67720
67744
|
}
|
|
67721
67745
|
function getTypeOfDestructuredArrayElement(type, index) {
|
|
67722
67746
|
return everyType(type, isTupleLikeType) && getTupleElementType(type, index) || includeUndefinedInIndexSignature(checkIteratedTypeOrElementType(
|
|
@@ -67730,7 +67754,7 @@ function createTypeChecker(host) {
|
|
|
67730
67754
|
function includeUndefinedInIndexSignature(type) {
|
|
67731
67755
|
if (!type)
|
|
67732
67756
|
return type;
|
|
67733
|
-
return
|
|
67757
|
+
return noUncheckedIndexedAccess ? getUnionType([type, missingType]) : type;
|
|
67734
67758
|
}
|
|
67735
67759
|
function getTypeOfDestructuredSpreadExpression(type) {
|
|
67736
67760
|
return createArrayType(checkIteratedTypeOrElementType(
|
|
@@ -68293,7 +68317,7 @@ function createTypeChecker(host) {
|
|
|
68293
68317
|
}
|
|
68294
68318
|
return false;
|
|
68295
68319
|
}
|
|
68296
|
-
function getFlowTypeOfReference(reference, declaredType, initialType = declaredType, flowContainer, flowNode = ((
|
|
68320
|
+
function getFlowTypeOfReference(reference, declaredType, initialType = declaredType, flowContainer, flowNode = ((_b) => (_b = tryCast(reference, canHaveFlowNode)) == null ? void 0 : _b.flowNode)()) {
|
|
68297
68321
|
let key;
|
|
68298
68322
|
let isKeySet = false;
|
|
68299
68323
|
let flowDepth = 0;
|
|
@@ -69028,7 +69052,7 @@ function createTypeChecker(host) {
|
|
|
69028
69052
|
if (!hasDefaultClause) {
|
|
69029
69053
|
return caseType;
|
|
69030
69054
|
}
|
|
69031
|
-
const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, getRegularTypeOfLiteralType(extractUnitType(t)))));
|
|
69055
|
+
const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, t.flags & 32768 /* Undefined */ ? undefinedType : getRegularTypeOfLiteralType(extractUnitType(t)))));
|
|
69032
69056
|
return caseType.flags & 131072 /* Never */ ? defaultType : getUnionType([caseType, defaultType]);
|
|
69033
69057
|
}
|
|
69034
69058
|
function narrowTypeByTypeName(type, typeName) {
|
|
@@ -69555,7 +69579,7 @@ function createTypeChecker(host) {
|
|
|
69555
69579
|
}
|
|
69556
69580
|
}
|
|
69557
69581
|
function getNarrowedTypeOfSymbol(symbol, location, checkMode) {
|
|
69558
|
-
var
|
|
69582
|
+
var _a2;
|
|
69559
69583
|
const type = getTypeOfSymbol(symbol, checkMode);
|
|
69560
69584
|
const declaration = symbol.valueDeclaration;
|
|
69561
69585
|
if (declaration) {
|
|
@@ -69597,7 +69621,7 @@ function createTypeChecker(host) {
|
|
|
69597
69621
|
if (func.parameters.length >= 2 && isContextSensitiveFunctionOrObjectLiteralMethod(func)) {
|
|
69598
69622
|
const contextualSignature = getContextualSignature(func);
|
|
69599
69623
|
if (contextualSignature && contextualSignature.parameters.length === 1 && signatureHasRestParameter(contextualSignature)) {
|
|
69600
|
-
const restType = getReducedApparentType(instantiateType(getTypeOfSymbol(contextualSignature.parameters[0]), (
|
|
69624
|
+
const restType = getReducedApparentType(instantiateType(getTypeOfSymbol(contextualSignature.parameters[0]), (_a2 = getInferenceContext(func)) == null ? void 0 : _a2.nonFixingMapper));
|
|
69601
69625
|
if (restType.flags & 1048576 /* Union */ && everyType(restType, isTupleType) && !some(func.parameters, isSomeSymbolAssigned)) {
|
|
69602
69626
|
const narrowedType = getFlowTypeOfReference(
|
|
69603
69627
|
func,
|
|
@@ -69749,7 +69773,7 @@ function createTypeChecker(host) {
|
|
|
69749
69773
|
}
|
|
69750
69774
|
}
|
|
69751
69775
|
function shouldMarkIdentifierAliasReferenced(node) {
|
|
69752
|
-
var
|
|
69776
|
+
var _a2;
|
|
69753
69777
|
const parent = node.parent;
|
|
69754
69778
|
if (parent) {
|
|
69755
69779
|
if (isPropertyAccessExpression(parent) && parent.expression === node) {
|
|
@@ -69758,7 +69782,7 @@ function createTypeChecker(host) {
|
|
|
69758
69782
|
if (isExportSpecifier(parent) && parent.isTypeOnly) {
|
|
69759
69783
|
return false;
|
|
69760
69784
|
}
|
|
69761
|
-
const greatGrandparent = (
|
|
69785
|
+
const greatGrandparent = (_a2 = parent.parent) == null ? void 0 : _a2.parent;
|
|
69762
69786
|
if (greatGrandparent && isExportDeclaration(greatGrandparent) && greatGrandparent.isTypeOnly) {
|
|
69763
69787
|
return false;
|
|
69764
69788
|
}
|
|
@@ -70490,7 +70514,7 @@ function createTypeChecker(host) {
|
|
|
70490
70514
|
}
|
|
70491
70515
|
}
|
|
70492
70516
|
function getContextualTypeForAssignmentDeclaration(binaryExpression) {
|
|
70493
|
-
var
|
|
70517
|
+
var _a2, _b;
|
|
70494
70518
|
const kind = getAssignmentDeclarationKind(binaryExpression);
|
|
70495
70519
|
switch (kind) {
|
|
70496
70520
|
case 0 /* None */:
|
|
@@ -70549,7 +70573,7 @@ function createTypeChecker(host) {
|
|
|
70549
70573
|
case 2 /* ModuleExports */:
|
|
70550
70574
|
let valueDeclaration;
|
|
70551
70575
|
if (kind !== 2 /* ModuleExports */) {
|
|
70552
|
-
valueDeclaration = canHaveSymbol(binaryExpression.left) ? (
|
|
70576
|
+
valueDeclaration = canHaveSymbol(binaryExpression.left) ? (_a2 = binaryExpression.left.symbol) == null ? void 0 : _a2.valueDeclaration : void 0;
|
|
70553
70577
|
}
|
|
70554
70578
|
valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) == null ? void 0 : _b.valueDeclaration);
|
|
70555
70579
|
const annotated = valueDeclaration && getEffectiveTypeAnnotationNode(valueDeclaration);
|
|
@@ -70616,7 +70640,7 @@ function createTypeChecker(host) {
|
|
|
70616
70640
|
return mapType(
|
|
70617
70641
|
type,
|
|
70618
70642
|
(t) => {
|
|
70619
|
-
var
|
|
70643
|
+
var _a2;
|
|
70620
70644
|
if (isGenericMappedType(t) && !t.declaration.nameType) {
|
|
70621
70645
|
const constraint = getConstraintTypeFromMappedType(t);
|
|
70622
70646
|
const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
|
|
@@ -70644,7 +70668,7 @@ function createTypeChecker(host) {
|
|
|
70644
70668
|
return restType;
|
|
70645
70669
|
}
|
|
70646
70670
|
}
|
|
70647
|
-
return (
|
|
70671
|
+
return (_a2 = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(unescapeLeadingUnderscores(name)))) == null ? void 0 : _a2.type;
|
|
70648
70672
|
}
|
|
70649
70673
|
return void 0;
|
|
70650
70674
|
},
|
|
@@ -70686,8 +70710,8 @@ function createTypeChecker(host) {
|
|
|
70686
70710
|
return mapType(
|
|
70687
70711
|
type,
|
|
70688
70712
|
(t) => {
|
|
70689
|
-
var
|
|
70690
|
-
return (
|
|
70713
|
+
var _a2;
|
|
70714
|
+
return (_a2 = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType)) == null ? void 0 : _a2.type;
|
|
70691
70715
|
},
|
|
70692
70716
|
/*noReductions*/
|
|
70693
70717
|
true
|
|
@@ -70806,60 +70830,71 @@ function createTypeChecker(host) {
|
|
|
70806
70830
|
return false;
|
|
70807
70831
|
}
|
|
70808
70832
|
function discriminateContextualTypeByObjectMembers(node, contextualType) {
|
|
70809
|
-
|
|
70810
|
-
|
|
70811
|
-
|
|
70812
|
-
|
|
70813
|
-
|
|
70814
|
-
|
|
70833
|
+
const key = `D${getNodeId(node)},${getTypeId(contextualType)}`;
|
|
70834
|
+
return getCachedType(key) ?? setCachedType(
|
|
70835
|
+
key,
|
|
70836
|
+
getMatchingUnionConstituentForObjectLiteral(contextualType, node) ?? discriminateTypeByDiscriminableItems(
|
|
70837
|
+
contextualType,
|
|
70838
|
+
concatenate(
|
|
70839
|
+
map(
|
|
70840
|
+
filter(node.properties, (p) => {
|
|
70841
|
+
if (!p.symbol) {
|
|
70842
|
+
return false;
|
|
70843
|
+
}
|
|
70844
|
+
if (p.kind === 303 /* PropertyAssignment */) {
|
|
70845
|
+
return isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName);
|
|
70846
|
+
}
|
|
70847
|
+
if (p.kind === 304 /* ShorthandPropertyAssignment */) {
|
|
70848
|
+
return isDiscriminantProperty(contextualType, p.symbol.escapedName);
|
|
70849
|
+
}
|
|
70815
70850
|
return false;
|
|
70816
|
-
}
|
|
70817
|
-
|
|
70818
|
-
|
|
70819
|
-
|
|
70820
|
-
|
|
70821
|
-
|
|
70822
|
-
|
|
70823
|
-
|
|
70824
|
-
|
|
70825
|
-
|
|
70851
|
+
}),
|
|
70852
|
+
(prop) => [() => getContextFreeTypeOfExpression(prop.kind === 303 /* PropertyAssignment */ ? prop.initializer : prop.name), prop.symbol.escapedName]
|
|
70853
|
+
),
|
|
70854
|
+
map(
|
|
70855
|
+
filter(getPropertiesOfType(contextualType), (s) => {
|
|
70856
|
+
var _a2;
|
|
70857
|
+
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);
|
|
70858
|
+
}),
|
|
70859
|
+
(s) => [() => undefinedType, s.escapedName]
|
|
70860
|
+
)
|
|
70826
70861
|
),
|
|
70827
|
-
|
|
70828
|
-
|
|
70829
|
-
var _a;
|
|
70830
|
-
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);
|
|
70831
|
-
}),
|
|
70832
|
-
(s) => [() => undefinedType, s.escapedName]
|
|
70833
|
-
)
|
|
70834
|
-
),
|
|
70835
|
-
isTypeAssignableTo
|
|
70862
|
+
isTypeAssignableTo
|
|
70863
|
+
)
|
|
70836
70864
|
);
|
|
70837
70865
|
}
|
|
70838
70866
|
function discriminateContextualTypeByJSXAttributes(node, contextualType) {
|
|
70867
|
+
const key = `D${getNodeId(node)},${getTypeId(contextualType)}`;
|
|
70868
|
+
const cached = getCachedType(key);
|
|
70869
|
+
if (cached)
|
|
70870
|
+
return cached;
|
|
70839
70871
|
const jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
|
|
70840
|
-
return
|
|
70841
|
-
|
|
70842
|
-
|
|
70843
|
-
|
|
70844
|
-
|
|
70845
|
-
(
|
|
70872
|
+
return setCachedType(
|
|
70873
|
+
key,
|
|
70874
|
+
discriminateTypeByDiscriminableItems(
|
|
70875
|
+
contextualType,
|
|
70876
|
+
concatenate(
|
|
70877
|
+
map(
|
|
70878
|
+
filter(node.properties, (p) => !!p.symbol && p.kind === 291 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer))),
|
|
70879
|
+
(prop) => [!prop.initializer ? () => trueType : () => getContextFreeTypeOfExpression(prop.initializer), prop.symbol.escapedName]
|
|
70880
|
+
),
|
|
70881
|
+
map(
|
|
70882
|
+
filter(getPropertiesOfType(contextualType), (s) => {
|
|
70883
|
+
var _a2;
|
|
70884
|
+
if (!(s.flags & 16777216 /* Optional */) || !((_a2 = node == null ? void 0 : node.symbol) == null ? void 0 : _a2.members)) {
|
|
70885
|
+
return false;
|
|
70886
|
+
}
|
|
70887
|
+
const element = node.parent.parent;
|
|
70888
|
+
if (s.escapedName === jsxChildrenPropertyName && isJsxElement(element) && getSemanticJsxChildren(element.children).length) {
|
|
70889
|
+
return false;
|
|
70890
|
+
}
|
|
70891
|
+
return !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName);
|
|
70892
|
+
}),
|
|
70893
|
+
(s) => [() => undefinedType, s.escapedName]
|
|
70894
|
+
)
|
|
70846
70895
|
),
|
|
70847
|
-
|
|
70848
|
-
|
|
70849
|
-
var _a;
|
|
70850
|
-
if (!(s.flags & 16777216 /* Optional */) || !((_a = node == null ? void 0 : node.symbol) == null ? void 0 : _a.members)) {
|
|
70851
|
-
return false;
|
|
70852
|
-
}
|
|
70853
|
-
const element = node.parent.parent;
|
|
70854
|
-
if (s.escapedName === jsxChildrenPropertyName && isJsxElement(element) && getSemanticJsxChildren(element.children).length) {
|
|
70855
|
-
return false;
|
|
70856
|
-
}
|
|
70857
|
-
return !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName);
|
|
70858
|
-
}),
|
|
70859
|
-
(s) => [() => undefinedType, s.escapedName]
|
|
70860
|
-
)
|
|
70861
|
-
),
|
|
70862
|
-
isTypeAssignableTo
|
|
70896
|
+
isTypeAssignableTo
|
|
70897
|
+
)
|
|
70863
70898
|
);
|
|
70864
70899
|
}
|
|
70865
70900
|
function getApparentTypeOfContextualType(node, contextFlags) {
|
|
@@ -70905,7 +70940,7 @@ function createTypeChecker(host) {
|
|
|
70905
70940
|
return type;
|
|
70906
70941
|
}
|
|
70907
70942
|
function getContextualType(node, contextFlags) {
|
|
70908
|
-
var
|
|
70943
|
+
var _a2;
|
|
70909
70944
|
if (node.flags & 67108864 /* InWithStatement */) {
|
|
70910
70945
|
return void 0;
|
|
70911
70946
|
}
|
|
@@ -70951,7 +70986,7 @@ function createTypeChecker(host) {
|
|
|
70951
70986
|
const arrayLiteral = parent;
|
|
70952
70987
|
const type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
|
|
70953
70988
|
const elementIndex = indexOfNode(arrayLiteral.elements, node);
|
|
70954
|
-
const spreadIndices = (
|
|
70989
|
+
const spreadIndices = (_a2 = getNodeLinks(arrayLiteral)).spreadIndices ?? (_a2.spreadIndices = getSpreadIndices(arrayLiteral.elements));
|
|
70955
70990
|
return getContextualTypeForElementExpression(type, elementIndex, arrayLiteral.elements.length, spreadIndices.first, spreadIndices.last);
|
|
70956
70991
|
}
|
|
70957
70992
|
case 227 /* ConditionalExpression */:
|
|
@@ -71483,13 +71518,13 @@ function createTypeChecker(host) {
|
|
|
71483
71518
|
return links.resolvedType;
|
|
71484
71519
|
}
|
|
71485
71520
|
function isSymbolWithNumericName(symbol) {
|
|
71486
|
-
var
|
|
71487
|
-
const firstDecl = (
|
|
71521
|
+
var _a2;
|
|
71522
|
+
const firstDecl = (_a2 = symbol.declarations) == null ? void 0 : _a2[0];
|
|
71488
71523
|
return isNumericLiteralName(symbol.escapedName) || firstDecl && isNamedDeclaration(firstDecl) && isNumericName(firstDecl.name);
|
|
71489
71524
|
}
|
|
71490
71525
|
function isSymbolWithSymbolName(symbol) {
|
|
71491
|
-
var
|
|
71492
|
-
const firstDecl = (
|
|
71526
|
+
var _a2;
|
|
71527
|
+
const firstDecl = (_a2 = symbol.declarations) == null ? void 0 : _a2[0];
|
|
71493
71528
|
return isKnownSymbol(symbol) || firstDecl && isNamedDeclaration(firstDecl) && isComputedPropertyName(firstDecl.name) && isTypeAssignableToKind(checkComputedPropertyName(firstDecl.name), 4096 /* ESSymbol */);
|
|
71494
71529
|
}
|
|
71495
71530
|
function getObjectLiteralIndexInfo(node, offset, properties, keyType) {
|
|
@@ -71519,7 +71554,7 @@ function createTypeChecker(host) {
|
|
|
71519
71554
|
return links.immediateTarget;
|
|
71520
71555
|
}
|
|
71521
71556
|
function checkObjectLiteral(node, checkMode = 0 /* Normal */) {
|
|
71522
|
-
var
|
|
71557
|
+
var _a2;
|
|
71523
71558
|
const inDestructuringPattern = isAssignmentTarget(node);
|
|
71524
71559
|
checkGrammarObjectLiteralExpression(node, inDestructuringPattern);
|
|
71525
71560
|
const allPropertiesTable = strictNullChecks ? createSymbolTable() : void 0;
|
|
@@ -71660,7 +71695,7 @@ function createTypeChecker(host) {
|
|
|
71660
71695
|
for (const prop of getPropertiesOfType(contextualType)) {
|
|
71661
71696
|
if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) {
|
|
71662
71697
|
if (!(prop.flags & 16777216 /* Optional */)) {
|
|
71663
|
-
error(prop.valueDeclaration || ((
|
|
71698
|
+
error(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);
|
|
71664
71699
|
}
|
|
71665
71700
|
propertiesTable.set(prop.escapedName, prop);
|
|
71666
71701
|
propertiesArray.push(prop);
|
|
@@ -72124,7 +72159,7 @@ function createTypeChecker(host) {
|
|
|
72124
72159
|
}
|
|
72125
72160
|
}
|
|
72126
72161
|
function getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node) {
|
|
72127
|
-
var
|
|
72162
|
+
var _a2;
|
|
72128
72163
|
Debug.assert(isJsxIntrinsicTagName(node.tagName));
|
|
72129
72164
|
const links = getNodeLinks(node);
|
|
72130
72165
|
if (!links.resolvedJsxElementAttributesType) {
|
|
@@ -72133,7 +72168,7 @@ function createTypeChecker(host) {
|
|
|
72133
72168
|
return links.resolvedJsxElementAttributesType = getTypeOfSymbol(symbol) || errorType;
|
|
72134
72169
|
} else if (links.jsxFlags & 2 /* IntrinsicIndexedElement */) {
|
|
72135
72170
|
const propName = isJsxNamespacedName(node.tagName) ? getEscapedTextOfJsxNamespacedName(node.tagName) : node.tagName.escapedText;
|
|
72136
|
-
return links.resolvedJsxElementAttributesType = ((
|
|
72171
|
+
return links.resolvedJsxElementAttributesType = ((_a2 = getApplicableIndexInfoForName(getJsxType(JsxNames.IntrinsicElements, node), propName)) == null ? void 0 : _a2.type) || errorType;
|
|
72137
72172
|
} else {
|
|
72138
72173
|
return links.resolvedJsxElementAttributesType = errorType;
|
|
72139
72174
|
}
|
|
@@ -72310,7 +72345,7 @@ function createTypeChecker(host) {
|
|
|
72310
72345
|
return checkPropertyAccessibilityAtLocation(node, isSuper, writing, type, prop, errorNode);
|
|
72311
72346
|
}
|
|
72312
72347
|
function checkPropertyAccessibilityAtLocation(location, isSuper, writing, containingType, prop, errorNode) {
|
|
72313
|
-
var
|
|
72348
|
+
var _a2;
|
|
72314
72349
|
const flags = getDeclarationModifierFlagsFromSymbol(prop, writing);
|
|
72315
72350
|
if (isSuper) {
|
|
72316
72351
|
if (languageVersion < 2 /* ES2015 */) {
|
|
@@ -72327,7 +72362,7 @@ function createTypeChecker(host) {
|
|
|
72327
72362
|
}
|
|
72328
72363
|
return false;
|
|
72329
72364
|
}
|
|
72330
|
-
if (!(flags & 256 /* Static */) && ((
|
|
72365
|
+
if (!(flags & 256 /* Static */) && ((_a2 = prop.declarations) == null ? void 0 : _a2.some(isClassInstanceProperty))) {
|
|
72331
72366
|
if (errorNode) {
|
|
72332
72367
|
error(errorNode, Diagnostics.Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super, symbolToString(prop));
|
|
72333
72368
|
}
|
|
@@ -72714,7 +72749,7 @@ function createTypeChecker(host) {
|
|
|
72714
72749
|
error(node, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(apparentType));
|
|
72715
72750
|
}
|
|
72716
72751
|
propType = indexInfo.type;
|
|
72717
|
-
if (
|
|
72752
|
+
if (noUncheckedIndexedAccess && getAssignmentTargetKind(node) !== 1 /* Definite */) {
|
|
72718
72753
|
propType = getUnionType([propType, missingType]);
|
|
72719
72754
|
}
|
|
72720
72755
|
if (compilerOptions.noPropertyAccessFromIndexSignature && isPropertyAccessExpression(node)) {
|
|
@@ -72741,12 +72776,12 @@ function createTypeChecker(host) {
|
|
|
72741
72776
|
return getFlowTypeOfAccessExpression(node, prop, propType, right, checkMode);
|
|
72742
72777
|
}
|
|
72743
72778
|
function isUncheckedJSSuggestion(node, suggestion, excludeClasses) {
|
|
72744
|
-
var
|
|
72779
|
+
var _a2;
|
|
72745
72780
|
const file = getSourceFileOfNode(node);
|
|
72746
72781
|
if (file) {
|
|
72747
72782
|
if (compilerOptions.checkJs === void 0 && file.checkJsDirective === void 0 && (file.scriptKind === 1 /* JS */ || file.scriptKind === 2 /* JSX */)) {
|
|
72748
72783
|
const declarationFile = forEach(suggestion == null ? void 0 : suggestion.declarations, getSourceFileOfNode);
|
|
72749
|
-
const suggestionHasNoExtendsOrDecorators = !(suggestion == null ? void 0 : suggestion.valueDeclaration) || !isClassLike(suggestion.valueDeclaration) || ((
|
|
72784
|
+
const suggestionHasNoExtendsOrDecorators = !(suggestion == null ? void 0 : suggestion.valueDeclaration) || !isClassLike(suggestion.valueDeclaration) || ((_a2 = suggestion.valueDeclaration.heritageClauses) == null ? void 0 : _a2.length) || classOrConstructorParameterIsDecorated(
|
|
72750
72785
|
/*useLegacyDecorators*/
|
|
72751
72786
|
false,
|
|
72752
72787
|
suggestion.valueDeclaration
|
|
@@ -73544,7 +73579,7 @@ function createTypeChecker(host) {
|
|
|
73544
73579
|
errorOutputContainer
|
|
73545
73580
|
);
|
|
73546
73581
|
function checkTagNameDoesNotExpectTooManyArguments() {
|
|
73547
|
-
var
|
|
73582
|
+
var _a2;
|
|
73548
73583
|
if (getJsxNamespaceContainerForImplicitImport(node)) {
|
|
73549
73584
|
return true;
|
|
73550
73585
|
}
|
|
@@ -73610,7 +73645,7 @@ function createTypeChecker(host) {
|
|
|
73610
73645
|
}
|
|
73611
73646
|
if (reportErrors2) {
|
|
73612
73647
|
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);
|
|
73613
|
-
const tagNameDeclaration = (
|
|
73648
|
+
const tagNameDeclaration = (_a2 = getSymbolAtLocation(node.tagName)) == null ? void 0 : _a2.valueDeclaration;
|
|
73614
73649
|
if (tagNameDeclaration) {
|
|
73615
73650
|
addRelatedInfo(diag2, createDiagnosticForNode(tagNameDeclaration, Diagnostics._0_is_declared_here, entityNameToString(node.tagName)));
|
|
73616
73651
|
}
|
|
@@ -73759,9 +73794,9 @@ function createTypeChecker(host) {
|
|
|
73759
73794
|
const spreadType = arg.kind === 230 /* SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
|
|
73760
73795
|
if (spreadType && isTupleType(spreadType)) {
|
|
73761
73796
|
forEach(getElementTypes(spreadType), (t, i2) => {
|
|
73762
|
-
var
|
|
73797
|
+
var _a2;
|
|
73763
73798
|
const flags = spreadType.target.elementFlags[i2];
|
|
73764
|
-
const syntheticArg = createSyntheticExpression(arg, flags & 4 /* Rest */ ? createArrayType(t) : t, !!(flags & 12 /* Variable */), (
|
|
73799
|
+
const syntheticArg = createSyntheticExpression(arg, flags & 4 /* Rest */ ? createArrayType(t) : t, !!(flags & 12 /* Variable */), (_a2 = spreadType.target.labeledElementDeclarations) == null ? void 0 : _a2[i2]);
|
|
73765
73800
|
effectiveArgs.push(syntheticArg);
|
|
73766
73801
|
});
|
|
73767
73802
|
} else {
|
|
@@ -73869,7 +73904,7 @@ function createTypeChecker(host) {
|
|
|
73869
73904
|
return constructorSymbol === globalPromiseSymbol;
|
|
73870
73905
|
}
|
|
73871
73906
|
function getArgumentArityError(node, signatures, args, headMessage) {
|
|
73872
|
-
var
|
|
73907
|
+
var _a2;
|
|
73873
73908
|
const spreadIndex = getSpreadArgumentIndex(args);
|
|
73874
73909
|
if (spreadIndex > -1) {
|
|
73875
73910
|
return createDiagnosticForNode(args[spreadIndex], Diagnostics.A_spread_argument_must_either_have_a_tuple_type_or_be_passed_to_a_rest_parameter);
|
|
@@ -73928,7 +73963,7 @@ function createTypeChecker(host) {
|
|
|
73928
73963
|
} else {
|
|
73929
73964
|
diagnostic = getDiagnosticForCallNode(node, error2, parameterRange, args.length);
|
|
73930
73965
|
}
|
|
73931
|
-
const parameter = (
|
|
73966
|
+
const parameter = (_a2 = closestSignature == null ? void 0 : closestSignature.declaration) == null ? void 0 : _a2.parameters[closestSignature.thisParameter ? args.length + 1 : args.length];
|
|
73932
73967
|
if (parameter) {
|
|
73933
73968
|
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))];
|
|
73934
73969
|
const parameterError = createDiagnosticForNode(parameter, ...messageAndArgs);
|
|
@@ -74168,11 +74203,11 @@ function createTypeChecker(host) {
|
|
|
74168
74203
|
}
|
|
74169
74204
|
return result;
|
|
74170
74205
|
function addImplementationSuccessElaboration(failed, diagnostic) {
|
|
74171
|
-
var
|
|
74206
|
+
var _a2, _b;
|
|
74172
74207
|
const oldCandidatesForArgumentError = candidatesForArgumentError;
|
|
74173
74208
|
const oldCandidateForArgumentArityError = candidateForArgumentArityError;
|
|
74174
74209
|
const oldCandidateForTypeArgumentError = candidateForTypeArgumentError;
|
|
74175
|
-
const failedSignatureDeclarations = ((_b = (
|
|
74210
|
+
const failedSignatureDeclarations = ((_b = (_a2 = failed.declaration) == null ? void 0 : _a2.symbol) == null ? void 0 : _b.declarations) || emptyArray;
|
|
74176
74211
|
const isOverload = failedSignatureDeclarations.length > 1;
|
|
74177
74212
|
const implDecl = isOverload ? find(failedSignatureDeclarations, (d) => isFunctionLikeDeclaration(d) && nodeIsPresent(d.body)) : void 0;
|
|
74178
74213
|
if (implDecl) {
|
|
@@ -74187,7 +74222,7 @@ function createTypeChecker(host) {
|
|
|
74187
74222
|
candidateForTypeArgumentError = oldCandidateForTypeArgumentError;
|
|
74188
74223
|
}
|
|
74189
74224
|
function chooseOverload(candidates2, relation, isSingleNonGenericCandidate2, signatureHelpTrailingComma2 = false) {
|
|
74190
|
-
var
|
|
74225
|
+
var _a2, _b;
|
|
74191
74226
|
candidatesForArgumentError = void 0;
|
|
74192
74227
|
candidateForArgumentArityError = void 0;
|
|
74193
74228
|
candidateForTypeArgumentError = void 0;
|
|
@@ -74222,7 +74257,7 @@ function createTypeChecker(host) {
|
|
|
74222
74257
|
let checkCandidate;
|
|
74223
74258
|
let inferenceContext;
|
|
74224
74259
|
if (candidate.typeParameters) {
|
|
74225
|
-
const paramLocation = (_b = (
|
|
74260
|
+
const paramLocation = (_b = (_a2 = candidate.typeParameters[0].symbol.declarations) == null ? void 0 : _a2[0]) == null ? void 0 : _b.parent;
|
|
74226
74261
|
const candidateParameterContext = paramLocation || (candidate.declaration && isConstructorDeclaration(candidate.declaration) ? candidate.declaration.parent : candidate.declaration);
|
|
74227
74262
|
if (candidateParameterContext && findAncestor(node, (a) => a === candidateParameterContext)) {
|
|
74228
74263
|
candidate = getImplementationSignature(candidate);
|
|
@@ -74911,7 +74946,7 @@ function createTypeChecker(host) {
|
|
|
74911
74946
|
return result;
|
|
74912
74947
|
}
|
|
74913
74948
|
function isJSConstructor(node) {
|
|
74914
|
-
var
|
|
74949
|
+
var _a2;
|
|
74915
74950
|
if (!node || !isInJSFile(node)) {
|
|
74916
74951
|
return false;
|
|
74917
74952
|
}
|
|
@@ -74922,12 +74957,12 @@ function createTypeChecker(host) {
|
|
|
74922
74957
|
if (isPropertyAssignment(walkUpParenthesizedExpressions(func.parent)))
|
|
74923
74958
|
return false;
|
|
74924
74959
|
const symbol = getSymbolOfDeclaration(func);
|
|
74925
|
-
return !!((
|
|
74960
|
+
return !!((_a2 = symbol == null ? void 0 : symbol.members) == null ? void 0 : _a2.size);
|
|
74926
74961
|
}
|
|
74927
74962
|
return false;
|
|
74928
74963
|
}
|
|
74929
74964
|
function mergeJSSymbols(target, source) {
|
|
74930
|
-
var
|
|
74965
|
+
var _a2, _b;
|
|
74931
74966
|
if (source) {
|
|
74932
74967
|
const links = getSymbolLinks(source);
|
|
74933
74968
|
if (!links.inferredClassSymbol || !links.inferredClassSymbol.has(getSymbolId(target))) {
|
|
@@ -74935,7 +74970,7 @@ function createTypeChecker(host) {
|
|
|
74935
74970
|
inferred.exports = inferred.exports || createSymbolTable();
|
|
74936
74971
|
inferred.members = inferred.members || createSymbolTable();
|
|
74937
74972
|
inferred.flags |= source.flags & 32 /* Class */;
|
|
74938
|
-
if ((
|
|
74973
|
+
if ((_a2 = source.exports) == null ? void 0 : _a2.size) {
|
|
74939
74974
|
mergeSymbolTable(inferred.exports, source.exports);
|
|
74940
74975
|
}
|
|
74941
74976
|
if ((_b = source.members) == null ? void 0 : _b.size) {
|
|
@@ -74948,13 +74983,13 @@ function createTypeChecker(host) {
|
|
|
74948
74983
|
}
|
|
74949
74984
|
}
|
|
74950
74985
|
function getAssignedClassSymbol(decl) {
|
|
74951
|
-
var
|
|
74986
|
+
var _a2;
|
|
74952
74987
|
const assignmentSymbol = decl && getSymbolOfExpando(
|
|
74953
74988
|
decl,
|
|
74954
74989
|
/*allowDeclaration*/
|
|
74955
74990
|
true
|
|
74956
74991
|
);
|
|
74957
|
-
const prototype = (
|
|
74992
|
+
const prototype = (_a2 = assignmentSymbol == null ? void 0 : assignmentSymbol.exports) == null ? void 0 : _a2.get("prototype");
|
|
74958
74993
|
const init = (prototype == null ? void 0 : prototype.valueDeclaration) && getAssignedJSPrototype(prototype.valueDeclaration);
|
|
74959
74994
|
return init ? getSymbolOfDeclaration(init) : void 0;
|
|
74960
74995
|
}
|
|
@@ -75011,7 +75046,7 @@ function createTypeChecker(host) {
|
|
|
75011
75046
|
}
|
|
75012
75047
|
}
|
|
75013
75048
|
function checkCallExpression(node, checkMode) {
|
|
75014
|
-
var
|
|
75049
|
+
var _a2, _b, _c;
|
|
75015
75050
|
checkGrammarTypeArguments(node, node.typeArguments);
|
|
75016
75051
|
const signature = getResolvedSignature(
|
|
75017
75052
|
node,
|
|
@@ -75028,7 +75063,7 @@ function createTypeChecker(host) {
|
|
|
75028
75063
|
}
|
|
75029
75064
|
if (node.kind === 214 /* NewExpression */) {
|
|
75030
75065
|
const declaration = signature.declaration;
|
|
75031
|
-
if (declaration && declaration.kind !== 176 /* Constructor */ && declaration.kind !== 180 /* ConstructSignature */ && declaration.kind !== 185 /* ConstructorType */ && !(isJSDocSignature(declaration) && ((_b = (
|
|
75066
|
+
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)) {
|
|
75032
75067
|
if (noImplicitAny) {
|
|
75033
75068
|
error(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);
|
|
75034
75069
|
}
|
|
@@ -75187,11 +75222,11 @@ function createTypeChecker(host) {
|
|
|
75187
75222
|
return void 0;
|
|
75188
75223
|
}
|
|
75189
75224
|
function getTypeWithSyntheticDefaultImportType(type, symbol, originalSymbol, moduleSpecifier) {
|
|
75190
|
-
var
|
|
75225
|
+
var _a2;
|
|
75191
75226
|
if (allowSyntheticDefaultImports && type && !isErrorType(type)) {
|
|
75192
75227
|
const synthType = type;
|
|
75193
75228
|
if (!synthType.syntheticType) {
|
|
75194
|
-
const file = (
|
|
75229
|
+
const file = (_a2 = originalSymbol.declarations) == null ? void 0 : _a2.find(isSourceFile);
|
|
75195
75230
|
const hasSyntheticDefault = canHaveSyntheticDefault(
|
|
75196
75231
|
file,
|
|
75197
75232
|
originalSymbol,
|
|
@@ -75525,8 +75560,8 @@ function createTypeChecker(host) {
|
|
|
75525
75560
|
return restParameter.escapedName;
|
|
75526
75561
|
}
|
|
75527
75562
|
function getParameterIdentifierInfoAtPosition(signature, pos) {
|
|
75528
|
-
var
|
|
75529
|
-
if (((
|
|
75563
|
+
var _a2;
|
|
75564
|
+
if (((_a2 = signature.declaration) == null ? void 0 : _a2.kind) === 317 /* JSDocFunctionType */) {
|
|
75530
75565
|
return void 0;
|
|
75531
75566
|
}
|
|
75532
75567
|
const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
|
|
@@ -76213,14 +76248,24 @@ function createTypeChecker(host) {
|
|
|
76213
76248
|
void 0
|
|
76214
76249
|
) || unknownType;
|
|
76215
76250
|
if (globalGeneratorType === emptyGenericType) {
|
|
76216
|
-
const
|
|
76251
|
+
const globalType = resolver.getGlobalIterableIteratorType(
|
|
76217
76252
|
/*reportErrors*/
|
|
76218
76253
|
false
|
|
76219
76254
|
);
|
|
76220
|
-
|
|
76221
|
-
|
|
76255
|
+
const iterationTypes = globalType !== emptyGenericType ? getIterationTypesOfGlobalIterableType(globalType, resolver) : void 0;
|
|
76256
|
+
const iterableIteratorReturnType = iterationTypes ? iterationTypes.returnType : anyType;
|
|
76257
|
+
const iterableIteratorNextType = iterationTypes ? iterationTypes.nextType : undefinedType;
|
|
76258
|
+
if (isTypeAssignableTo(returnType, iterableIteratorReturnType) && isTypeAssignableTo(iterableIteratorNextType, nextType)) {
|
|
76259
|
+
if (globalType !== emptyGenericType) {
|
|
76260
|
+
return createTypeFromGenericGlobalType(globalType, [yieldType]);
|
|
76261
|
+
}
|
|
76262
|
+
resolver.getGlobalIterableIteratorType(
|
|
76263
|
+
/*reportErrors*/
|
|
76264
|
+
true
|
|
76265
|
+
);
|
|
76266
|
+
return emptyObjectType;
|
|
76222
76267
|
}
|
|
76223
|
-
resolver.
|
|
76268
|
+
resolver.getGlobalGeneratorType(
|
|
76224
76269
|
/*reportErrors*/
|
|
76225
76270
|
true
|
|
76226
76271
|
);
|
|
@@ -76626,7 +76671,7 @@ function createTypeChecker(host) {
|
|
|
76626
76671
|
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));
|
|
76627
76672
|
}
|
|
76628
76673
|
function isAssignmentToReadonlyEntity(expr, symbol, assignmentKind) {
|
|
76629
|
-
var
|
|
76674
|
+
var _a2, _b;
|
|
76630
76675
|
if (assignmentKind === 0 /* None */) {
|
|
76631
76676
|
return false;
|
|
76632
76677
|
}
|
|
@@ -76640,7 +76685,7 @@ function createTypeChecker(host) {
|
|
|
76640
76685
|
const isAssignmentDeclaration2 = isBinaryExpression(symbol.valueDeclaration);
|
|
76641
76686
|
const isLocalPropertyDeclaration = ctor.parent === symbol.valueDeclaration.parent;
|
|
76642
76687
|
const isLocalParameterProperty = ctor === symbol.valueDeclaration.parent;
|
|
76643
|
-
const isLocalThisPropertyAssignment = isAssignmentDeclaration2 && ((
|
|
76688
|
+
const isLocalThisPropertyAssignment = isAssignmentDeclaration2 && ((_a2 = symbol.parent) == null ? void 0 : _a2.valueDeclaration) === ctor.parent;
|
|
76644
76689
|
const isLocalThisPropertyAssignmentConstructorFunction = isAssignmentDeclaration2 && ((_b = symbol.parent) == null ? void 0 : _b.valueDeclaration) === ctor;
|
|
76645
76690
|
const isWriteableSymbol = isLocalPropertyDeclaration || isLocalParameterProperty || isLocalThisPropertyAssignment || isLocalThisPropertyAssignmentConstructorFunction;
|
|
76646
76691
|
return !isWriteableSymbol;
|
|
@@ -77038,7 +77083,7 @@ function createTypeChecker(host) {
|
|
|
77038
77083
|
checkExternalEmitHelpers(node, 512 /* Read */);
|
|
77039
77084
|
}
|
|
77040
77085
|
const possiblyOutOfBoundsType = checkIteratedTypeOrElementType(65 /* Destructuring */ | 128 /* PossiblyOutOfBounds */, sourceType, undefinedType, node) || errorType;
|
|
77041
|
-
let inBoundsType =
|
|
77086
|
+
let inBoundsType = noUncheckedIndexedAccess ? void 0 : possiblyOutOfBoundsType;
|
|
77042
77087
|
for (let i = 0; i < elements.length; i++) {
|
|
77043
77088
|
let type = possiblyOutOfBoundsType;
|
|
77044
77089
|
if (node.elements[i].kind === 230 /* SpreadElement */) {
|
|
@@ -77627,7 +77672,7 @@ function createTypeChecker(host) {
|
|
|
77627
77672
|
}
|
|
77628
77673
|
}
|
|
77629
77674
|
function isAssignmentDeclaration2(kind) {
|
|
77630
|
-
var
|
|
77675
|
+
var _a2;
|
|
77631
77676
|
switch (kind) {
|
|
77632
77677
|
case 2 /* ModuleExports */:
|
|
77633
77678
|
return true;
|
|
@@ -77638,7 +77683,7 @@ function createTypeChecker(host) {
|
|
|
77638
77683
|
case 4 /* ThisProperty */:
|
|
77639
77684
|
const symbol = getSymbolOfNode(left);
|
|
77640
77685
|
const init = getAssignedExpandoInitializer(right);
|
|
77641
|
-
return !!init && isObjectLiteralExpression(init) && !!((
|
|
77686
|
+
return !!init && isObjectLiteralExpression(init) && !!((_a2 = symbol == null ? void 0 : symbol.exports) == null ? void 0 : _a2.size);
|
|
77642
77687
|
default:
|
|
77643
77688
|
return false;
|
|
77644
77689
|
}
|
|
@@ -78188,8 +78233,8 @@ function createTypeChecker(host) {
|
|
|
78188
78233
|
return type;
|
|
78189
78234
|
}
|
|
78190
78235
|
function checkExpression(node, checkMode, forceTuple) {
|
|
78191
|
-
var
|
|
78192
|
-
(
|
|
78236
|
+
var _a2, _b;
|
|
78237
|
+
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Check, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
|
|
78193
78238
|
const saveCurrentNode = currentNode;
|
|
78194
78239
|
currentNode = node;
|
|
78195
78240
|
instantiationCount = 0;
|
|
@@ -78364,7 +78409,7 @@ function createTypeChecker(host) {
|
|
|
78364
78409
|
addLazyDiagnostic(() => checkTypeNameIsReserved(node.name, Diagnostics.Type_parameter_name_cannot_be_0));
|
|
78365
78410
|
}
|
|
78366
78411
|
function checkTypeParameterDeferred(node) {
|
|
78367
|
-
var
|
|
78412
|
+
var _a2, _b;
|
|
78368
78413
|
if (isInterfaceDeclaration(node.parent) || isClassLike(node.parent) || isTypeAliasDeclaration(node.parent)) {
|
|
78369
78414
|
const typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node));
|
|
78370
78415
|
const modifiers = getTypeParameterModifiers(typeParameter) & (8192 /* In */ | 16384 /* Out */);
|
|
@@ -78373,7 +78418,7 @@ function createTypeChecker(host) {
|
|
|
78373
78418
|
if (isTypeAliasDeclaration(node.parent) && !(getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (4 /* Reference */ | 16 /* Anonymous */ | 32 /* Mapped */))) {
|
|
78374
78419
|
error(node, Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
78375
78420
|
} else if (modifiers === 8192 /* In */ || modifiers === 16384 /* Out */) {
|
|
78376
|
-
(
|
|
78421
|
+
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.CheckTypes, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
|
|
78377
78422
|
const source = createMarkerType(symbol, typeParameter, modifiers === 16384 /* Out */ ? markerSubTypeForCheck : markerSuperTypeForCheck);
|
|
78378
78423
|
const target = createMarkerType(symbol, typeParameter, modifiers === 16384 /* Out */ ? markerSuperTypeForCheck : markerSubTypeForCheck);
|
|
78379
78424
|
const saveVarianceTypeParameter = typeParameter;
|
|
@@ -79083,8 +79128,8 @@ function createTypeChecker(host) {
|
|
|
79083
79128
|
}
|
|
79084
79129
|
}
|
|
79085
79130
|
function checkGrammarMappedType(node) {
|
|
79086
|
-
var
|
|
79087
|
-
if ((
|
|
79131
|
+
var _a2;
|
|
79132
|
+
if ((_a2 = node.members) == null ? void 0 : _a2.length) {
|
|
79088
79133
|
return grammarErrorOnNode(node.members[0], Diagnostics.A_mapped_type_may_not_declare_properties_or_methods);
|
|
79089
79134
|
}
|
|
79090
79135
|
}
|
|
@@ -79518,13 +79563,13 @@ function createTypeChecker(host) {
|
|
|
79518
79563
|
return !!thenFunction && getSignaturesOfType(getTypeWithFacts(thenFunction, 2097152 /* NEUndefinedOrNull */), 0 /* Call */).length > 0;
|
|
79519
79564
|
}
|
|
79520
79565
|
function isAwaitedTypeInstantiation(type) {
|
|
79521
|
-
var
|
|
79566
|
+
var _a2;
|
|
79522
79567
|
if (type.flags & 16777216 /* Conditional */) {
|
|
79523
79568
|
const awaitedSymbol = getGlobalAwaitedSymbol(
|
|
79524
79569
|
/*reportErrors*/
|
|
79525
79570
|
false
|
|
79526
79571
|
);
|
|
79527
|
-
return !!awaitedSymbol && type.aliasSymbol === awaitedSymbol && ((
|
|
79572
|
+
return !!awaitedSymbol && type.aliasSymbol === awaitedSymbol && ((_a2 = type.aliasTypeArguments) == null ? void 0 : _a2.length) === 1;
|
|
79528
79573
|
}
|
|
79529
79574
|
return false;
|
|
79530
79575
|
}
|
|
@@ -80110,7 +80155,7 @@ function createTypeChecker(host) {
|
|
|
80110
80155
|
}
|
|
80111
80156
|
}
|
|
80112
80157
|
function checkFunctionOrMethodDeclaration(node) {
|
|
80113
|
-
var
|
|
80158
|
+
var _a2;
|
|
80114
80159
|
checkDecorators(node);
|
|
80115
80160
|
checkSignatureDeclaration(node);
|
|
80116
80161
|
const functionFlags = getFunctionFlags(node);
|
|
@@ -80120,7 +80165,7 @@ function createTypeChecker(host) {
|
|
|
80120
80165
|
if (hasBindableName(node)) {
|
|
80121
80166
|
const symbol = getSymbolOfDeclaration(node);
|
|
80122
80167
|
const localSymbol = node.localSymbol || symbol;
|
|
80123
|
-
const firstDeclaration = (
|
|
80168
|
+
const firstDeclaration = (_a2 = localSymbol.declarations) == null ? void 0 : _a2.find(
|
|
80124
80169
|
// Get first non javascript function declaration
|
|
80125
80170
|
(declaration) => declaration.kind === node.kind && !(declaration.flags & 524288 /* JavaScriptFile */)
|
|
80126
80171
|
);
|
|
@@ -80394,9 +80439,9 @@ function createTypeChecker(host) {
|
|
|
80394
80439
|
});
|
|
80395
80440
|
}
|
|
80396
80441
|
function checkPotentialUncheckedRenamedBindingElementsInTypes() {
|
|
80397
|
-
var
|
|
80442
|
+
var _a2;
|
|
80398
80443
|
for (const node of potentialUnusedRenamedBindingElementsInTypes) {
|
|
80399
|
-
if (!((
|
|
80444
|
+
if (!((_a2 = getSymbolOfDeclaration(node)) == null ? void 0 : _a2.isReferenced)) {
|
|
80400
80445
|
const wrappingDeclaration = walkUpBindingElementsAndPatterns(node);
|
|
80401
80446
|
Debug.assert(isPartOfParameterDeclaration(wrappingDeclaration), "Only parameter declaration should be checked here");
|
|
80402
80447
|
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));
|
|
@@ -80619,7 +80664,7 @@ function createTypeChecker(host) {
|
|
|
80619
80664
|
return type === autoType ? anyType : type === autoArrayType ? anyArrayType : type;
|
|
80620
80665
|
}
|
|
80621
80666
|
function checkVariableLikeDeclaration(node) {
|
|
80622
|
-
var
|
|
80667
|
+
var _a2;
|
|
80623
80668
|
checkDecorators(node);
|
|
80624
80669
|
if (!isBindingElement(node)) {
|
|
80625
80670
|
checkSourceElement(node.type);
|
|
@@ -80718,7 +80763,7 @@ function createTypeChecker(host) {
|
|
|
80718
80763
|
if (node === symbol.valueDeclaration) {
|
|
80719
80764
|
const initializer = hasOnlyExpressionInitializer(node) && getEffectiveInitializer(node);
|
|
80720
80765
|
if (initializer) {
|
|
80721
|
-
const isJSObjectLiteralInitializer = isInJSFile(node) && isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAccess(node.name)) && !!((
|
|
80766
|
+
const isJSObjectLiteralInitializer = isInJSFile(node) && isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAccess(node.name)) && !!((_a2 = symbol.exports) == null ? void 0 : _a2.size);
|
|
80722
80767
|
if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 249 /* ForInStatement */) {
|
|
80723
80768
|
const initializerType = checkExpressionCached(initializer);
|
|
80724
80769
|
checkTypeAssignableToAndOptionallyElaborate(
|
|
@@ -80813,8 +80858,8 @@ function createTypeChecker(host) {
|
|
|
80813
80858
|
return getSelectedEffectiveModifierFlags(left, interestingFlags) === getSelectedEffectiveModifierFlags(right, interestingFlags);
|
|
80814
80859
|
}
|
|
80815
80860
|
function checkVariableDeclaration(node) {
|
|
80816
|
-
var
|
|
80817
|
-
(
|
|
80861
|
+
var _a2, _b;
|
|
80862
|
+
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Check, "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
|
|
80818
80863
|
checkGrammarVariableDeclaration(node);
|
|
80819
80864
|
checkVariableLikeDeclaration(node);
|
|
80820
80865
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
@@ -81092,7 +81137,7 @@ function createTypeChecker(host) {
|
|
|
81092
81137
|
}
|
|
81093
81138
|
const uplevelIteration = languageVersion >= 2 /* ES2015 */;
|
|
81094
81139
|
const downlevelIteration = !uplevelIteration && compilerOptions.downlevelIteration;
|
|
81095
|
-
const possibleOutOfBounds =
|
|
81140
|
+
const possibleOutOfBounds = noUncheckedIndexedAccess && !!(use & 128 /* PossiblyOutOfBounds */);
|
|
81096
81141
|
if (uplevelIteration || downlevelIteration || allowAsyncIterables) {
|
|
81097
81142
|
const iterationTypes = getIterationTypesOfIterable(inputType, use, uplevelIteration ? errorNode : void 0);
|
|
81098
81143
|
if (checkAssignability) {
|
|
@@ -81141,14 +81186,14 @@ function createTypeChecker(host) {
|
|
|
81141
81186
|
}
|
|
81142
81187
|
const arrayElementType = getIndexTypeOfType(arrayType, numberType);
|
|
81143
81188
|
if (hasStringConstituent && arrayElementType) {
|
|
81144
|
-
if (arrayElementType.flags & 402653316 /* StringLike */ && !
|
|
81189
|
+
if (arrayElementType.flags & 402653316 /* StringLike */ && !noUncheckedIndexedAccess) {
|
|
81145
81190
|
return stringType;
|
|
81146
81191
|
}
|
|
81147
81192
|
return getUnionType(possibleOutOfBounds ? [arrayElementType, stringType, undefinedType] : [arrayElementType, stringType], 2 /* Subtype */);
|
|
81148
81193
|
}
|
|
81149
81194
|
return use & 128 /* PossiblyOutOfBounds */ ? includeUndefinedInIndexSignature(arrayElementType) : arrayElementType;
|
|
81150
81195
|
function getIterationDiagnosticDetails(allowsStrings, downlevelIteration2) {
|
|
81151
|
-
var
|
|
81196
|
+
var _a2;
|
|
81152
81197
|
if (downlevelIteration2) {
|
|
81153
81198
|
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];
|
|
81154
81199
|
}
|
|
@@ -81162,7 +81207,7 @@ function createTypeChecker(host) {
|
|
|
81162
81207
|
if (yieldType) {
|
|
81163
81208
|
return [Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher, false];
|
|
81164
81209
|
}
|
|
81165
|
-
if (isES2015OrLaterIterable((
|
|
81210
|
+
if (isES2015OrLaterIterable((_a2 = inputType.symbol) == null ? void 0 : _a2.escapedName)) {
|
|
81166
81211
|
return [Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher, true];
|
|
81167
81212
|
}
|
|
81168
81213
|
return allowsStrings ? [Diagnostics.Type_0_is_not_an_array_type_or_a_string_type, true] : [Diagnostics.Type_0_is_not_an_array_type, true];
|
|
@@ -81234,7 +81279,7 @@ function createTypeChecker(host) {
|
|
|
81234
81279
|
return type[cacheKey] = cachedTypes2;
|
|
81235
81280
|
}
|
|
81236
81281
|
function getIterationTypesOfIterable(type, use, errorNode) {
|
|
81237
|
-
var
|
|
81282
|
+
var _a2, _b;
|
|
81238
81283
|
if (isTypeAny(type)) {
|
|
81239
81284
|
return anyIterationTypes;
|
|
81240
81285
|
}
|
|
@@ -81249,7 +81294,7 @@ function createTypeChecker(host) {
|
|
|
81249
81294
|
}
|
|
81250
81295
|
}
|
|
81251
81296
|
return void 0;
|
|
81252
|
-
} else if ((
|
|
81297
|
+
} else if ((_a2 = errorOutputContainer == null ? void 0 : errorOutputContainer.errors) == null ? void 0 : _a2.length) {
|
|
81253
81298
|
for (const diag2 of errorOutputContainer.errors) {
|
|
81254
81299
|
diagnostics.add(diag2);
|
|
81255
81300
|
}
|
|
@@ -81356,14 +81401,41 @@ function createTypeChecker(host) {
|
|
|
81356
81401
|
function getIterationTypesOfIterableCached(type, resolver) {
|
|
81357
81402
|
return getCachedIterationTypes(type, resolver.iterableCacheKey);
|
|
81358
81403
|
}
|
|
81404
|
+
function getIterationTypesOfGlobalIterableType(globalType, resolver) {
|
|
81405
|
+
const globalIterationTypes = getIterationTypesOfIterableCached(globalType, resolver) || getIterationTypesOfIterableSlow(
|
|
81406
|
+
globalType,
|
|
81407
|
+
resolver,
|
|
81408
|
+
/*errorNode*/
|
|
81409
|
+
void 0,
|
|
81410
|
+
/*errorOutputContainer*/
|
|
81411
|
+
void 0,
|
|
81412
|
+
/*noCache*/
|
|
81413
|
+
false
|
|
81414
|
+
);
|
|
81415
|
+
return globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes;
|
|
81416
|
+
}
|
|
81359
81417
|
function getIterationTypesOfIterableFast(type, resolver) {
|
|
81360
|
-
|
|
81418
|
+
let globalType;
|
|
81419
|
+
if (isReferenceToType(type, globalType = resolver.getGlobalIterableType(
|
|
81361
81420
|
/*reportErrors*/
|
|
81362
81421
|
false
|
|
81363
|
-
)) || isReferenceToType(type, resolver.getGlobalIterableIteratorType(
|
|
81422
|
+
)) || isReferenceToType(type, globalType = resolver.getGlobalIterableIteratorType(
|
|
81364
81423
|
/*reportErrors*/
|
|
81365
81424
|
false
|
|
81366
|
-
))
|
|
81425
|
+
))) {
|
|
81426
|
+
const [yieldType] = getTypeArguments(type);
|
|
81427
|
+
const { returnType, nextType } = getIterationTypesOfGlobalIterableType(globalType, resolver);
|
|
81428
|
+
return setCachedIterationTypes(type, resolver.iterableCacheKey, createIterationTypes(resolver.resolveIterationType(
|
|
81429
|
+
yieldType,
|
|
81430
|
+
/*errorNode*/
|
|
81431
|
+
void 0
|
|
81432
|
+
) || yieldType, resolver.resolveIterationType(
|
|
81433
|
+
returnType,
|
|
81434
|
+
/*errorNode*/
|
|
81435
|
+
void 0
|
|
81436
|
+
) || returnType, nextType));
|
|
81437
|
+
}
|
|
81438
|
+
if (isReferenceToType(type, resolver.getGlobalGeneratorType(
|
|
81367
81439
|
/*reportErrors*/
|
|
81368
81440
|
false
|
|
81369
81441
|
))) {
|
|
@@ -81408,10 +81480,10 @@ function createTypeChecker(host) {
|
|
|
81408
81480
|
!!getAwaitedTypeOfPromise(type) || !allowAsyncIterables && isForOfStatement(errorNode.parent) && errorNode.parent.expression === errorNode && getGlobalAsyncIterableType(
|
|
81409
81481
|
/*reportErrors*/
|
|
81410
81482
|
false
|
|
81411
|
-
) !== emptyGenericType && isTypeAssignableTo(type,
|
|
81483
|
+
) !== emptyGenericType && isTypeAssignableTo(type, getGlobalAsyncIterableType(
|
|
81412
81484
|
/*reportErrors*/
|
|
81413
81485
|
false
|
|
81414
|
-
)
|
|
81486
|
+
))
|
|
81415
81487
|
);
|
|
81416
81488
|
return errorAndMaybeSuggestAwait(errorNode, suggestAwait, message, typeToString(type));
|
|
81417
81489
|
}
|
|
@@ -81441,10 +81513,26 @@ function createTypeChecker(host) {
|
|
|
81441
81513
|
return getCachedIterationTypes(type, resolver.iteratorCacheKey);
|
|
81442
81514
|
}
|
|
81443
81515
|
function getIterationTypesOfIteratorFast(type, resolver) {
|
|
81444
|
-
|
|
81516
|
+
const globalType = resolver.getGlobalIterableIteratorType(
|
|
81445
81517
|
/*reportErrors*/
|
|
81446
81518
|
false
|
|
81447
|
-
)
|
|
81519
|
+
);
|
|
81520
|
+
if (isReferenceToType(type, globalType)) {
|
|
81521
|
+
const [yieldType] = getTypeArguments(type);
|
|
81522
|
+
const globalIterationTypes = getIterationTypesOfIteratorCached(globalType, resolver) || getIterationTypesOfIteratorSlow(
|
|
81523
|
+
globalType,
|
|
81524
|
+
resolver,
|
|
81525
|
+
/*errorNode*/
|
|
81526
|
+
void 0,
|
|
81527
|
+
/*errorOutputContainer*/
|
|
81528
|
+
void 0,
|
|
81529
|
+
/*noCache*/
|
|
81530
|
+
false
|
|
81531
|
+
);
|
|
81532
|
+
const { returnType, nextType } = globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes;
|
|
81533
|
+
return setCachedIterationTypes(type, resolver.iteratorCacheKey, createIterationTypes(yieldType, returnType, nextType));
|
|
81534
|
+
}
|
|
81535
|
+
if (isReferenceToType(type, resolver.getGlobalIteratorType(
|
|
81448
81536
|
/*reportErrors*/
|
|
81449
81537
|
false
|
|
81450
81538
|
)) || isReferenceToType(type, resolver.getGlobalGeneratorType(
|
|
@@ -81514,7 +81602,7 @@ function createTypeChecker(host) {
|
|
|
81514
81602
|
));
|
|
81515
81603
|
}
|
|
81516
81604
|
function getIterationTypesOfMethod(type, resolver, methodName, errorNode, errorOutputContainer) {
|
|
81517
|
-
var
|
|
81605
|
+
var _a2, _b, _c, _d;
|
|
81518
81606
|
const method = getPropertyOfType(type, methodName);
|
|
81519
81607
|
if (!method && methodName !== "next") {
|
|
81520
81608
|
return void 0;
|
|
@@ -81545,7 +81633,7 @@ function createTypeChecker(host) {
|
|
|
81545
81633
|
/*reportErrors*/
|
|
81546
81634
|
false
|
|
81547
81635
|
);
|
|
81548
|
-
const isGeneratorMethod = ((_b = (
|
|
81636
|
+
const isGeneratorMethod = ((_b = (_a2 = globalGeneratorType.symbol) == null ? void 0 : _a2.members) == null ? void 0 : _b.get(methodName)) === methodType.symbol;
|
|
81549
81637
|
const isIteratorMethod = !isGeneratorMethod && ((_d = (_c = globalIteratorType.symbol) == null ? void 0 : _c.members) == null ? void 0 : _d.get(methodName)) === methodType.symbol;
|
|
81550
81638
|
if (isGeneratorMethod || isIteratorMethod) {
|
|
81551
81639
|
const globalType = isGeneratorMethod ? globalGeneratorType : globalIteratorType;
|
|
@@ -82417,7 +82505,7 @@ function createTypeChecker(host) {
|
|
|
82417
82505
|
return filter(symbol.declarations, (d) => d.kind === 263 /* ClassDeclaration */ || d.kind === 264 /* InterfaceDeclaration */);
|
|
82418
82506
|
}
|
|
82419
82507
|
function checkKindsOfPropertyMemberOverrides(type, baseType) {
|
|
82420
|
-
var
|
|
82508
|
+
var _a2, _b, _c, _d, _e;
|
|
82421
82509
|
const baseProperties = getPropertiesOfType(baseType);
|
|
82422
82510
|
const notImplementedInfo = /* @__PURE__ */ new Map();
|
|
82423
82511
|
basePropertyCheck:
|
|
@@ -82448,7 +82536,7 @@ function createTypeChecker(host) {
|
|
|
82448
82536
|
const baseTypeName = typeToString(baseType);
|
|
82449
82537
|
const typeName = typeToString(type);
|
|
82450
82538
|
const basePropertyName = symbolToString(baseProperty);
|
|
82451
|
-
const missedProperties = append((
|
|
82539
|
+
const missedProperties = append((_a2 = notImplementedInfo.get(derivedClassDecl)) == null ? void 0 : _a2.missedProperties, basePropertyName);
|
|
82452
82540
|
notImplementedInfo.set(derivedClassDecl, { baseTypeName, typeName, missedProperties });
|
|
82453
82541
|
}
|
|
82454
82542
|
} else {
|
|
@@ -82460,7 +82548,7 @@ function createTypeChecker(host) {
|
|
|
82460
82548
|
const basePropertyFlags = base.flags & 98308 /* PropertyOrAccessor */;
|
|
82461
82549
|
const derivedPropertyFlags = derived.flags & 98308 /* PropertyOrAccessor */;
|
|
82462
82550
|
if (basePropertyFlags && derivedPropertyFlags) {
|
|
82463
|
-
if ((getCheckFlags(base) & 6 /*
|
|
82551
|
+
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)) {
|
|
82464
82552
|
continue;
|
|
82465
82553
|
}
|
|
82466
82554
|
const overriddenInstanceProperty = basePropertyFlags !== 4 /* Property */ && derivedPropertyFlags === 4 /* Property */;
|
|
@@ -82941,7 +83029,7 @@ function createTypeChecker(host) {
|
|
|
82941
83029
|
}
|
|
82942
83030
|
addLazyDiagnostic(checkModuleDeclarationDiagnostics);
|
|
82943
83031
|
function checkModuleDeclarationDiagnostics() {
|
|
82944
|
-
var
|
|
83032
|
+
var _a2, _b;
|
|
82945
83033
|
const isGlobalAugmentation = isGlobalScopeAugmentation(node);
|
|
82946
83034
|
const inAmbientContext = node.flags & 33554432 /* Ambient */;
|
|
82947
83035
|
if (isGlobalAugmentation && !inAmbientContext) {
|
|
@@ -82966,7 +83054,7 @@ function createTypeChecker(host) {
|
|
|
82966
83054
|
if (getIsolatedModules(compilerOptions) && !getSourceFileOfNode(node).externalModuleIndicator) {
|
|
82967
83055
|
error(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);
|
|
82968
83056
|
}
|
|
82969
|
-
if (((
|
|
83057
|
+
if (((_a2 = symbol.declarations) == null ? void 0 : _a2.length) > 1) {
|
|
82970
83058
|
const firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol);
|
|
82971
83059
|
if (firstNonAmbientClassOrFunc) {
|
|
82972
83060
|
if (getSourceFileOfNode(node) !== getSourceFileOfNode(firstNonAmbientClassOrFunc)) {
|
|
@@ -83103,7 +83191,7 @@ function createTypeChecker(host) {
|
|
|
83103
83191
|
return true;
|
|
83104
83192
|
}
|
|
83105
83193
|
function checkAliasSymbol(node) {
|
|
83106
|
-
var
|
|
83194
|
+
var _a2, _b, _c, _d;
|
|
83107
83195
|
let symbol = getSymbolOfDeclaration(node);
|
|
83108
83196
|
const target = resolveAlias(symbol);
|
|
83109
83197
|
if (target !== unknownSymbol) {
|
|
@@ -83113,7 +83201,7 @@ function createTypeChecker(host) {
|
|
|
83113
83201
|
Debug.assert(node.kind !== 280 /* NamespaceExport */);
|
|
83114
83202
|
if (node.kind === 281 /* ExportSpecifier */) {
|
|
83115
83203
|
const diag2 = error(errorNode, Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files);
|
|
83116
|
-
const alreadyExportedSymbol = (_b = (
|
|
83204
|
+
const alreadyExportedSymbol = (_b = (_a2 = getSourceFileOfNode(node).symbol) == null ? void 0 : _a2.exports) == null ? void 0 : _b.get((node.propertyName || node.name).escapedText);
|
|
83117
83205
|
if (alreadyExportedSymbol === target) {
|
|
83118
83206
|
const exportingDeclaration = (_c = alreadyExportedSymbol.declarations) == null ? void 0 : _c.find(isJSDocNode);
|
|
83119
83207
|
if (exportingDeclaration) {
|
|
@@ -83240,7 +83328,7 @@ function createTypeChecker(host) {
|
|
|
83240
83328
|
}
|
|
83241
83329
|
}
|
|
83242
83330
|
function checkImportAttributes(declaration) {
|
|
83243
|
-
var
|
|
83331
|
+
var _a2;
|
|
83244
83332
|
const node = declaration.attributes;
|
|
83245
83333
|
if (node) {
|
|
83246
83334
|
const importAttributesType = getGlobalImportAttributesType(
|
|
@@ -83261,7 +83349,7 @@ function createTypeChecker(host) {
|
|
|
83261
83349
|
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;
|
|
83262
83350
|
return grammarErrorOnNode(node, message);
|
|
83263
83351
|
}
|
|
83264
|
-
const isTypeOnly = isJSDocImportTag(declaration) || (isImportDeclaration(declaration) ? (
|
|
83352
|
+
const isTypeOnly = isJSDocImportTag(declaration) || (isImportDeclaration(declaration) ? (_a2 = declaration.importClause) == null ? void 0 : _a2.isTypeOnly : declaration.isTypeOnly);
|
|
83265
83353
|
if (isTypeOnly) {
|
|
83266
83354
|
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);
|
|
83267
83355
|
}
|
|
@@ -83374,8 +83462,8 @@ function createTypeChecker(host) {
|
|
|
83374
83462
|
checkImportAttributes(node);
|
|
83375
83463
|
}
|
|
83376
83464
|
function checkGrammarExportDeclaration(node) {
|
|
83377
|
-
var
|
|
83378
|
-
if (node.isTypeOnly && ((
|
|
83465
|
+
var _a2;
|
|
83466
|
+
if (node.isTypeOnly && ((_a2 = node.exportClause) == null ? void 0 : _a2.kind) === 279 /* NamedExports */) {
|
|
83379
83467
|
return checkGrammarNamedImportsOrExports(node.exportClause);
|
|
83380
83468
|
}
|
|
83381
83469
|
return false;
|
|
@@ -83877,8 +83965,8 @@ function createTypeChecker(host) {
|
|
|
83877
83965
|
links.deferredNodes = void 0;
|
|
83878
83966
|
}
|
|
83879
83967
|
function checkDeferredNode(node) {
|
|
83880
|
-
var
|
|
83881
|
-
(
|
|
83968
|
+
var _a2, _b;
|
|
83969
|
+
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Check, "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
|
|
83882
83970
|
const saveCurrentNode = currentNode;
|
|
83883
83971
|
currentNode = node;
|
|
83884
83972
|
instantiationCount = 0;
|
|
@@ -83930,8 +84018,8 @@ function createTypeChecker(host) {
|
|
|
83930
84018
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
83931
84019
|
}
|
|
83932
84020
|
function checkSourceFile(node) {
|
|
83933
|
-
var
|
|
83934
|
-
(
|
|
84021
|
+
var _a2, _b;
|
|
84022
|
+
(_a2 = tracing) == null ? void 0 : _a2.push(
|
|
83935
84023
|
tracing.Phase.Check,
|
|
83936
84024
|
"checkSourceFile",
|
|
83937
84025
|
{ path: node.path },
|
|
@@ -84725,7 +84813,7 @@ function createTypeChecker(host) {
|
|
|
84725
84813
|
return roots ? flatMap(roots, getRootSymbols) : [symbol];
|
|
84726
84814
|
}
|
|
84727
84815
|
function getImmediateRootSymbols(symbol) {
|
|
84728
|
-
if (getCheckFlags(symbol) & 6 /*
|
|
84816
|
+
if (getCheckFlags(symbol) & 6 /* SyntheticMember */) {
|
|
84729
84817
|
return mapDefined(getSymbolLinks(symbol).containingType.types, (type) => getPropertyOfType(type, symbol.escapedName));
|
|
84730
84818
|
} else if (symbol.flags & 33554432 /* Transient */) {
|
|
84731
84819
|
const { links: { leftSpread, rightSpread, syntheticOrigin } } = symbol;
|
|
@@ -84757,7 +84845,7 @@ function createTypeChecker(host) {
|
|
|
84757
84845
|
return isModuleOrEnumDeclaration(node.parent) && node === node.parent.name;
|
|
84758
84846
|
}
|
|
84759
84847
|
function getReferencedExportContainer(nodeIn, prefixLocals) {
|
|
84760
|
-
var
|
|
84848
|
+
var _a2;
|
|
84761
84849
|
const node = getParseTreeNode(nodeIn, isIdentifier);
|
|
84762
84850
|
if (node) {
|
|
84763
84851
|
let symbol = getReferencedValueSymbol(
|
|
@@ -84775,7 +84863,7 @@ function createTypeChecker(host) {
|
|
|
84775
84863
|
}
|
|
84776
84864
|
const parentSymbol = getParentOfSymbol(symbol);
|
|
84777
84865
|
if (parentSymbol) {
|
|
84778
|
-
if (parentSymbol.flags & 512 /* ValueModule */ && ((
|
|
84866
|
+
if (parentSymbol.flags & 512 /* ValueModule */ && ((_a2 = parentSymbol.valueDeclaration) == null ? void 0 : _a2.kind) === 307 /* SourceFile */) {
|
|
84779
84867
|
const symbolFile = parentSymbol.valueDeclaration;
|
|
84780
84868
|
const referenceFile = getSourceFileOfNode(node);
|
|
84781
84869
|
const symbolIsUmdExport = symbolFile !== referenceFile;
|
|
@@ -85002,11 +85090,11 @@ function createTypeChecker(host) {
|
|
|
85002
85090
|
return symbol && getPropertiesOfType(getTypeOfSymbol(symbol)) || emptyArray;
|
|
85003
85091
|
}
|
|
85004
85092
|
function getNodeCheckFlags(node) {
|
|
85005
|
-
var
|
|
85093
|
+
var _a2;
|
|
85006
85094
|
const nodeId = node.id || 0;
|
|
85007
85095
|
if (nodeId < 0 || nodeId >= nodeLinks.length)
|
|
85008
85096
|
return 0;
|
|
85009
|
-
return ((
|
|
85097
|
+
return ((_a2 = nodeLinks[nodeId]) == null ? void 0 : _a2.flags) || 0;
|
|
85010
85098
|
}
|
|
85011
85099
|
function getEnumMemberValue(node) {
|
|
85012
85100
|
computeEnumMemberValues(node.parent);
|
|
@@ -85041,7 +85129,7 @@ function createTypeChecker(host) {
|
|
|
85041
85129
|
return !!(type.flags & 524288 /* Object */) && getSignaturesOfType(type, 0 /* Call */).length > 0;
|
|
85042
85130
|
}
|
|
85043
85131
|
function getTypeReferenceSerializationKind(typeNameIn, location) {
|
|
85044
|
-
var
|
|
85132
|
+
var _a2;
|
|
85045
85133
|
const typeName = getParseTreeNode(typeNameIn, isEntityName);
|
|
85046
85134
|
if (!typeName)
|
|
85047
85135
|
return 0 /* Unknown */;
|
|
@@ -85061,7 +85149,7 @@ function createTypeChecker(host) {
|
|
|
85061
85149
|
true,
|
|
85062
85150
|
location
|
|
85063
85151
|
);
|
|
85064
|
-
isTypeOnly = !!((
|
|
85152
|
+
isTypeOnly = !!((_a2 = rootValueSymbol == null ? void 0 : rootValueSymbol.declarations) == null ? void 0 : _a2.every(isTypeOnlyImportOrExportDeclaration));
|
|
85065
85153
|
}
|
|
85066
85154
|
const valueSymbol = resolveEntityName(
|
|
85067
85155
|
typeName,
|
|
@@ -85773,7 +85861,7 @@ function createTypeChecker(host) {
|
|
|
85773
85861
|
return externalHelpersModule;
|
|
85774
85862
|
}
|
|
85775
85863
|
function checkGrammarModifiers(node) {
|
|
85776
|
-
var
|
|
85864
|
+
var _a2;
|
|
85777
85865
|
const quickResult = reportObviousDecoratorErrors(node) || reportObviousModifierErrors(node);
|
|
85778
85866
|
if (quickResult !== void 0) {
|
|
85779
85867
|
return quickResult;
|
|
@@ -86049,7 +86137,7 @@ function createTypeChecker(host) {
|
|
|
86049
86137
|
case 147 /* OutKeyword */: {
|
|
86050
86138
|
const inOutFlag = modifier.kind === 103 /* InKeyword */ ? 8192 /* In */ : 16384 /* Out */;
|
|
86051
86139
|
const inOutText = modifier.kind === 103 /* InKeyword */ ? "in" : "out";
|
|
86052
|
-
const parent = isJSDocTemplateTag(node.parent) && (getEffectiveJSDocHost(node.parent) || find((
|
|
86140
|
+
const parent = isJSDocTemplateTag(node.parent) && (getEffectiveJSDocHost(node.parent) || find((_a2 = getJSDocRoot(node.parent)) == null ? void 0 : _a2.tags, isJSDocTypedefTag)) || node.parent;
|
|
86053
86141
|
if (node.kind !== 168 /* TypeParameter */ || parent && !(isInterfaceDeclaration(parent) || isClassLike(parent) || isTypeAliasDeclaration(parent) || isJSDocTypedefTag(parent))) {
|
|
86054
86142
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText);
|
|
86055
86143
|
}
|
|
@@ -87126,11 +87214,11 @@ function createTypeChecker(host) {
|
|
|
87126
87214
|
return ambientModulesCache;
|
|
87127
87215
|
}
|
|
87128
87216
|
function checkGrammarImportClause(node) {
|
|
87129
|
-
var
|
|
87217
|
+
var _a2;
|
|
87130
87218
|
if (node.isTypeOnly && node.name && node.namedBindings) {
|
|
87131
87219
|
return grammarErrorOnNode(node, Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both);
|
|
87132
87220
|
}
|
|
87133
|
-
if (node.isTypeOnly && ((
|
|
87221
|
+
if (node.isTypeOnly && ((_a2 = node.namedBindings) == null ? void 0 : _a2.kind) === 275 /* NamedImports */) {
|
|
87134
87222
|
return checkGrammarNamedImportsOrExports(node.namedBindings);
|
|
87135
87223
|
}
|
|
87136
87224
|
return false;
|
|
@@ -118980,6 +119068,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118980
119068
|
const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
|
|
118981
119069
|
const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion2 } = createProgramOptions;
|
|
118982
119070
|
let { oldProgram } = createProgramOptions;
|
|
119071
|
+
for (const option of commandLineOptionOfCustomType) {
|
|
119072
|
+
if (hasProperty(options, option.name)) {
|
|
119073
|
+
if (typeof options[option.name] === "string") {
|
|
119074
|
+
throw new Error(`${option.name} is a string value; tsconfig JSON must be parsed with parseJsonSourceFileConfigFileContent or getParsedCommandLineOfConfigFile before passing to createProgram`);
|
|
119075
|
+
}
|
|
119076
|
+
}
|
|
119077
|
+
}
|
|
118983
119078
|
const reportInvalidIgnoreDeprecations = memoize(() => createOptionValueDiagnostic("ignoreDeprecations", Diagnostics.Invalid_value_for_ignoreDeprecations));
|
|
118984
119079
|
let processingDefaultLibFiles;
|
|
118985
119080
|
let processingOtherFiles;
|
|
@@ -121759,8 +121854,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121759
121854
|
message = Diagnostics.File_is_library_specified_here;
|
|
121760
121855
|
break;
|
|
121761
121856
|
}
|
|
121762
|
-
const target =
|
|
121763
|
-
|
|
121857
|
+
const target = getEmitScriptTarget(options);
|
|
121858
|
+
const targetText = getNameOfScriptTarget(target);
|
|
121859
|
+
configFileNode = target === 2 /* ES2015 */ ? getOptionsSyntaxByValue("target", "es2015") ?? getOptionsSyntaxByValue("target", "es6") : targetText ? getOptionsSyntaxByValue("target", targetText) : void 0;
|
|
121764
121860
|
message = Diagnostics.File_is_default_library_for_target_specified_here;
|
|
121765
121861
|
break;
|
|
121766
121862
|
default:
|