@typescript-deploys/pr-build 5.5.0-pr-58380-2 → 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/tsc.js +361 -304
- package/lib/typescript.js +380 -308
- 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 = [];
|
|
@@ -13534,7 +13534,7 @@ function entityNameToString(name) {
|
|
|
13534
13534
|
return Debug.assertNever(name.name);
|
|
13535
13535
|
}
|
|
13536
13536
|
case 311 /* JSDocMemberName */:
|
|
13537
|
-
return entityNameToString(name.left) + entityNameToString(name.right);
|
|
13537
|
+
return entityNameToString(name.left) + "#" + entityNameToString(name.right);
|
|
13538
13538
|
case 295 /* JsxNamespacedName */:
|
|
13539
13539
|
return entityNameToString(name.namespace) + ":" + entityNameToString(name.name);
|
|
13540
13540
|
default:
|
|
@@ -17036,7 +17036,7 @@ function getDeclarationModifierFlagsFromSymbol(s, isWrite = false) {
|
|
|
17036
17036
|
const flags = getCombinedModifierFlags(declaration);
|
|
17037
17037
|
return s.parent && s.parent.flags & 32 /* Class */ ? flags : flags & ~7 /* AccessibilityModifier */;
|
|
17038
17038
|
}
|
|
17039
|
-
if (getCheckFlags(s) & 6 /*
|
|
17039
|
+
if (getCheckFlags(s) & 6 /* SyntheticMember */) {
|
|
17040
17040
|
const checkFlags = s.links.checkFlags;
|
|
17041
17041
|
const accessModifier = checkFlags & 1024 /* ContainsPrivate */ ? 2 /* Private */ : checkFlags & 256 /* ContainsPublic */ ? 1 /* Public */ : 4 /* Protected */;
|
|
17042
17042
|
const staticModifier = checkFlags & 2048 /* ContainsStatic */ ? 256 /* Static */ : 0;
|
|
@@ -17832,7 +17832,19 @@ function getStrictOptionValue(compilerOptions, flag) {
|
|
|
17832
17832
|
return compilerOptions[flag] === void 0 ? !!compilerOptions.strict : !!compilerOptions[flag];
|
|
17833
17833
|
}
|
|
17834
17834
|
function getNameOfScriptTarget(scriptTarget) {
|
|
17835
|
-
|
|
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);
|
|
17836
17848
|
}
|
|
17837
17849
|
function getEmitStandardClassFields(compilerOptions) {
|
|
17838
17850
|
return compilerOptions.useDefineForClassFields !== false && getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */;
|
|
@@ -35940,6 +35952,25 @@ var moduleOptionDeclaration = {
|
|
|
35940
35952
|
description: Diagnostics.Specify_what_module_code_is_generated,
|
|
35941
35953
|
defaultValueDescription: void 0
|
|
35942
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
|
+
};
|
|
35943
35974
|
var commandOptionsWithoutBuild = [
|
|
35944
35975
|
// CommandLine only options
|
|
35945
35976
|
{
|
|
@@ -36381,25 +36412,7 @@ var commandOptionsWithoutBuild = [
|
|
|
36381
36412
|
defaultValueDescription: false
|
|
36382
36413
|
},
|
|
36383
36414
|
// Module Resolution
|
|
36384
|
-
|
|
36385
|
-
name: "moduleResolution",
|
|
36386
|
-
type: new Map(Object.entries({
|
|
36387
|
-
// N.B. The first entry specifies the value shown in `tsc --init`
|
|
36388
|
-
node10: 2 /* Node10 */,
|
|
36389
|
-
node: 2 /* Node10 */,
|
|
36390
|
-
classic: 1 /* Classic */,
|
|
36391
|
-
node16: 3 /* Node16 */,
|
|
36392
|
-
nodenext: 99 /* NodeNext */,
|
|
36393
|
-
bundler: 100 /* Bundler */
|
|
36394
|
-
})),
|
|
36395
|
-
deprecatedKeys: /* @__PURE__ */ new Set(["node"]),
|
|
36396
|
-
affectsSourceFile: true,
|
|
36397
|
-
affectsModuleResolution: true,
|
|
36398
|
-
paramType: Diagnostics.STRATEGY,
|
|
36399
|
-
category: Diagnostics.Modules,
|
|
36400
|
-
description: Diagnostics.Specify_how_TypeScript_looks_up_a_file_from_a_given_module_specifier,
|
|
36401
|
-
defaultValueDescription: Diagnostics.module_AMD_or_UMD_or_System_or_ES6_then_Classic_Otherwise_Node
|
|
36402
|
-
},
|
|
36415
|
+
moduleResolutionOptionDeclaration,
|
|
36403
36416
|
{
|
|
36404
36417
|
name: "baseUrl",
|
|
36405
36418
|
type: "string",
|
|
@@ -36968,6 +36981,10 @@ var configDirTemplateSubstitutionOptions = optionDeclarations.filter(
|
|
|
36968
36981
|
var configDirTemplateSubstitutionWatchOptions = optionsForWatch.filter(
|
|
36969
36982
|
(option) => option.allowConfigDirTemplateSubstitution || !option.isCommandLineOnly && option.isFilePath
|
|
36970
36983
|
);
|
|
36984
|
+
var commandLineOptionOfCustomType = optionDeclarations.filter(isCommandLineOptionOfCustomType);
|
|
36985
|
+
function isCommandLineOptionOfCustomType(option) {
|
|
36986
|
+
return !isString(option.type);
|
|
36987
|
+
}
|
|
36971
36988
|
var optionsForBuild = [
|
|
36972
36989
|
{
|
|
36973
36990
|
name: "verbose",
|
|
@@ -44124,7 +44141,7 @@ function createBinder() {
|
|
|
44124
44141
|
const reportError = (
|
|
44125
44142
|
// report error on all statements except empty ones
|
|
44126
44143
|
isStatementButNotDeclaration(node) && node.kind !== 242 /* EmptyStatement */ || // report error on class declarations
|
|
44127
|
-
node.kind === 263 /* ClassDeclaration */ ||
|
|
44144
|
+
node.kind === 263 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set
|
|
44128
44145
|
node.kind === 267 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)
|
|
44129
44146
|
);
|
|
44130
44147
|
if (reportError) {
|
|
@@ -45411,6 +45428,7 @@ function isInstantiatedModule(node, preserveConstEnums) {
|
|
|
45411
45428
|
return moduleState === 1 /* Instantiated */ || preserveConstEnums && moduleState === 2 /* ConstEnumOnly */;
|
|
45412
45429
|
}
|
|
45413
45430
|
function createTypeChecker(host) {
|
|
45431
|
+
var _a;
|
|
45414
45432
|
var deferredDiagnosticsCallbacks = [];
|
|
45415
45433
|
var addLazyDiagnostic = (arg) => {
|
|
45416
45434
|
deferredDiagnosticsCallbacks.push(arg);
|
|
@@ -45437,6 +45455,7 @@ function createTypeChecker(host) {
|
|
|
45437
45455
|
var compilerOptions = host.getCompilerOptions();
|
|
45438
45456
|
var languageVersion = getEmitScriptTarget(compilerOptions);
|
|
45439
45457
|
var moduleKind = getEmitModuleKind(compilerOptions);
|
|
45458
|
+
var moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
45440
45459
|
var legacyDecorators = !!compilerOptions.experimentalDecorators;
|
|
45441
45460
|
var useDefineForClassFields = getUseDefineForClassFields(compilerOptions);
|
|
45442
45461
|
var emitStandardClassFields = getEmitStandardClassFields(compilerOptions);
|
|
@@ -45449,6 +45468,7 @@ function createTypeChecker(host) {
|
|
|
45449
45468
|
var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
|
|
45450
45469
|
var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
|
|
45451
45470
|
var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
|
|
45471
|
+
var noUncheckedIndexedAccess = compilerOptions.noUncheckedIndexedAccess;
|
|
45452
45472
|
var checkBinaryExpression = createCheckBinaryExpression();
|
|
45453
45473
|
var emitResolver = createResolver();
|
|
45454
45474
|
var nodeBuilder = createNodeBuilder();
|
|
@@ -46416,6 +46436,32 @@ function createTypeChecker(host) {
|
|
|
46416
46436
|
[".jsx", ".jsx"],
|
|
46417
46437
|
[".json", ".json"]
|
|
46418
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);
|
|
46419
46465
|
initializeTypeChecker();
|
|
46420
46466
|
return checker;
|
|
46421
46467
|
function getCachedType(key) {
|
|
@@ -46590,8 +46636,8 @@ function createTypeChecker(host) {
|
|
|
46590
46636
|
symbol.links.type = type;
|
|
46591
46637
|
return symbol;
|
|
46592
46638
|
}
|
|
46593
|
-
function createProperty(name, type) {
|
|
46594
|
-
const symbol = createSymbol(4 /* Property */, name);
|
|
46639
|
+
function createProperty(name, type, checkFlags) {
|
|
46640
|
+
const symbol = createSymbol(4 /* Property */, name, checkFlags);
|
|
46595
46641
|
symbol.links.type = type;
|
|
46596
46642
|
return symbol;
|
|
46597
46643
|
}
|
|
@@ -46773,9 +46819,9 @@ function createTypeChecker(host) {
|
|
|
46773
46819
|
});
|
|
46774
46820
|
}
|
|
46775
46821
|
function mergeModuleAugmentation(moduleName) {
|
|
46776
|
-
var
|
|
46822
|
+
var _a2, _b, _c;
|
|
46777
46823
|
const moduleAugmentation = moduleName.parent;
|
|
46778
|
-
if (((
|
|
46824
|
+
if (((_a2 = moduleAugmentation.symbol.declarations) == null ? void 0 : _a2[0]) !== moduleAugmentation) {
|
|
46779
46825
|
Debug.assert(moduleAugmentation.symbol.declarations.length > 1);
|
|
46780
46826
|
return;
|
|
46781
46827
|
}
|
|
@@ -47088,7 +47134,7 @@ function createTypeChecker(host) {
|
|
|
47088
47134
|
}
|
|
47089
47135
|
function onSuccessfullyResolvedSymbol(errorLocation, result, meaning, lastLocation, associatedDeclarationForContainingInitializerOrBindingName, withinDeferredContext) {
|
|
47090
47136
|
addLazyDiagnostic(() => {
|
|
47091
|
-
var
|
|
47137
|
+
var _a2;
|
|
47092
47138
|
const name = result.escapedName;
|
|
47093
47139
|
const isInExternalModule = lastLocation && isSourceFile(lastLocation) && isExternalOrCommonJsModule(lastLocation);
|
|
47094
47140
|
if (errorLocation && (meaning & 2 /* BlockScopedVariable */ || (meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */)) {
|
|
@@ -47128,7 +47174,7 @@ function createTypeChecker(host) {
|
|
|
47128
47174
|
const isGlobal = getSymbol(globals, name, meaning) === result;
|
|
47129
47175
|
const nonValueSymbol = isGlobal && isSourceFile(lastLocation) && lastLocation.locals && getSymbol(lastLocation.locals, name, ~111551 /* Value */);
|
|
47130
47176
|
if (nonValueSymbol) {
|
|
47131
|
-
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 */);
|
|
47132
47178
|
if (importDecl && !isTypeOnlyImportDeclaration(importDecl)) {
|
|
47133
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));
|
|
47134
47180
|
}
|
|
@@ -47379,12 +47425,12 @@ function createTypeChecker(host) {
|
|
|
47379
47425
|
return false;
|
|
47380
47426
|
}
|
|
47381
47427
|
function checkResolvedBlockScopedVariable(result, errorLocation) {
|
|
47382
|
-
var
|
|
47428
|
+
var _a2;
|
|
47383
47429
|
Debug.assert(!!(result.flags & 2 /* BlockScopedVariable */ || result.flags & 32 /* Class */ || result.flags & 384 /* Enum */));
|
|
47384
47430
|
if (result.flags & (16 /* Function */ | 1 /* FunctionScopedVariable */ | 67108864 /* Assignment */) && result.flags & 32 /* Class */) {
|
|
47385
47431
|
return;
|
|
47386
47432
|
}
|
|
47387
|
-
const declaration = (
|
|
47433
|
+
const declaration = (_a2 = result.declarations) == null ? void 0 : _a2.find(
|
|
47388
47434
|
(d) => isBlockOrCatchScoped(d) || isClassLike(d) || d.kind === 266 /* EnumDeclaration */
|
|
47389
47435
|
);
|
|
47390
47436
|
if (declaration === void 0)
|
|
@@ -47566,14 +47612,14 @@ function createTypeChecker(host) {
|
|
|
47566
47612
|
}
|
|
47567
47613
|
}
|
|
47568
47614
|
function getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias) {
|
|
47569
|
-
var
|
|
47615
|
+
var _a2;
|
|
47570
47616
|
let exportDefaultSymbol;
|
|
47571
47617
|
if (isShorthandAmbientModuleSymbol(moduleSymbol)) {
|
|
47572
47618
|
exportDefaultSymbol = moduleSymbol;
|
|
47573
47619
|
} else {
|
|
47574
47620
|
exportDefaultSymbol = resolveExportByName(moduleSymbol, "default" /* Default */, node, dontResolveAlias);
|
|
47575
47621
|
}
|
|
47576
|
-
const file = (
|
|
47622
|
+
const file = (_a2 = moduleSymbol.declarations) == null ? void 0 : _a2.find(isSourceFile);
|
|
47577
47623
|
const specifier = getModuleSpecifierForImportOrExport(node);
|
|
47578
47624
|
if (!specifier) {
|
|
47579
47625
|
return exportDefaultSymbol;
|
|
@@ -47639,8 +47685,8 @@ function createTypeChecker(host) {
|
|
|
47639
47685
|
}
|
|
47640
47686
|
}
|
|
47641
47687
|
function reportNonDefaultExport(moduleSymbol, node) {
|
|
47642
|
-
var
|
|
47643
|
-
if ((
|
|
47688
|
+
var _a2, _b, _c;
|
|
47689
|
+
if ((_a2 = moduleSymbol.exports) == null ? void 0 : _a2.has(node.symbol.escapedName)) {
|
|
47644
47690
|
error(
|
|
47645
47691
|
node.name,
|
|
47646
47692
|
Diagnostics.Module_0_has_no_default_export_Did_you_mean_to_use_import_1_from_0_instead,
|
|
@@ -47653,8 +47699,8 @@ function createTypeChecker(host) {
|
|
|
47653
47699
|
if (exportStar) {
|
|
47654
47700
|
const defaultExport = (_c = exportStar.declarations) == null ? void 0 : _c.find(
|
|
47655
47701
|
(decl) => {
|
|
47656
|
-
var
|
|
47657
|
-
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 */)));
|
|
47658
47704
|
}
|
|
47659
47705
|
);
|
|
47660
47706
|
if (defaultExport) {
|
|
@@ -47721,11 +47767,11 @@ function createTypeChecker(host) {
|
|
|
47721
47767
|
return result;
|
|
47722
47768
|
}
|
|
47723
47769
|
function getExportOfModule(symbol, name, specifier, dontResolveAlias) {
|
|
47724
|
-
var
|
|
47770
|
+
var _a2;
|
|
47725
47771
|
if (symbol.flags & 1536 /* Module */) {
|
|
47726
47772
|
const exportSymbol = getExportsOfSymbol(symbol).get(name.escapedText);
|
|
47727
47773
|
const resolved = resolveSymbol(exportSymbol, dontResolveAlias);
|
|
47728
|
-
const exportStarDeclaration = (
|
|
47774
|
+
const exportStarDeclaration = (_a2 = getSymbolLinks(symbol).typeOnlyExportStarMap) == null ? void 0 : _a2.get(name.escapedText);
|
|
47729
47775
|
markSymbolOfAliasDeclarationIfTypeOnly(
|
|
47730
47776
|
specifier,
|
|
47731
47777
|
exportSymbol,
|
|
@@ -47747,7 +47793,7 @@ function createTypeChecker(host) {
|
|
|
47747
47793
|
}
|
|
47748
47794
|
}
|
|
47749
47795
|
function getExternalModuleMember(node, specifier, dontResolveAlias = false) {
|
|
47750
|
-
var
|
|
47796
|
+
var _a2;
|
|
47751
47797
|
const moduleSpecifier = getExternalModuleRequireArgument(node) || node.moduleSpecifier;
|
|
47752
47798
|
const moduleSymbol = resolveExternalModuleName(node, moduleSpecifier);
|
|
47753
47799
|
const name = !isPropertyAccessExpression(specifier) && specifier.propertyName || specifier.name;
|
|
@@ -47781,7 +47827,7 @@ function createTypeChecker(host) {
|
|
|
47781
47827
|
symbolFromVariable = resolveSymbol(symbolFromVariable, dontResolveAlias);
|
|
47782
47828
|
let symbolFromModule = getExportOfModule(targetSymbol, name, specifier, dontResolveAlias);
|
|
47783
47829
|
if (symbolFromModule === void 0 && name.escapedText === "default" /* Default */) {
|
|
47784
|
-
const file = (
|
|
47830
|
+
const file = (_a2 = moduleSymbol.declarations) == null ? void 0 : _a2.find(isSourceFile);
|
|
47785
47831
|
if (isOnlyImportableAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
47786
47832
|
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
47787
47833
|
}
|
|
@@ -47795,7 +47841,7 @@ function createTypeChecker(host) {
|
|
|
47795
47841
|
}
|
|
47796
47842
|
}
|
|
47797
47843
|
function errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name) {
|
|
47798
|
-
var
|
|
47844
|
+
var _a2;
|
|
47799
47845
|
const moduleName = getFullyQualifiedName(moduleSymbol, node);
|
|
47800
47846
|
const declarationName = declarationNameToString(name);
|
|
47801
47847
|
const suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
|
|
@@ -47806,7 +47852,7 @@ function createTypeChecker(host) {
|
|
|
47806
47852
|
addRelatedInfo(diagnostic, createDiagnosticForNode(suggestion.valueDeclaration, Diagnostics._0_is_declared_here, suggestionName));
|
|
47807
47853
|
}
|
|
47808
47854
|
} else {
|
|
47809
|
-
if ((
|
|
47855
|
+
if ((_a2 = moduleSymbol.exports) == null ? void 0 : _a2.has("default" /* Default */)) {
|
|
47810
47856
|
error(
|
|
47811
47857
|
name,
|
|
47812
47858
|
Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead,
|
|
@@ -47819,8 +47865,8 @@ function createTypeChecker(host) {
|
|
|
47819
47865
|
}
|
|
47820
47866
|
}
|
|
47821
47867
|
function reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName) {
|
|
47822
|
-
var
|
|
47823
|
-
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);
|
|
47824
47870
|
const exports2 = moduleSymbol.exports;
|
|
47825
47871
|
if (localSymbol) {
|
|
47826
47872
|
const exportedEqualsSymbol = exports2 == null ? void 0 : exports2.get("export=" /* ExportEquals */);
|
|
@@ -48087,9 +48133,9 @@ function createTypeChecker(host) {
|
|
|
48087
48133
|
return markSymbolOfAliasDeclarationIfTypeOnlyWorker(links, immediateTarget, overwriteEmpty) || markSymbolOfAliasDeclarationIfTypeOnlyWorker(links, finalTarget, overwriteEmpty);
|
|
48088
48134
|
}
|
|
48089
48135
|
function markSymbolOfAliasDeclarationIfTypeOnlyWorker(aliasDeclarationLinks, target, overwriteEmpty) {
|
|
48090
|
-
var
|
|
48136
|
+
var _a2;
|
|
48091
48137
|
if (target && (aliasDeclarationLinks.typeOnlyDeclaration === void 0 || overwriteEmpty && aliasDeclarationLinks.typeOnlyDeclaration === false)) {
|
|
48092
|
-
const exportSymbol = ((
|
|
48138
|
+
const exportSymbol = ((_a2 = target.exports) == null ? void 0 : _a2.get("export=" /* ExportEquals */)) ?? target;
|
|
48093
48139
|
const typeOnly = exportSymbol.declarations && find(exportSymbol.declarations, isTypeOnlyImportOrExportDeclaration);
|
|
48094
48140
|
aliasDeclarationLinks.typeOnlyDeclaration = typeOnly ?? getSymbolLinks(exportSymbol).typeOnlyDeclaration ?? false;
|
|
48095
48141
|
}
|
|
@@ -48386,7 +48432,7 @@ function createTypeChecker(host) {
|
|
|
48386
48432
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
|
|
48387
48433
|
}
|
|
48388
48434
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
48389
|
-
var
|
|
48435
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
48390
48436
|
if (startsWith(moduleReference, "@types/")) {
|
|
48391
48437
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
48392
48438
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -48401,13 +48447,13 @@ function createTypeChecker(host) {
|
|
|
48401
48447
|
return ambientModule;
|
|
48402
48448
|
}
|
|
48403
48449
|
const currentSourceFile = getSourceFileOfNode(location);
|
|
48404
|
-
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(
|
|
48405
48451
|
location.initializer,
|
|
48406
48452
|
/*requireStringLiteralLikeArgument*/
|
|
48407
48453
|
true
|
|
48408
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);
|
|
48409
48455
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : host.getDefaultResolutionModeForFile(currentSourceFile);
|
|
48410
|
-
const
|
|
48456
|
+
const moduleResolutionKind2 = getEmitModuleResolutionKind(compilerOptions);
|
|
48411
48457
|
const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
|
|
48412
48458
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
48413
48459
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -48443,7 +48489,7 @@ function createTypeChecker(host) {
|
|
|
48443
48489
|
moduleReference
|
|
48444
48490
|
);
|
|
48445
48491
|
}
|
|
48446
|
-
if (
|
|
48492
|
+
if (moduleResolutionKind2 === 3 /* Node16 */ || moduleResolutionKind2 === 99 /* NodeNext */) {
|
|
48447
48493
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
48448
48494
|
const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
48449
48495
|
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !hasResolutionModeOverride(overrideHost)) {
|
|
@@ -48547,8 +48593,8 @@ function createTypeChecker(host) {
|
|
|
48547
48593
|
error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
48548
48594
|
} else {
|
|
48549
48595
|
const isExtensionlessRelativePathImport = pathIsRelative(moduleReference) && !hasExtension(moduleReference);
|
|
48550
|
-
const resolutionIsNode16OrNext =
|
|
48551
|
-
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)) {
|
|
48552
48598
|
error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
48553
48599
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
48554
48600
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
@@ -48634,7 +48680,7 @@ function createTypeChecker(host) {
|
|
|
48634
48680
|
return links.cjsExportMerged = merged;
|
|
48635
48681
|
}
|
|
48636
48682
|
function resolveESModuleSymbol(moduleSymbol, referencingLocation, dontResolveAlias, suppressInteropError) {
|
|
48637
|
-
var
|
|
48683
|
+
var _a2;
|
|
48638
48684
|
const symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias);
|
|
48639
48685
|
if (!dontResolveAlias && symbol) {
|
|
48640
48686
|
if (!suppressInteropError && !(symbol.flags & (1536 /* Module */ | 3 /* Variable */)) && !getDeclarationOfKind(symbol, 307 /* SourceFile */)) {
|
|
@@ -48650,7 +48696,7 @@ function createTypeChecker(host) {
|
|
|
48650
48696
|
if (defaultOnlyType) {
|
|
48651
48697
|
return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent);
|
|
48652
48698
|
}
|
|
48653
|
-
const targetFile = (
|
|
48699
|
+
const targetFile = (_a2 = moduleSymbol == null ? void 0 : moduleSymbol.declarations) == null ? void 0 : _a2.find(isSourceFile);
|
|
48654
48700
|
const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(getEmitSyntaxForModuleSpecifierExpression(reference), host.getImpliedNodeFormatForEmit(targetFile));
|
|
48655
48701
|
if (getESModuleInterop(compilerOptions) || isEsmCjsRef) {
|
|
48656
48702
|
let sigs = getSignaturesOfStructuredType(type, 0 /* Call */);
|
|
@@ -48859,8 +48905,8 @@ function createTypeChecker(host) {
|
|
|
48859
48905
|
return getMergedSymbol(symbol.parent && getLateBoundSymbol(symbol.parent));
|
|
48860
48906
|
}
|
|
48861
48907
|
function getFunctionExpressionParentSymbolOrSymbol(symbol) {
|
|
48862
|
-
var
|
|
48863
|
-
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;
|
|
48864
48910
|
}
|
|
48865
48911
|
function getAlternativeContainingModules(symbol, enclosingDeclaration) {
|
|
48866
48912
|
const containingFile = getSourceFileOfNode(enclosingDeclaration);
|
|
@@ -49014,11 +49060,11 @@ function createTypeChecker(host) {
|
|
|
49014
49060
|
return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && getSymbolFlags(symbol, !includeTypeOnlyMembers) & 111551 /* Value */);
|
|
49015
49061
|
}
|
|
49016
49062
|
function createType(flags) {
|
|
49017
|
-
var
|
|
49063
|
+
var _a2;
|
|
49018
49064
|
const result = new Type7(checker, flags);
|
|
49019
49065
|
typeCount++;
|
|
49020
49066
|
result.id = typeCount;
|
|
49021
|
-
(
|
|
49067
|
+
(_a2 = tracing) == null ? void 0 : _a2.recordType(result);
|
|
49022
49068
|
return result;
|
|
49023
49069
|
}
|
|
49024
49070
|
function createTypeWithSymbol(flags, symbol) {
|
|
@@ -49437,7 +49483,7 @@ function createTypeChecker(host) {
|
|
|
49437
49483
|
}
|
|
49438
49484
|
return { accessibility: 0 /* Accessible */, aliasesToMakeVisible };
|
|
49439
49485
|
function getIsDeclarationVisible(declaration) {
|
|
49440
|
-
var
|
|
49486
|
+
var _a2, _b;
|
|
49441
49487
|
if (!isDeclarationVisible(declaration)) {
|
|
49442
49488
|
const anyImportSyntax = getAnyImportSyntax(declaration);
|
|
49443
49489
|
if (anyImportSyntax && !hasSyntacticModifier(anyImportSyntax, 32 /* Export */) && // import clause without export
|
|
@@ -49449,7 +49495,7 @@ function createTypeChecker(host) {
|
|
|
49449
49495
|
} else if (isLateVisibilityPaintedStatement(declaration) && !hasSyntacticModifier(declaration, 32 /* Export */) && isDeclarationVisible(declaration.parent)) {
|
|
49450
49496
|
return addVisibleAlias(declaration, declaration);
|
|
49451
49497
|
} else if (isBindingElement(declaration)) {
|
|
49452
|
-
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)) {
|
|
49453
49499
|
return addVisibleAlias(declaration, declaration.parent.parent.parent.parent);
|
|
49454
49500
|
} else if (symbol.flags & 2 /* BlockScopedVariable */) {
|
|
49455
49501
|
const variableStatement = findAncestor(declaration, isVariableStatement);
|
|
@@ -49768,7 +49814,7 @@ function createTypeChecker(host) {
|
|
|
49768
49814
|
return typeNode;
|
|
49769
49815
|
}
|
|
49770
49816
|
function typeToTypeNodeWorker(type, context) {
|
|
49771
|
-
var
|
|
49817
|
+
var _a2, _b;
|
|
49772
49818
|
if (cancellationToken && cancellationToken.throwIfCancellationRequested) {
|
|
49773
49819
|
cancellationToken.throwIfCancellationRequested();
|
|
49774
49820
|
}
|
|
@@ -49902,7 +49948,7 @@ function createTypeChecker(host) {
|
|
|
49902
49948
|
if (!context.encounteredError && !(context.flags & 32768 /* AllowThisInObjectLiteral */)) {
|
|
49903
49949
|
context.encounteredError = true;
|
|
49904
49950
|
}
|
|
49905
|
-
(_b = (
|
|
49951
|
+
(_b = (_a2 = context.tracker).reportInaccessibleThisError) == null ? void 0 : _b.call(_a2);
|
|
49906
49952
|
}
|
|
49907
49953
|
context.approximateLength += 4;
|
|
49908
49954
|
return factory.createThisTypeNode();
|
|
@@ -50067,9 +50113,9 @@ function createTypeChecker(host) {
|
|
|
50067
50113
|
return factory.createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode);
|
|
50068
50114
|
}
|
|
50069
50115
|
function typeToTypeNodeOrCircularityElision(type2) {
|
|
50070
|
-
var
|
|
50116
|
+
var _a3, _b2, _c;
|
|
50071
50117
|
if (type2.flags & 1048576 /* Union */) {
|
|
50072
|
-
if ((
|
|
50118
|
+
if ((_a3 = context.visitedTypes) == null ? void 0 : _a3.has(getTypeId(type2))) {
|
|
50073
50119
|
if (!(context.flags & 131072 /* AllowAnonymousIdentifier */)) {
|
|
50074
50120
|
context.encounteredError = true;
|
|
50075
50121
|
(_c = (_b2 = context.tracker) == null ? void 0 : _b2.reportCyclicStructureError) == null ? void 0 : _c.call(_b2);
|
|
@@ -50087,13 +50133,13 @@ function createTypeChecker(host) {
|
|
|
50087
50133
|
return !!type2.target && isMappedTypeHomomorphic(type2.target) && !isMappedTypeHomomorphic(type2);
|
|
50088
50134
|
}
|
|
50089
50135
|
function createMappedTypeNodeFromType(type2) {
|
|
50090
|
-
var
|
|
50136
|
+
var _a3;
|
|
50091
50137
|
Debug.assert(!!(type2.flags & 524288 /* Object */));
|
|
50092
50138
|
const readonlyToken = type2.declaration.readonlyToken ? factory.createToken(type2.declaration.readonlyToken.kind) : void 0;
|
|
50093
50139
|
const questionToken = type2.declaration.questionToken ? factory.createToken(type2.declaration.questionToken.kind) : void 0;
|
|
50094
50140
|
let appropriateConstraintTypeNode;
|
|
50095
50141
|
let newTypeVariable;
|
|
50096
|
-
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 */);
|
|
50097
50143
|
if (isMappedTypeWithKeyofConstraintDeclaration(type2)) {
|
|
50098
50144
|
if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
50099
50145
|
const newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
|
|
@@ -50152,7 +50198,7 @@ function createTypeChecker(host) {
|
|
|
50152
50198
|
return result;
|
|
50153
50199
|
}
|
|
50154
50200
|
function createAnonymousTypeNode(type2) {
|
|
50155
|
-
var
|
|
50201
|
+
var _a3, _b2;
|
|
50156
50202
|
const typeId = type2.id;
|
|
50157
50203
|
const symbol = type2.symbol;
|
|
50158
50204
|
if (symbol) {
|
|
@@ -50166,7 +50212,7 @@ function createTypeChecker(host) {
|
|
|
50166
50212
|
return typeNode;
|
|
50167
50213
|
}
|
|
50168
50214
|
}
|
|
50169
|
-
if ((
|
|
50215
|
+
if ((_a3 = context.visitedTypes) == null ? void 0 : _a3.has(typeId)) {
|
|
50170
50216
|
return createElidedInformationPlaceholder(context);
|
|
50171
50217
|
}
|
|
50172
50218
|
return visitAndTransformType(type2, createTypeNodeFromObjectType);
|
|
@@ -50196,19 +50242,19 @@ function createTypeChecker(host) {
|
|
|
50196
50242
|
return createTypeNodeFromObjectType(type2);
|
|
50197
50243
|
}
|
|
50198
50244
|
function shouldWriteTypeOfFunctionSymbol() {
|
|
50199
|
-
var
|
|
50245
|
+
var _a4;
|
|
50200
50246
|
const isStaticMethodSymbol = !!(symbol.flags & 8192 /* Method */) && // typeof static method
|
|
50201
50247
|
some(symbol.declarations, (declaration) => isStatic(declaration));
|
|
50202
50248
|
const isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || // is exported function symbol
|
|
50203
50249
|
forEach(symbol.declarations, (declaration) => declaration.parent.kind === 307 /* SourceFile */ || declaration.parent.kind === 268 /* ModuleBlock */));
|
|
50204
50250
|
if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
|
|
50205
|
-
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
|
|
50206
50252
|
(!(context.flags & 8 /* UseStructuralFallback */) || isValueSymbolAccessible(symbol, context.enclosingDeclaration));
|
|
50207
50253
|
}
|
|
50208
50254
|
}
|
|
50209
50255
|
}
|
|
50210
50256
|
function visitAndTransformType(type2, transform) {
|
|
50211
|
-
var
|
|
50257
|
+
var _a3, _b2, _c;
|
|
50212
50258
|
const typeId = type2.id;
|
|
50213
50259
|
const isConstructorObject = getObjectFlags(type2) & 16 /* Anonymous */ && type2.symbol && type2.symbol.flags & 32 /* Class */;
|
|
50214
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;
|
|
@@ -50223,7 +50269,7 @@ function createTypeChecker(host) {
|
|
|
50223
50269
|
if (links) {
|
|
50224
50270
|
links.serializedTypes || (links.serializedTypes = /* @__PURE__ */ new Map());
|
|
50225
50271
|
}
|
|
50226
|
-
const cachedResult = (
|
|
50272
|
+
const cachedResult = (_a3 = links == null ? void 0 : links.serializedTypes) == null ? void 0 : _a3.get(key);
|
|
50227
50273
|
if (cachedResult) {
|
|
50228
50274
|
(_b2 = cachedResult.trackedSymbols) == null ? void 0 : _b2.forEach(
|
|
50229
50275
|
([symbol, enclosingDeclaration, meaning]) => context.tracker.trackSymbol(
|
|
@@ -50542,11 +50588,11 @@ function createTypeChecker(host) {
|
|
|
50542
50588
|
return factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
50543
50589
|
}
|
|
50544
50590
|
function shouldUsePlaceholderForProperty(propertySymbol, context) {
|
|
50545
|
-
var
|
|
50546
|
-
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 */));
|
|
50547
50593
|
}
|
|
50548
50594
|
function addPropertyToElementList(propertySymbol, context, typeElements) {
|
|
50549
|
-
var
|
|
50595
|
+
var _a2;
|
|
50550
50596
|
const propertyIsReverseMapped = !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */);
|
|
50551
50597
|
const propertyType = shouldUsePlaceholderForProperty(propertySymbol, context) ? anyType : getNonMissingTypeOfSymbol(propertySymbol);
|
|
50552
50598
|
const saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
@@ -50568,7 +50614,7 @@ function createTypeChecker(host) {
|
|
|
50568
50614
|
context.tracker.reportNonSerializableProperty(symbolToString(propertySymbol));
|
|
50569
50615
|
}
|
|
50570
50616
|
}
|
|
50571
|
-
context.enclosingDeclaration = propertySymbol.valueDeclaration || ((
|
|
50617
|
+
context.enclosingDeclaration = propertySymbol.valueDeclaration || ((_a2 = propertySymbol.declarations) == null ? void 0 : _a2[0]) || saveEnclosingDeclaration;
|
|
50572
50618
|
const propertyName = getPropertyNameNodeForSymbol(propertySymbol, context);
|
|
50573
50619
|
context.enclosingDeclaration = saveEnclosingDeclaration;
|
|
50574
50620
|
context.approximateLength += symbolName(propertySymbol).length + 1;
|
|
@@ -50636,8 +50682,8 @@ function createTypeChecker(host) {
|
|
|
50636
50682
|
);
|
|
50637
50683
|
typeElements.push(preserveCommentsOn(propertySignature));
|
|
50638
50684
|
function preserveCommentsOn(node) {
|
|
50639
|
-
var
|
|
50640
|
-
const jsdocPropertyTag = (
|
|
50685
|
+
var _a3;
|
|
50686
|
+
const jsdocPropertyTag = (_a3 = propertySymbol.declarations) == null ? void 0 : _a3.find((d) => d.kind === 348 /* JSDocPropertyTag */);
|
|
50641
50687
|
if (jsdocPropertyTag) {
|
|
50642
50688
|
const commentText = getTextOfJSDocComment(jsdocPropertyTag.comment);
|
|
50643
50689
|
if (commentText) {
|
|
@@ -50744,7 +50790,7 @@ function createTypeChecker(host) {
|
|
|
50744
50790
|
);
|
|
50745
50791
|
}
|
|
50746
50792
|
function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
|
|
50747
|
-
var
|
|
50793
|
+
var _a2;
|
|
50748
50794
|
const flags = context.flags;
|
|
50749
50795
|
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
50750
50796
|
context.approximateLength += 3;
|
|
@@ -50834,7 +50880,7 @@ function createTypeChecker(host) {
|
|
|
50834
50880
|
if (typeArguments) {
|
|
50835
50881
|
node.typeArguments = factory.createNodeArray(typeArguments);
|
|
50836
50882
|
}
|
|
50837
|
-
if (((
|
|
50883
|
+
if (((_a2 = signature.declaration) == null ? void 0 : _a2.kind) === 323 /* JSDocSignature */ && signature.declaration.parent.kind === 339 /* JSDocOverloadTag */) {
|
|
50838
50884
|
const comment = getTextOfNode(
|
|
50839
50885
|
signature.declaration.parent.parent,
|
|
50840
50886
|
/*includeTrivia*/
|
|
@@ -51166,11 +51212,11 @@ function createTypeChecker(host) {
|
|
|
51166
51212
|
return typeParameterNodes;
|
|
51167
51213
|
}
|
|
51168
51214
|
function lookupTypeParameterNodes(chain, index, context) {
|
|
51169
|
-
var
|
|
51215
|
+
var _a2;
|
|
51170
51216
|
Debug.assert(chain && 0 <= index && index < chain.length);
|
|
51171
51217
|
const symbol = chain[index];
|
|
51172
51218
|
const symbolId = getSymbolId(symbol);
|
|
51173
|
-
if ((
|
|
51219
|
+
if ((_a2 = context.typeParameterSymbolList) == null ? void 0 : _a2.has(symbolId)) {
|
|
51174
51220
|
return void 0;
|
|
51175
51221
|
}
|
|
51176
51222
|
(context.typeParameterSymbolList || (context.typeParameterSymbolList = /* @__PURE__ */ new Set())).add(symbolId);
|
|
@@ -51405,7 +51451,7 @@ function createTypeChecker(host) {
|
|
|
51405
51451
|
return false;
|
|
51406
51452
|
}
|
|
51407
51453
|
function typeParameterToName(type, context) {
|
|
51408
|
-
var
|
|
51454
|
+
var _a2, _b;
|
|
51409
51455
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && context.typeParameterNames) {
|
|
51410
51456
|
const cached = context.typeParameterNames.get(getTypeId(type));
|
|
51411
51457
|
if (cached) {
|
|
@@ -51424,7 +51470,7 @@ function createTypeChecker(host) {
|
|
|
51424
51470
|
}
|
|
51425
51471
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
51426
51472
|
const rawtext = result.escapedText;
|
|
51427
|
-
let i = ((
|
|
51473
|
+
let i = ((_a2 = context.typeParameterNamesByTextNextNameCount) == null ? void 0 : _a2.get(rawtext)) || 0;
|
|
51428
51474
|
let text = rawtext;
|
|
51429
51475
|
while (((_b = context.typeParameterNamesByText) == null ? void 0 : _b.has(text)) || typeParameterShadowsOtherTypeParameterInScope(text, context, type)) {
|
|
51430
51476
|
i++;
|
|
@@ -51600,7 +51646,7 @@ function createTypeChecker(host) {
|
|
|
51600
51646
|
return enclosingDeclaration;
|
|
51601
51647
|
}
|
|
51602
51648
|
function serializeTypeForDeclaration(context, declaration, type, symbol) {
|
|
51603
|
-
var
|
|
51649
|
+
var _a2;
|
|
51604
51650
|
const addUndefined = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
|
|
51605
51651
|
const enclosingDeclaration = context.enclosingDeclaration;
|
|
51606
51652
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
@@ -51617,7 +51663,7 @@ function createTypeChecker(host) {
|
|
|
51617
51663
|
if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)))) {
|
|
51618
51664
|
context.flags |= 1048576 /* AllowUniqueESSymbolType */;
|
|
51619
51665
|
}
|
|
51620
|
-
const decl = declaration ?? symbol.valueDeclaration ?? ((
|
|
51666
|
+
const decl = declaration ?? symbol.valueDeclaration ?? ((_a2 = symbol.declarations) == null ? void 0 : _a2[0]);
|
|
51621
51667
|
const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
|
|
51622
51668
|
if (decl && hasInferredType(decl) && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
|
|
51623
51669
|
syntacticNodeBuilder.serializeTypeOfDeclaration(decl, context);
|
|
@@ -51978,7 +52024,7 @@ function createTypeChecker(host) {
|
|
|
51978
52024
|
}
|
|
51979
52025
|
}
|
|
51980
52026
|
function symbolTableToDeclarationStatements(symbolTable, context) {
|
|
51981
|
-
var
|
|
52027
|
+
var _a2;
|
|
51982
52028
|
const serializePropertySymbolForClass = makeSerializePropertySymbol(
|
|
51983
52029
|
factory.createPropertyDeclaration,
|
|
51984
52030
|
174 /* MethodDeclaration */,
|
|
@@ -52000,14 +52046,14 @@ function createTypeChecker(host) {
|
|
|
52000
52046
|
...oldcontext,
|
|
52001
52047
|
usedSymbolNames: new Set(oldcontext.usedSymbolNames),
|
|
52002
52048
|
remappedSymbolNames: /* @__PURE__ */ new Map(),
|
|
52003
|
-
remappedSymbolReferences: new Map((
|
|
52049
|
+
remappedSymbolReferences: new Map((_a2 = oldcontext.remappedSymbolReferences) == null ? void 0 : _a2.entries()),
|
|
52004
52050
|
tracker: void 0
|
|
52005
52051
|
};
|
|
52006
52052
|
const tracker = {
|
|
52007
52053
|
...oldcontext.tracker.inner,
|
|
52008
52054
|
trackSymbol: (sym, decl, meaning) => {
|
|
52009
|
-
var
|
|
52010
|
-
if ((
|
|
52055
|
+
var _a3, _b;
|
|
52056
|
+
if ((_a3 = context.remappedSymbolNames) == null ? void 0 : _a3.has(getSymbolId(sym)))
|
|
52011
52057
|
return false;
|
|
52012
52058
|
const accessibleResult = isSymbolAccessible(
|
|
52013
52059
|
sym,
|
|
@@ -52242,7 +52288,7 @@ function createTypeChecker(host) {
|
|
|
52242
52288
|
}
|
|
52243
52289
|
}
|
|
52244
52290
|
function serializeSymbolWorker(symbol, isPrivate, propertyAsAlias, escapedSymbolName = symbol.escapedName) {
|
|
52245
|
-
var
|
|
52291
|
+
var _a3, _b, _c, _d, _e, _f;
|
|
52246
52292
|
const symbolName2 = unescapeLeadingUnderscores(escapedSymbolName);
|
|
52247
52293
|
const isDefault = escapedSymbolName === "default" /* Default */;
|
|
52248
52294
|
if (isPrivate && !(context.flags & 131072 /* AllowAnonymousIdentifier */) && isStringANonContextualKeyword(symbolName2) && !isDefault) {
|
|
@@ -52273,7 +52319,7 @@ function createTypeChecker(host) {
|
|
|
52273
52319
|
} else {
|
|
52274
52320
|
const type = getTypeOfSymbol(symbol);
|
|
52275
52321
|
const localName = getInternalSymbolName(symbol, symbolName2);
|
|
52276
|
-
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))) {
|
|
52277
52323
|
if (!context.remappedSymbolReferences) {
|
|
52278
52324
|
context.remappedSymbolReferences = /* @__PURE__ */ new Map();
|
|
52279
52325
|
}
|
|
@@ -52452,11 +52498,11 @@ function createTypeChecker(host) {
|
|
|
52452
52498
|
results.push(node);
|
|
52453
52499
|
}
|
|
52454
52500
|
function serializeTypeAlias(symbol, symbolName2, modifierFlags) {
|
|
52455
|
-
var
|
|
52501
|
+
var _a3;
|
|
52456
52502
|
const aliasType = getDeclaredTypeOfTypeAlias(symbol);
|
|
52457
52503
|
const typeParams = getSymbolLinks(symbol).typeParameters;
|
|
52458
52504
|
const typeParamDecls = map(typeParams, (p) => typeParameterToDeclaration(p, context));
|
|
52459
|
-
const jsdocAliasDecl = (
|
|
52505
|
+
const jsdocAliasDecl = (_a3 = symbol.declarations) == null ? void 0 : _a3.find(isJSDocTypeAlias);
|
|
52460
52506
|
const commentText = getTextOfJSDocComment(jsdocAliasDecl ? jsdocAliasDecl.comment || jsdocAliasDecl.parent.comment : void 0);
|
|
52461
52507
|
const oldFlags = context.flags;
|
|
52462
52508
|
context.flags |= 8388608 /* InTypeAlias */;
|
|
@@ -52543,12 +52589,12 @@ function createTypeChecker(host) {
|
|
|
52543
52589
|
/*isTypeOnly*/
|
|
52544
52590
|
false,
|
|
52545
52591
|
factory.createNamedExports(mapDefined(filter(mergedMembers, (n) => n.escapedName !== "export=" /* ExportEquals */), (s) => {
|
|
52546
|
-
var
|
|
52592
|
+
var _a3, _b;
|
|
52547
52593
|
const name = unescapeLeadingUnderscores(s.escapedName);
|
|
52548
52594
|
const localName2 = getInternalSymbolName(s, name);
|
|
52549
52595
|
const aliasDecl = s.declarations && getDeclarationOfAliasSymbol(s);
|
|
52550
52596
|
if (containingFile && (aliasDecl ? containingFile !== getSourceFileOfNode(aliasDecl) : !some(s.declarations, (d) => getSourceFileOfNode(d) === containingFile))) {
|
|
52551
|
-
(_b = (
|
|
52597
|
+
(_b = (_a3 = context.tracker) == null ? void 0 : _a3.reportNonlocalAugmentation) == null ? void 0 : _b.call(_a3, containingFile, symbol, s);
|
|
52552
52598
|
return void 0;
|
|
52553
52599
|
}
|
|
52554
52600
|
const target = aliasDecl && getTargetOfAliasDeclaration(
|
|
@@ -52714,8 +52760,8 @@ function createTypeChecker(host) {
|
|
|
52714
52760
|
return void 0;
|
|
52715
52761
|
}
|
|
52716
52762
|
function serializeAsClass(symbol, localName, modifierFlags) {
|
|
52717
|
-
var
|
|
52718
|
-
const originalDecl = (
|
|
52763
|
+
var _a3, _b;
|
|
52764
|
+
const originalDecl = (_a3 = symbol.declarations) == null ? void 0 : _a3.find(isClassLike);
|
|
52719
52765
|
const oldEnclosing = context.enclosingDeclaration;
|
|
52720
52766
|
context.enclosingDeclaration = originalDecl || oldEnclosing;
|
|
52721
52767
|
const localParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);
|
|
@@ -52812,7 +52858,7 @@ function createTypeChecker(host) {
|
|
|
52812
52858
|
});
|
|
52813
52859
|
}
|
|
52814
52860
|
function serializeAsAlias(symbol, localName, modifierFlags) {
|
|
52815
|
-
var
|
|
52861
|
+
var _a3, _b, _c, _d, _e, _f;
|
|
52816
52862
|
const node = getDeclarationOfAliasSymbol(symbol);
|
|
52817
52863
|
if (!node)
|
|
52818
52864
|
return Debug.fail();
|
|
@@ -52832,7 +52878,7 @@ function createTypeChecker(host) {
|
|
|
52832
52878
|
includePrivateSymbol(target);
|
|
52833
52879
|
switch (node.kind) {
|
|
52834
52880
|
case 208 /* BindingElement */:
|
|
52835
|
-
if (((_b = (
|
|
52881
|
+
if (((_b = (_a3 = node.parent) == null ? void 0 : _a3.parent) == null ? void 0 : _b.kind) === 260 /* VariableDeclaration */) {
|
|
52836
52882
|
const specifier2 = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
52837
52883
|
const { propertyName } = node;
|
|
52838
52884
|
addResult(
|
|
@@ -53055,7 +53101,7 @@ function createTypeChecker(host) {
|
|
|
53055
53101
|
);
|
|
53056
53102
|
}
|
|
53057
53103
|
function serializeMaybeAliasAssignment(symbol) {
|
|
53058
|
-
var
|
|
53104
|
+
var _a3;
|
|
53059
53105
|
if (symbol.flags & 4194304 /* Prototype */) {
|
|
53060
53106
|
return false;
|
|
53061
53107
|
}
|
|
@@ -53128,7 +53174,7 @@ function createTypeChecker(host) {
|
|
|
53128
53174
|
if (isTypeRepresentableAsFunctionNamespaceMerge(typeToSerialize, symbol)) {
|
|
53129
53175
|
serializeAsFunctionNamespaceMerge(typeToSerialize, symbol, varName, isExportAssignmentCompatibleSymbolName ? 0 /* None */ : 32 /* Export */);
|
|
53130
53176
|
} else {
|
|
53131
|
-
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 */;
|
|
53132
53178
|
const statement = factory.createVariableStatement(
|
|
53133
53179
|
/*modifiers*/
|
|
53134
53180
|
void 0,
|
|
@@ -53168,9 +53214,9 @@ function createTypeChecker(host) {
|
|
|
53168
53214
|
}
|
|
53169
53215
|
}
|
|
53170
53216
|
function isTypeRepresentableAsFunctionNamespaceMerge(typeToSerialize, hostSymbol) {
|
|
53171
|
-
var
|
|
53217
|
+
var _a3;
|
|
53172
53218
|
const ctxSrc = getSourceFileOfNode(context.enclosingDeclaration);
|
|
53173
|
-
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
|
|
53174
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
|
|
53175
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
|
|
53176
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) => {
|
|
@@ -53185,7 +53231,7 @@ function createTypeChecker(host) {
|
|
|
53185
53231
|
}
|
|
53186
53232
|
function makeSerializePropertySymbol(createProperty2, methodKind, useAccessors) {
|
|
53187
53233
|
return function serializePropertySymbol(p, isStatic2, baseType) {
|
|
53188
|
-
var
|
|
53234
|
+
var _a3, _b, _c, _d, _e;
|
|
53189
53235
|
const modifierFlags = getDeclarationModifierFlagsFromSymbol(p);
|
|
53190
53236
|
const isPrivate = !!(modifierFlags & 2 /* Private */);
|
|
53191
53237
|
if (isStatic2 && p.flags & (788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */)) {
|
|
@@ -53196,7 +53242,7 @@ function createTypeChecker(host) {
|
|
|
53196
53242
|
}
|
|
53197
53243
|
const flag = modifierFlags & ~1024 /* Async */ | (isStatic2 ? 256 /* Static */ : 0);
|
|
53198
53244
|
const name = getPropertyNameNodeForSymbol(p, context);
|
|
53199
|
-
const firstPropertyLikeDecl = (
|
|
53245
|
+
const firstPropertyLikeDecl = (_a3 = p.declarations) == null ? void 0 : _a3.find(or(isPropertyDeclaration, isAccessor, isVariableDeclaration, isPropertySignature, isBinaryExpression, isPropertyAccessExpression));
|
|
53200
53246
|
if (p.flags & 98304 /* Accessor */ && useAccessors) {
|
|
53201
53247
|
const result = [];
|
|
53202
53248
|
if (p.flags & 65536 /* SetAccessor */) {
|
|
@@ -53465,7 +53511,7 @@ function createTypeChecker(host) {
|
|
|
53465
53511
|
}
|
|
53466
53512
|
}
|
|
53467
53513
|
function getUnusedName(input, symbol) {
|
|
53468
|
-
var
|
|
53514
|
+
var _a3, _b;
|
|
53469
53515
|
const id = symbol ? getSymbolId(symbol) : void 0;
|
|
53470
53516
|
if (id) {
|
|
53471
53517
|
if (context.remappedSymbolNames.has(id)) {
|
|
@@ -53477,7 +53523,7 @@ function createTypeChecker(host) {
|
|
|
53477
53523
|
}
|
|
53478
53524
|
let i = 0;
|
|
53479
53525
|
const original = input;
|
|
53480
|
-
while ((
|
|
53526
|
+
while ((_a3 = context.usedSymbolNames) == null ? void 0 : _a3.has(input)) {
|
|
53481
53527
|
i++;
|
|
53482
53528
|
input = `${original}_${i}`;
|
|
53483
53529
|
}
|
|
@@ -53601,8 +53647,8 @@ function createTypeChecker(host) {
|
|
|
53601
53647
|
}
|
|
53602
53648
|
}
|
|
53603
53649
|
function getNameOfSymbolAsWritten(symbol, context) {
|
|
53604
|
-
var
|
|
53605
|
-
if ((
|
|
53650
|
+
var _a2;
|
|
53651
|
+
if ((_a2 = context == null ? void 0 : context.remappedSymbolReferences) == null ? void 0 : _a2.has(getSymbolId(symbol))) {
|
|
53606
53652
|
symbol = context.remappedSymbolReferences.get(getSymbolId(symbol));
|
|
53607
53653
|
}
|
|
53608
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`
|
|
@@ -53860,9 +53906,9 @@ function createTypeChecker(host) {
|
|
|
53860
53906
|
return prop ? getTypeOfSymbol(prop) : void 0;
|
|
53861
53907
|
}
|
|
53862
53908
|
function getTypeOfPropertyOrIndexSignatureOfType(type, name) {
|
|
53863
|
-
var
|
|
53909
|
+
var _a2;
|
|
53864
53910
|
let propType;
|
|
53865
|
-
return getTypeOfPropertyOfType(type, name) || (propType = (
|
|
53911
|
+
return getTypeOfPropertyOfType(type, name) || (propType = (_a2 = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a2.type) && addOptionality(
|
|
53866
53912
|
propType,
|
|
53867
53913
|
/*isProperty*/
|
|
53868
53914
|
true,
|
|
@@ -54350,14 +54396,14 @@ function createTypeChecker(host) {
|
|
|
54350
54396
|
return widened;
|
|
54351
54397
|
}
|
|
54352
54398
|
function getJSContainerObjectType(decl, symbol, init) {
|
|
54353
|
-
var
|
|
54399
|
+
var _a2, _b;
|
|
54354
54400
|
if (!isInJSFile(decl) || !init || !isObjectLiteralExpression(init) || init.properties.length) {
|
|
54355
54401
|
return void 0;
|
|
54356
54402
|
}
|
|
54357
54403
|
const exports2 = createSymbolTable();
|
|
54358
54404
|
while (isBinaryExpression(decl) || isPropertyAccessExpression(decl)) {
|
|
54359
54405
|
const s2 = getSymbolOfNode(decl);
|
|
54360
|
-
if ((
|
|
54406
|
+
if ((_a2 = s2 == null ? void 0 : s2.exports) == null ? void 0 : _a2.size) {
|
|
54361
54407
|
mergeSymbolTable(exports2, s2.exports);
|
|
54362
54408
|
}
|
|
54363
54409
|
decl = isBinaryExpression(decl) ? decl.parent : decl.parent.parent;
|
|
@@ -54371,7 +54417,7 @@ function createTypeChecker(host) {
|
|
|
54371
54417
|
return type;
|
|
54372
54418
|
}
|
|
54373
54419
|
function getAnnotatedTypeForAssignmentDeclaration(declaredType, expression, symbol, declaration) {
|
|
54374
|
-
var
|
|
54420
|
+
var _a2;
|
|
54375
54421
|
const typeNode = getEffectiveTypeAnnotationNode(expression.parent);
|
|
54376
54422
|
if (typeNode) {
|
|
54377
54423
|
const type = getWidenedType(getTypeFromTypeNode(typeNode));
|
|
@@ -54387,7 +54433,7 @@ function createTypeChecker(host) {
|
|
|
54387
54433
|
);
|
|
54388
54434
|
}
|
|
54389
54435
|
}
|
|
54390
|
-
if ((
|
|
54436
|
+
if ((_a2 = symbol.parent) == null ? void 0 : _a2.valueDeclaration) {
|
|
54391
54437
|
const possiblyAnnotatedSymbol = getFunctionExpressionParentSymbolOrSymbol(symbol.parent);
|
|
54392
54438
|
if (possiblyAnnotatedSymbol.valueDeclaration) {
|
|
54393
54439
|
const typeNode2 = getEffectiveTypeAnnotationNode(possiblyAnnotatedSymbol.valueDeclaration);
|
|
@@ -54441,13 +54487,13 @@ function createTypeChecker(host) {
|
|
|
54441
54487
|
resolvedSymbol.exports = createSymbolTable();
|
|
54442
54488
|
}
|
|
54443
54489
|
(resolvedSymbol || symbol).exports.forEach((s, name) => {
|
|
54444
|
-
var
|
|
54490
|
+
var _a2;
|
|
54445
54491
|
const exportedMember = members.get(name);
|
|
54446
54492
|
if (exportedMember && exportedMember !== s && !(s.flags & 2097152 /* Alias */)) {
|
|
54447
54493
|
if (s.flags & 111551 /* Value */ && exportedMember.flags & 111551 /* Value */) {
|
|
54448
54494
|
if (s.valueDeclaration && exportedMember.valueDeclaration && getSourceFileOfNode(s.valueDeclaration) !== getSourceFileOfNode(exportedMember.valueDeclaration)) {
|
|
54449
54495
|
const unescapedName = unescapeLeadingUnderscores(s.escapedName);
|
|
54450
|
-
const exportedMemberName = ((
|
|
54496
|
+
const exportedMemberName = ((_a2 = tryCast(exportedMember.valueDeclaration, isNamedDeclaration)) == null ? void 0 : _a2.name) || exportedMember.valueDeclaration;
|
|
54451
54497
|
addRelatedInfo(
|
|
54452
54498
|
error(s.valueDeclaration, Diagnostics.Duplicate_identifier_0, unescapedName),
|
|
54453
54499
|
createDiagnosticForNode(exportedMemberName, Diagnostics._0_was_also_declared_here, unescapedName)
|
|
@@ -55120,8 +55166,11 @@ function createTypeChecker(host) {
|
|
|
55120
55166
|
}
|
|
55121
55167
|
}
|
|
55122
55168
|
function getOuterTypeParametersOfClassOrInterface(symbol) {
|
|
55123
|
-
var
|
|
55124
|
-
|
|
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) => {
|
|
55125
55174
|
if (decl.kind === 264 /* InterfaceDeclaration */) {
|
|
55126
55175
|
return true;
|
|
55127
55176
|
}
|
|
@@ -55442,13 +55491,13 @@ function createTypeChecker(host) {
|
|
|
55442
55491
|
return links.declaredType;
|
|
55443
55492
|
}
|
|
55444
55493
|
function getDeclaredTypeOfTypeAlias(symbol) {
|
|
55445
|
-
var
|
|
55494
|
+
var _a2;
|
|
55446
55495
|
const links = getSymbolLinks(symbol);
|
|
55447
55496
|
if (!links.declaredType) {
|
|
55448
55497
|
if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) {
|
|
55449
55498
|
return errorType;
|
|
55450
55499
|
}
|
|
55451
|
-
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");
|
|
55452
55501
|
const typeNode = isJSDocTypeAlias(declaration) ? declaration.typeExpression : declaration.type;
|
|
55453
55502
|
let type = typeNode ? getTypeFromTypeNode(typeNode) : errorType;
|
|
55454
55503
|
if (popTypeResolution()) {
|
|
@@ -56347,8 +56396,8 @@ function createTypeChecker(host) {
|
|
|
56347
56396
|
if (symbol === globalThisSymbol) {
|
|
56348
56397
|
const varsOnly = /* @__PURE__ */ new Map();
|
|
56349
56398
|
members.forEach((p) => {
|
|
56350
|
-
var
|
|
56351
|
-
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))) {
|
|
56352
56401
|
varsOnly.set(p.escapedName, p);
|
|
56353
56402
|
}
|
|
56354
56403
|
});
|
|
@@ -56584,7 +56633,7 @@ function createTypeChecker(host) {
|
|
|
56584
56633
|
}
|
|
56585
56634
|
}
|
|
56586
56635
|
function getTypeOfMappedSymbol(symbol) {
|
|
56587
|
-
var
|
|
56636
|
+
var _a2;
|
|
56588
56637
|
if (!symbol.links.type) {
|
|
56589
56638
|
const mappedType = symbol.links.mappedType;
|
|
56590
56639
|
if (!pushTypeResolution(symbol, 0 /* Type */)) {
|
|
@@ -56603,7 +56652,7 @@ function createTypeChecker(host) {
|
|
|
56603
56652
|
error(currentNode, Diagnostics.Type_of_property_0_circularly_references_itself_in_mapped_type_1, symbolToString(symbol), typeToString(mappedType));
|
|
56604
56653
|
type = errorType;
|
|
56605
56654
|
}
|
|
56606
|
-
(
|
|
56655
|
+
(_a2 = symbol.links).type ?? (_a2.type = type);
|
|
56607
56656
|
}
|
|
56608
56657
|
return symbol.links.type;
|
|
56609
56658
|
}
|
|
@@ -56802,8 +56851,8 @@ function createTypeChecker(host) {
|
|
|
56802
56851
|
return !!typeVariable && isConstTypeVariable(typeVariable, depth);
|
|
56803
56852
|
}
|
|
56804
56853
|
function isConstTypeVariable(type, depth = 0) {
|
|
56805
|
-
var
|
|
56806
|
-
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));
|
|
56807
56856
|
}
|
|
56808
56857
|
function getConstraintOfIndexedAccess(type) {
|
|
56809
56858
|
return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : void 0;
|
|
@@ -57094,7 +57143,7 @@ function createTypeChecker(host) {
|
|
|
57094
57143
|
return getReducedType(getApparentType(getReducedType(type)));
|
|
57095
57144
|
}
|
|
57096
57145
|
function createUnionOrIntersectionProperty(containingType, name, skipObjectFunctionPropertyAugment) {
|
|
57097
|
-
var
|
|
57146
|
+
var _a2, _b, _c;
|
|
57098
57147
|
let singleProp;
|
|
57099
57148
|
let propSet;
|
|
57100
57149
|
let indexTypes;
|
|
@@ -57162,7 +57211,7 @@ function createTypeChecker(host) {
|
|
|
57162
57211
|
}
|
|
57163
57212
|
if (!propSet && !(checkFlags & 16 /* ReadPartial */) && !indexTypes) {
|
|
57164
57213
|
if (mergedInstantiations) {
|
|
57165
|
-
const links = (
|
|
57214
|
+
const links = (_a2 = tryCast(singleProp, isTransientSymbol)) == null ? void 0 : _a2.links;
|
|
57166
57215
|
const clone = createSymbolWithType(singleProp, links == null ? void 0 : links.type);
|
|
57167
57216
|
clone.parent = (_c = (_b = singleProp.valueDeclaration) == null ? void 0 : _b.symbol) == null ? void 0 : _c.parent;
|
|
57168
57217
|
clone.links.containingType = containingType;
|
|
@@ -57233,8 +57282,8 @@ function createTypeChecker(host) {
|
|
|
57233
57282
|
return result;
|
|
57234
57283
|
}
|
|
57235
57284
|
function getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment) {
|
|
57236
|
-
var
|
|
57237
|
-
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);
|
|
57238
57287
|
if (!property) {
|
|
57239
57288
|
property = createUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment);
|
|
57240
57289
|
if (property) {
|
|
@@ -57335,12 +57384,12 @@ function createTypeChecker(host) {
|
|
|
57335
57384
|
return errorInfo;
|
|
57336
57385
|
}
|
|
57337
57386
|
function getPropertyOfType(type, name, skipObjectFunctionPropertyAugment, includeTypeOnlyMembers) {
|
|
57338
|
-
var
|
|
57387
|
+
var _a2, _b;
|
|
57339
57388
|
type = getReducedApparentType(type);
|
|
57340
57389
|
if (type.flags & 524288 /* Object */) {
|
|
57341
57390
|
const resolved = resolveStructuredTypeMembers(type);
|
|
57342
57391
|
const symbol = resolved.members.get(name);
|
|
57343
|
-
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))) {
|
|
57344
57393
|
return void 0;
|
|
57345
57394
|
}
|
|
57346
57395
|
if (symbol && symbolIsValue(symbol, includeTypeOnlyMembers)) {
|
|
@@ -57392,8 +57441,8 @@ function createTypeChecker(host) {
|
|
|
57392
57441
|
}
|
|
57393
57442
|
let memberName;
|
|
57394
57443
|
if (everyType(type, (t) => {
|
|
57395
|
-
var
|
|
57396
|
-
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);
|
|
57397
57446
|
})) {
|
|
57398
57447
|
const arrayArg = mapType(type, (t) => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters[0], t.mapper));
|
|
57399
57448
|
const arrayType = createArrayType(arrayArg, someType(type, (t) => isReadonlyArraySymbol(t.symbol.parent)));
|
|
@@ -57457,8 +57506,8 @@ function createTypeChecker(host) {
|
|
|
57457
57506
|
return findIndexInfo(getIndexInfosOfType(type), keyType);
|
|
57458
57507
|
}
|
|
57459
57508
|
function getIndexTypeOfType(type, keyType) {
|
|
57460
|
-
var
|
|
57461
|
-
return (
|
|
57509
|
+
var _a2;
|
|
57510
|
+
return (_a2 = getIndexInfoOfType(type, keyType)) == null ? void 0 : _a2.type;
|
|
57462
57511
|
}
|
|
57463
57512
|
function getApplicableIndexInfos(type, keyType) {
|
|
57464
57513
|
return getIndexInfosOfType(type).filter((info) => isApplicableIndexType(keyType, info.keyType));
|
|
@@ -57470,12 +57519,12 @@ function createTypeChecker(host) {
|
|
|
57470
57519
|
return getApplicableIndexInfo(type, isLateBoundName(name) ? esSymbolType : getStringLiteralType(unescapeLeadingUnderscores(name)));
|
|
57471
57520
|
}
|
|
57472
57521
|
function getTypeParametersFromDeclaration(declaration) {
|
|
57473
|
-
var
|
|
57522
|
+
var _a2;
|
|
57474
57523
|
let result;
|
|
57475
57524
|
for (const node of getEffectiveTypeParameterDeclarations(declaration)) {
|
|
57476
57525
|
result = appendIfUnique(result, getDeclaredTypeOfTypeParameter(node.symbol));
|
|
57477
57526
|
}
|
|
57478
|
-
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;
|
|
57479
57528
|
}
|
|
57480
57529
|
function symbolsToArray(symbols) {
|
|
57481
57530
|
const result = [];
|
|
@@ -57962,9 +58011,9 @@ function createTypeChecker(host) {
|
|
|
57962
58011
|
return signature;
|
|
57963
58012
|
}
|
|
57964
58013
|
function getOrCreateTypeFromSignature(signature, outerTypeParameters) {
|
|
57965
|
-
var
|
|
58014
|
+
var _a2;
|
|
57966
58015
|
if (!signature.isolatedSignatureType) {
|
|
57967
|
-
const kind = (
|
|
58016
|
+
const kind = (_a2 = signature.declaration) == null ? void 0 : _a2.kind;
|
|
57968
58017
|
const isConstructor = kind === void 0 || kind === 176 /* Constructor */ || kind === 180 /* ConstructSignature */ || kind === 185 /* ConstructorType */;
|
|
57969
58018
|
const type = createObjectType(16 /* Anonymous */ | 134217728 /* SingleSignatureType */, createSymbol(16 /* Function */, "__function" /* Function */));
|
|
57970
58019
|
if (signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
|
@@ -58025,9 +58074,9 @@ function createTypeChecker(host) {
|
|
|
58025
58074
|
return mapDefined(filter(type.symbol && type.symbol.declarations, isTypeParameterDeclaration), getEffectiveConstraintOfTypeParameter)[0];
|
|
58026
58075
|
}
|
|
58027
58076
|
function getInferredTypeParameterConstraint(typeParameter, omitTypeReferences) {
|
|
58028
|
-
var
|
|
58077
|
+
var _a2;
|
|
58029
58078
|
let inferences;
|
|
58030
|
-
if ((
|
|
58079
|
+
if ((_a2 = typeParameter.symbol) == null ? void 0 : _a2.declarations) {
|
|
58031
58080
|
for (const declaration of typeParameter.symbol.declarations) {
|
|
58032
58081
|
if (declaration.parent.kind === 195 /* InferType */) {
|
|
58033
58082
|
const [childTypeParameter = declaration.parent, grandParent] = walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent);
|
|
@@ -58168,10 +58217,10 @@ function createTypeChecker(host) {
|
|
|
58168
58217
|
return type;
|
|
58169
58218
|
}
|
|
58170
58219
|
function getTypeArguments(type) {
|
|
58171
|
-
var
|
|
58220
|
+
var _a2, _b;
|
|
58172
58221
|
if (!type.resolvedTypeArguments) {
|
|
58173
58222
|
if (!pushTypeResolution(type, 6 /* ResolvedTypeArguments */)) {
|
|
58174
|
-
return ((
|
|
58223
|
+
return ((_a2 = type.target.localTypeParameters) == null ? void 0 : _a2.map(() => errorType)) || emptyArray;
|
|
58175
58224
|
}
|
|
58176
58225
|
const node = type.node;
|
|
58177
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);
|
|
@@ -58302,8 +58351,8 @@ function createTypeChecker(host) {
|
|
|
58302
58351
|
return checkNoTypeArguments(node, symbol) ? type : errorType;
|
|
58303
58352
|
}
|
|
58304
58353
|
function isLocalTypeAlias(symbol) {
|
|
58305
|
-
var
|
|
58306
|
-
const declaration = (
|
|
58354
|
+
var _a2;
|
|
58355
|
+
const declaration = (_a2 = symbol.declarations) == null ? void 0 : _a2.find(isTypeAlias);
|
|
58307
58356
|
return !!(declaration && getContainingFunction(declaration));
|
|
58308
58357
|
}
|
|
58309
58358
|
function getTypeReferenceName(node) {
|
|
@@ -59140,7 +59189,7 @@ function createTypeChecker(host) {
|
|
|
59140
59189
|
return target.objectFlags & 8 /* Tuple */ ? createNormalizedTupleType(target, typeArguments) : createTypeReference(target, typeArguments);
|
|
59141
59190
|
}
|
|
59142
59191
|
function createNormalizedTupleType(target, elementTypes) {
|
|
59143
|
-
var
|
|
59192
|
+
var _a2, _b, _c, _d;
|
|
59144
59193
|
if (!(target.combinedFlags & 14 /* NonRequired */)) {
|
|
59145
59194
|
return createTypeReference(target, elementTypes);
|
|
59146
59195
|
}
|
|
@@ -59161,7 +59210,7 @@ function createTypeChecker(host) {
|
|
|
59161
59210
|
const flags = target.elementFlags[i];
|
|
59162
59211
|
if (flags & 8 /* Variadic */) {
|
|
59163
59212
|
if (type.flags & 1 /* Any */) {
|
|
59164
|
-
addElement(type, 4 /* Rest */, (
|
|
59213
|
+
addElement(type, 4 /* Rest */, (_a2 = target.labeledElementDeclarations) == null ? void 0 : _a2[i]);
|
|
59165
59214
|
} else if (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type)) {
|
|
59166
59215
|
addElement(type, 8 /* Variadic */, (_b = target.labeledElementDeclarations) == null ? void 0 : _b[i]);
|
|
59167
59216
|
} else if (isTupleType(type)) {
|
|
@@ -59174,8 +59223,8 @@ function createTypeChecker(host) {
|
|
|
59174
59223
|
return errorType;
|
|
59175
59224
|
}
|
|
59176
59225
|
forEach(elements, (t, n) => {
|
|
59177
|
-
var
|
|
59178
|
-
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]);
|
|
59179
59228
|
});
|
|
59180
59229
|
} else {
|
|
59181
59230
|
addElement(isArrayLikeType(type) && getIndexTypeOfType(type, numberType) || errorType, 4 /* Rest */, (_c = target.labeledElementDeclarations) == null ? void 0 : _c[i]);
|
|
@@ -59299,7 +59348,7 @@ function createTypeChecker(host) {
|
|
|
59299
59348
|
return includes;
|
|
59300
59349
|
}
|
|
59301
59350
|
function removeSubtypes(types, hasObjectTypes) {
|
|
59302
|
-
var
|
|
59351
|
+
var _a2;
|
|
59303
59352
|
if (types.length < 2) {
|
|
59304
59353
|
return types;
|
|
59305
59354
|
}
|
|
@@ -59329,7 +59378,7 @@ function createTypeChecker(host) {
|
|
|
59329
59378
|
if (count === 1e5) {
|
|
59330
59379
|
const estimatedCount = count / (len - i) * len;
|
|
59331
59380
|
if (estimatedCount > 1e6) {
|
|
59332
|
-
(
|
|
59381
|
+
(_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "removeSubtypes_DepthLimit", { typeIds: types.map((t) => t.id) });
|
|
59333
59382
|
error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
|
|
59334
59383
|
return void 0;
|
|
59335
59384
|
}
|
|
@@ -59794,10 +59843,10 @@ function createTypeChecker(host) {
|
|
|
59794
59843
|
return reduceLeft(types, (n, t) => t.flags & 1048576 /* Union */ ? n * t.types.length : t.flags & 131072 /* Never */ ? 0 : n, 1);
|
|
59795
59844
|
}
|
|
59796
59845
|
function checkCrossProductUnion(types) {
|
|
59797
|
-
var
|
|
59846
|
+
var _a2;
|
|
59798
59847
|
const size = getCrossProductUnionSize(types);
|
|
59799
59848
|
if (size >= 1e5) {
|
|
59800
|
-
(
|
|
59849
|
+
(_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "checkCrossProductUnion_DepthLimit", { typeIds: types.map((t) => t.id), size });
|
|
59801
59850
|
error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
|
|
59802
59851
|
return false;
|
|
59803
59852
|
}
|
|
@@ -59985,7 +60034,7 @@ function createTypeChecker(host) {
|
|
|
59985
60034
|
return links.resolvedType;
|
|
59986
60035
|
}
|
|
59987
60036
|
function getTemplateLiteralType(texts, types) {
|
|
59988
|
-
var
|
|
60037
|
+
var _a2, _b;
|
|
59989
60038
|
const unionIndex = findIndex(types, (t) => !!(t.flags & (131072 /* Never */ | 1048576 /* Union */)));
|
|
59990
60039
|
if (unionIndex >= 0) {
|
|
59991
60040
|
return checkCrossProductUnion(types) ? mapType(types[unionIndex], (t) => getTemplateLiteralType(texts, replaceElement(types, unionIndex, t))) : errorType;
|
|
@@ -59993,7 +60042,7 @@ function createTypeChecker(host) {
|
|
|
59993
60042
|
if (contains(types, wildcardType)) {
|
|
59994
60043
|
return wildcardType;
|
|
59995
60044
|
}
|
|
59996
|
-
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)) {
|
|
59997
60046
|
return types[0];
|
|
59998
60047
|
}
|
|
59999
60048
|
const newTypes = [];
|
|
@@ -60497,7 +60546,7 @@ function createTypeChecker(host) {
|
|
|
60497
60546
|
if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
|
|
60498
60547
|
indexType = stringType;
|
|
60499
60548
|
}
|
|
60500
|
-
if (
|
|
60549
|
+
if (noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */)
|
|
60501
60550
|
accessFlags |= 1 /* IncludeUndefined */;
|
|
60502
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))) {
|
|
60503
60552
|
if (objectType.flags & 3 /* AnyOrUnknown */) {
|
|
@@ -60745,7 +60794,7 @@ function createTypeChecker(host) {
|
|
|
60745
60794
|
}
|
|
60746
60795
|
}
|
|
60747
60796
|
function getTypeFromImportTypeNode(node) {
|
|
60748
|
-
var
|
|
60797
|
+
var _a2;
|
|
60749
60798
|
const links = getNodeLinks(node);
|
|
60750
60799
|
if (!links.resolvedType) {
|
|
60751
60800
|
if (!isLiteralImportTypeNode(node)) {
|
|
@@ -60759,7 +60808,7 @@ function createTypeChecker(host) {
|
|
|
60759
60808
|
links.resolvedSymbol = unknownSymbol;
|
|
60760
60809
|
return links.resolvedType = errorType;
|
|
60761
60810
|
}
|
|
60762
|
-
const isExportEquals = !!((
|
|
60811
|
+
const isExportEquals = !!((_a2 = innerModuleSymbol.exports) == null ? void 0 : _a2.get("export=" /* ExportEquals */));
|
|
60763
60812
|
const moduleSymbol = resolveExternalModuleSymbol(
|
|
60764
60813
|
innerModuleSymbol,
|
|
60765
60814
|
/*dontResolveAlias*/
|
|
@@ -60964,8 +61013,8 @@ function createTypeChecker(host) {
|
|
|
60964
61013
|
return spread;
|
|
60965
61014
|
}
|
|
60966
61015
|
function isSpreadableProperty(prop) {
|
|
60967
|
-
var
|
|
60968
|
-
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))));
|
|
60969
61018
|
}
|
|
60970
61019
|
function getSpreadSymbol(prop, readonly) {
|
|
60971
61020
|
const isSetonlyAccessor = prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */);
|
|
@@ -61607,12 +61656,12 @@ function createTypeChecker(host) {
|
|
|
61607
61656
|
) : type;
|
|
61608
61657
|
}
|
|
61609
61658
|
function instantiateTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
61610
|
-
var
|
|
61659
|
+
var _a2;
|
|
61611
61660
|
if (!couldContainTypeVariables(type)) {
|
|
61612
61661
|
return type;
|
|
61613
61662
|
}
|
|
61614
61663
|
if (instantiationDepth === 100 || instantiationCount >= 5e6) {
|
|
61615
|
-
(
|
|
61664
|
+
(_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "instantiateType_DepthLimit", { typeId: type.id, instantiationDepth, instantiationCount });
|
|
61616
61665
|
error(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
61617
61666
|
return errorType;
|
|
61618
61667
|
}
|
|
@@ -62786,7 +62835,7 @@ function createTypeChecker(host) {
|
|
|
62786
62835
|
return elements !== normalizedElements ? createNormalizedTupleType(type.target, normalizedElements) : type;
|
|
62787
62836
|
}
|
|
62788
62837
|
function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer) {
|
|
62789
|
-
var
|
|
62838
|
+
var _a2;
|
|
62790
62839
|
let errorInfo;
|
|
62791
62840
|
let relatedInfo;
|
|
62792
62841
|
let maybeKeys;
|
|
@@ -62826,7 +62875,7 @@ function createTypeChecker(host) {
|
|
|
62826
62875
|
false
|
|
62827
62876
|
);
|
|
62828
62877
|
relation.set(id, 4 /* Reported */ | 2 /* Failed */);
|
|
62829
|
-
(
|
|
62878
|
+
(_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth: sourceDepth, targetDepth });
|
|
62830
62879
|
const message = relationCount <= 0 ? Diagnostics.Excessive_complexity_comparing_types_0_and_1 : Diagnostics.Excessive_stack_depth_comparing_types_0_and_1;
|
|
62831
62880
|
const diag2 = error(errorNode || currentNode, message, typeToString(source), typeToString(target));
|
|
62832
62881
|
if (errorOutputContainer) {
|
|
@@ -63201,7 +63250,7 @@ function createTypeChecker(host) {
|
|
|
63201
63250
|
return 0 /* False */;
|
|
63202
63251
|
}
|
|
63203
63252
|
function reportErrorResults(originalSource, originalTarget, source2, target2, headMessage2) {
|
|
63204
|
-
var
|
|
63253
|
+
var _a3, _b;
|
|
63205
63254
|
const sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource);
|
|
63206
63255
|
const targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget);
|
|
63207
63256
|
source2 = originalSource.aliasSymbol || sourceHasBase ? originalSource : source2;
|
|
@@ -63251,7 +63300,7 @@ function createTypeChecker(host) {
|
|
|
63251
63300
|
return;
|
|
63252
63301
|
}
|
|
63253
63302
|
reportRelationError(headMessage2, source2, target2);
|
|
63254
|
-
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)) {
|
|
63255
63304
|
const syntheticParam = cloneTypeParameter(source2);
|
|
63256
63305
|
syntheticParam.constraint = instantiateType(target2, makeUnaryTypeMapper(source2, syntheticParam));
|
|
63257
63306
|
if (hasNonCircularBaseConstraint(syntheticParam)) {
|
|
@@ -63286,10 +63335,10 @@ function createTypeChecker(host) {
|
|
|
63286
63335
|
}
|
|
63287
63336
|
function getTypeOfPropertyInTypes(types, name) {
|
|
63288
63337
|
const appendPropType = (propTypes, type) => {
|
|
63289
|
-
var
|
|
63338
|
+
var _a3;
|
|
63290
63339
|
type = getApparentType(type);
|
|
63291
63340
|
const prop = type.flags & 3145728 /* UnionOrIntersection */ ? getPropertyOfUnionOrIntersectionType(type, name) : getPropertyOfObjectType(type, name);
|
|
63292
|
-
const propType = prop && getTypeOfSymbol(prop) || ((
|
|
63341
|
+
const propType = prop && getTypeOfSymbol(prop) || ((_a3 = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a3.type) || undefinedType;
|
|
63293
63342
|
return append(propTypes, propType);
|
|
63294
63343
|
};
|
|
63295
63344
|
return getUnionType(reduceLeft(
|
|
@@ -63300,7 +63349,7 @@ function createTypeChecker(host) {
|
|
|
63300
63349
|
) || emptyArray);
|
|
63301
63350
|
}
|
|
63302
63351
|
function hasExcessProperties(source2, target2, reportErrors2) {
|
|
63303
|
-
var
|
|
63352
|
+
var _a3;
|
|
63304
63353
|
if (!isExcessPropertyCheckTarget(target2) || !noImplicitAny && getObjectFlags(target2) & 4096 /* JSLiteral */) {
|
|
63305
63354
|
return false;
|
|
63306
63355
|
}
|
|
@@ -63334,7 +63383,7 @@ function createTypeChecker(host) {
|
|
|
63334
63383
|
reportError(Diagnostics.Property_0_does_not_exist_on_type_1, propName, typeToString(errorTarget));
|
|
63335
63384
|
}
|
|
63336
63385
|
} else {
|
|
63337
|
-
const objectLiteralDeclaration = ((
|
|
63386
|
+
const objectLiteralDeclaration = ((_a3 = source2.symbol) == null ? void 0 : _a3.declarations) && firstOrUndefined(source2.symbol.declarations);
|
|
63338
63387
|
let suggestion;
|
|
63339
63388
|
if (prop.valueDeclaration && findAncestor(prop.valueDeclaration, (d) => d === objectLiteralDeclaration) && getSourceFileOfNode(objectLiteralDeclaration) === getSourceFileOfNode(errorNode)) {
|
|
63340
63389
|
const propDeclaration = prop.valueDeclaration;
|
|
@@ -63674,7 +63723,7 @@ function createTypeChecker(host) {
|
|
|
63674
63723
|
return result2;
|
|
63675
63724
|
}
|
|
63676
63725
|
function recursiveTypeRelatedTo(source2, target2, reportErrors2, intersectionState, recursionFlags) {
|
|
63677
|
-
var
|
|
63726
|
+
var _a3, _b, _c;
|
|
63678
63727
|
if (overflow) {
|
|
63679
63728
|
return 0 /* False */;
|
|
63680
63729
|
}
|
|
@@ -63759,7 +63808,7 @@ function createTypeChecker(host) {
|
|
|
63759
63808
|
}
|
|
63760
63809
|
let result2;
|
|
63761
63810
|
if (expandingFlags === 3 /* Both */) {
|
|
63762
|
-
(
|
|
63811
|
+
(_a3 = tracing) == null ? void 0 : _a3.instant(tracing.Phase.CheckTypes, "recursiveTypeRelatedTo_DepthLimit", {
|
|
63763
63812
|
sourceId: source2.id,
|
|
63764
63813
|
sourceIdStack: sourceStack.map((t) => t.id),
|
|
63765
63814
|
targetId: target2.id,
|
|
@@ -64440,7 +64489,7 @@ function createTypeChecker(host) {
|
|
|
64440
64489
|
return 0 /* False */;
|
|
64441
64490
|
}
|
|
64442
64491
|
function typeRelatedToDiscriminatedType(source2, target2) {
|
|
64443
|
-
var
|
|
64492
|
+
var _a3;
|
|
64444
64493
|
const sourceProperties = getPropertiesOfType(source2);
|
|
64445
64494
|
const sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target2);
|
|
64446
64495
|
if (!sourcePropertiesFiltered)
|
|
@@ -64449,7 +64498,7 @@ function createTypeChecker(host) {
|
|
|
64449
64498
|
for (const sourceProperty of sourcePropertiesFiltered) {
|
|
64450
64499
|
numCombinations *= countTypes(getNonMissingTypeOfSymbol(sourceProperty));
|
|
64451
64500
|
if (numCombinations > 25) {
|
|
64452
|
-
(
|
|
64501
|
+
(_a3 = tracing) == null ? void 0 : _a3.instant(tracing.Phase.CheckTypes, "typeRelatedToDiscriminatedType_DepthLimit", { sourceId: source2.id, targetId: target2.id, numCombinations });
|
|
64453
64502
|
return 0 /* False */;
|
|
64454
64503
|
}
|
|
64455
64504
|
}
|
|
@@ -64856,7 +64905,7 @@ function createTypeChecker(host) {
|
|
|
64856
64905
|
return result2;
|
|
64857
64906
|
}
|
|
64858
64907
|
function signaturesRelatedTo(source2, target2, kind, reportErrors2, intersectionState) {
|
|
64859
|
-
var
|
|
64908
|
+
var _a3, _b;
|
|
64860
64909
|
if (relation === identityRelation) {
|
|
64861
64910
|
return signaturesIdenticalTo(source2, target2, kind);
|
|
64862
64911
|
}
|
|
@@ -64912,7 +64961,7 @@ function createTypeChecker(host) {
|
|
|
64912
64961
|
const sourceSignature = first(sourceSignatures);
|
|
64913
64962
|
const targetSignature = first(targetSignatures);
|
|
64914
64963
|
result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, intersectionState, incompatibleReporter(sourceSignature, targetSignature));
|
|
64915
|
-
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 */)) {
|
|
64916
64965
|
const constructSignatureToString = (signature) => signatureToString(
|
|
64917
64966
|
signature,
|
|
64918
64967
|
/*enclosingDeclaration*/
|
|
@@ -65230,10 +65279,10 @@ function createTypeChecker(host) {
|
|
|
65230
65279
|
return getVariancesWorker(symbol, getSymbolLinks(symbol).typeParameters);
|
|
65231
65280
|
}
|
|
65232
65281
|
function getVariancesWorker(symbol, typeParameters = emptyArray) {
|
|
65233
|
-
var
|
|
65282
|
+
var _a2, _b;
|
|
65234
65283
|
const links = getSymbolLinks(symbol);
|
|
65235
65284
|
if (!links.variances) {
|
|
65236
|
-
(
|
|
65285
|
+
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.CheckTypes, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
|
|
65237
65286
|
const oldVarianceComputation = inVarianceComputation;
|
|
65238
65287
|
const saveResolutionStart = resolutionStart;
|
|
65239
65288
|
if (!inVarianceComputation) {
|
|
@@ -65291,8 +65340,8 @@ function createTypeChecker(host) {
|
|
|
65291
65340
|
return markerTypes.has(getTypeId(type));
|
|
65292
65341
|
}
|
|
65293
65342
|
function getTypeParameterModifiers(tp) {
|
|
65294
|
-
var
|
|
65295
|
-
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 */);
|
|
65296
65345
|
}
|
|
65297
65346
|
function hasCovariantVoidArgument(typeArguments, variances) {
|
|
65298
65347
|
for (let i = 0; i < variances.length; i++) {
|
|
@@ -65350,7 +65399,7 @@ function createTypeChecker(host) {
|
|
|
65350
65399
|
return isTypeReferenceWithGenericArguments(source) && isTypeReferenceWithGenericArguments(target) ? getGenericTypeReferenceRelationKey(source, target, postFix, ignoreConstraints) : `${source.id},${target.id}${postFix}`;
|
|
65351
65400
|
}
|
|
65352
65401
|
function forEachProperty(prop, callback) {
|
|
65353
|
-
if (getCheckFlags(prop) & 6 /*
|
|
65402
|
+
if (getCheckFlags(prop) & 6 /* SyntheticMember */) {
|
|
65354
65403
|
for (const t of prop.links.containingType.types) {
|
|
65355
65404
|
const p = getPropertyOfType(t, prop.escapedName);
|
|
65356
65405
|
const result = p && forEachProperty(p, callback);
|
|
@@ -65648,7 +65697,7 @@ function createTypeChecker(host) {
|
|
|
65648
65697
|
return propType;
|
|
65649
65698
|
}
|
|
65650
65699
|
if (everyType(type, isTupleType)) {
|
|
65651
|
-
return getTupleElementTypeOutOfStartCount(type, index,
|
|
65700
|
+
return getTupleElementTypeOutOfStartCount(type, index, noUncheckedIndexedAccess ? undefinedType : void 0);
|
|
65652
65701
|
}
|
|
65653
65702
|
return void 0;
|
|
65654
65703
|
}
|
|
@@ -66967,7 +67016,7 @@ function createTypeChecker(host) {
|
|
|
66967
67016
|
inferFromTypes(sourceNameType, targetNameType);
|
|
66968
67017
|
}
|
|
66969
67018
|
function inferFromObjectTypes(source, target) {
|
|
66970
|
-
var
|
|
67019
|
+
var _a2, _b;
|
|
66971
67020
|
if (getObjectFlags(source) & 4 /* Reference */ && getObjectFlags(target) & 4 /* Reference */ && (source.target === target.target || isArrayType(source) && isArrayType(target))) {
|
|
66972
67021
|
inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target));
|
|
66973
67022
|
return;
|
|
@@ -67014,7 +67063,7 @@ function createTypeChecker(host) {
|
|
|
67014
67063
|
inferFromTypes(sliceTupleType(source, startLength + targetInfo.impliedArity, endLength), elementTypes[startLength + 1]);
|
|
67015
67064
|
}
|
|
67016
67065
|
} else if (elementFlags[startLength] & 8 /* Variadic */ && elementFlags[startLength + 1] & 4 /* Rest */) {
|
|
67017
|
-
const param = (
|
|
67066
|
+
const param = (_a2 = getInferenceInfoForType(elementTypes[startLength])) == null ? void 0 : _a2.typeParameter;
|
|
67018
67067
|
const constraint = param && getBaseConstraintOfType(param);
|
|
67019
67068
|
if (constraint && isTupleType(constraint) && !constraint.target.hasRestElement) {
|
|
67020
67069
|
const impliedArity = constraint.target.fixedLength;
|
|
@@ -67501,8 +67550,8 @@ function createTypeChecker(host) {
|
|
|
67501
67550
|
return unionType.keyPropertyName.length ? unionType.keyPropertyName : void 0;
|
|
67502
67551
|
}
|
|
67503
67552
|
function getConstituentTypeForKeyType(unionType, keyType) {
|
|
67504
|
-
var
|
|
67505
|
-
const result = (
|
|
67553
|
+
var _a2;
|
|
67554
|
+
const result = (_a2 = unionType.constituentMap) == null ? void 0 : _a2.get(getTypeId(getRegularTypeOfLiteralType(keyType)));
|
|
67506
67555
|
return result !== unknownType ? result : void 0;
|
|
67507
67556
|
}
|
|
67508
67557
|
function getMatchingUnionConstituentForType(unionType, type) {
|
|
@@ -67686,12 +67735,12 @@ function createTypeChecker(host) {
|
|
|
67686
67735
|
return defaultExpression ? getUnionType([getNonUndefinedType(type), getTypeOfExpression(defaultExpression)]) : type;
|
|
67687
67736
|
}
|
|
67688
67737
|
function getTypeOfDestructuredProperty(type, name) {
|
|
67689
|
-
var
|
|
67738
|
+
var _a2;
|
|
67690
67739
|
const nameType = getLiteralTypeFromPropertyName(name);
|
|
67691
67740
|
if (!isTypeUsableAsPropertyName(nameType))
|
|
67692
67741
|
return errorType;
|
|
67693
67742
|
const text = getPropertyNameFromType(nameType);
|
|
67694
|
-
return getTypeOfPropertyOfType(type, text) || includeUndefinedInIndexSignature((
|
|
67743
|
+
return getTypeOfPropertyOfType(type, text) || includeUndefinedInIndexSignature((_a2 = getApplicableIndexInfoForName(type, text)) == null ? void 0 : _a2.type) || errorType;
|
|
67695
67744
|
}
|
|
67696
67745
|
function getTypeOfDestructuredArrayElement(type, index) {
|
|
67697
67746
|
return everyType(type, isTupleLikeType) && getTupleElementType(type, index) || includeUndefinedInIndexSignature(checkIteratedTypeOrElementType(
|
|
@@ -67705,7 +67754,7 @@ function createTypeChecker(host) {
|
|
|
67705
67754
|
function includeUndefinedInIndexSignature(type) {
|
|
67706
67755
|
if (!type)
|
|
67707
67756
|
return type;
|
|
67708
|
-
return
|
|
67757
|
+
return noUncheckedIndexedAccess ? getUnionType([type, missingType]) : type;
|
|
67709
67758
|
}
|
|
67710
67759
|
function getTypeOfDestructuredSpreadExpression(type) {
|
|
67711
67760
|
return createArrayType(checkIteratedTypeOrElementType(
|
|
@@ -68268,7 +68317,7 @@ function createTypeChecker(host) {
|
|
|
68268
68317
|
}
|
|
68269
68318
|
return false;
|
|
68270
68319
|
}
|
|
68271
|
-
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)()) {
|
|
68272
68321
|
let key;
|
|
68273
68322
|
let isKeySet = false;
|
|
68274
68323
|
let flowDepth = 0;
|
|
@@ -69003,7 +69052,7 @@ function createTypeChecker(host) {
|
|
|
69003
69052
|
if (!hasDefaultClause) {
|
|
69004
69053
|
return caseType;
|
|
69005
69054
|
}
|
|
69006
|
-
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)))));
|
|
69007
69056
|
return caseType.flags & 131072 /* Never */ ? defaultType : getUnionType([caseType, defaultType]);
|
|
69008
69057
|
}
|
|
69009
69058
|
function narrowTypeByTypeName(type, typeName) {
|
|
@@ -69530,7 +69579,7 @@ function createTypeChecker(host) {
|
|
|
69530
69579
|
}
|
|
69531
69580
|
}
|
|
69532
69581
|
function getNarrowedTypeOfSymbol(symbol, location, checkMode) {
|
|
69533
|
-
var
|
|
69582
|
+
var _a2;
|
|
69534
69583
|
const type = getTypeOfSymbol(symbol, checkMode);
|
|
69535
69584
|
const declaration = symbol.valueDeclaration;
|
|
69536
69585
|
if (declaration) {
|
|
@@ -69572,7 +69621,7 @@ function createTypeChecker(host) {
|
|
|
69572
69621
|
if (func.parameters.length >= 2 && isContextSensitiveFunctionOrObjectLiteralMethod(func)) {
|
|
69573
69622
|
const contextualSignature = getContextualSignature(func);
|
|
69574
69623
|
if (contextualSignature && contextualSignature.parameters.length === 1 && signatureHasRestParameter(contextualSignature)) {
|
|
69575
|
-
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));
|
|
69576
69625
|
if (restType.flags & 1048576 /* Union */ && everyType(restType, isTupleType) && !some(func.parameters, isSomeSymbolAssigned)) {
|
|
69577
69626
|
const narrowedType = getFlowTypeOfReference(
|
|
69578
69627
|
func,
|
|
@@ -69724,7 +69773,7 @@ function createTypeChecker(host) {
|
|
|
69724
69773
|
}
|
|
69725
69774
|
}
|
|
69726
69775
|
function shouldMarkIdentifierAliasReferenced(node) {
|
|
69727
|
-
var
|
|
69776
|
+
var _a2;
|
|
69728
69777
|
const parent = node.parent;
|
|
69729
69778
|
if (parent) {
|
|
69730
69779
|
if (isPropertyAccessExpression(parent) && parent.expression === node) {
|
|
@@ -69733,7 +69782,7 @@ function createTypeChecker(host) {
|
|
|
69733
69782
|
if (isExportSpecifier(parent) && parent.isTypeOnly) {
|
|
69734
69783
|
return false;
|
|
69735
69784
|
}
|
|
69736
|
-
const greatGrandparent = (
|
|
69785
|
+
const greatGrandparent = (_a2 = parent.parent) == null ? void 0 : _a2.parent;
|
|
69737
69786
|
if (greatGrandparent && isExportDeclaration(greatGrandparent) && greatGrandparent.isTypeOnly) {
|
|
69738
69787
|
return false;
|
|
69739
69788
|
}
|
|
@@ -70465,7 +70514,7 @@ function createTypeChecker(host) {
|
|
|
70465
70514
|
}
|
|
70466
70515
|
}
|
|
70467
70516
|
function getContextualTypeForAssignmentDeclaration(binaryExpression) {
|
|
70468
|
-
var
|
|
70517
|
+
var _a2, _b;
|
|
70469
70518
|
const kind = getAssignmentDeclarationKind(binaryExpression);
|
|
70470
70519
|
switch (kind) {
|
|
70471
70520
|
case 0 /* None */:
|
|
@@ -70524,7 +70573,7 @@ function createTypeChecker(host) {
|
|
|
70524
70573
|
case 2 /* ModuleExports */:
|
|
70525
70574
|
let valueDeclaration;
|
|
70526
70575
|
if (kind !== 2 /* ModuleExports */) {
|
|
70527
|
-
valueDeclaration = canHaveSymbol(binaryExpression.left) ? (
|
|
70576
|
+
valueDeclaration = canHaveSymbol(binaryExpression.left) ? (_a2 = binaryExpression.left.symbol) == null ? void 0 : _a2.valueDeclaration : void 0;
|
|
70528
70577
|
}
|
|
70529
70578
|
valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) == null ? void 0 : _b.valueDeclaration);
|
|
70530
70579
|
const annotated = valueDeclaration && getEffectiveTypeAnnotationNode(valueDeclaration);
|
|
@@ -70591,7 +70640,7 @@ function createTypeChecker(host) {
|
|
|
70591
70640
|
return mapType(
|
|
70592
70641
|
type,
|
|
70593
70642
|
(t) => {
|
|
70594
|
-
var
|
|
70643
|
+
var _a2;
|
|
70595
70644
|
if (isGenericMappedType(t) && !t.declaration.nameType) {
|
|
70596
70645
|
const constraint = getConstraintTypeFromMappedType(t);
|
|
70597
70646
|
const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
|
|
@@ -70619,7 +70668,7 @@ function createTypeChecker(host) {
|
|
|
70619
70668
|
return restType;
|
|
70620
70669
|
}
|
|
70621
70670
|
}
|
|
70622
|
-
return (
|
|
70671
|
+
return (_a2 = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(unescapeLeadingUnderscores(name)))) == null ? void 0 : _a2.type;
|
|
70623
70672
|
}
|
|
70624
70673
|
return void 0;
|
|
70625
70674
|
},
|
|
@@ -70661,8 +70710,8 @@ function createTypeChecker(host) {
|
|
|
70661
70710
|
return mapType(
|
|
70662
70711
|
type,
|
|
70663
70712
|
(t) => {
|
|
70664
|
-
var
|
|
70665
|
-
return (
|
|
70713
|
+
var _a2;
|
|
70714
|
+
return (_a2 = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType)) == null ? void 0 : _a2.type;
|
|
70666
70715
|
},
|
|
70667
70716
|
/*noReductions*/
|
|
70668
70717
|
true
|
|
@@ -70804,8 +70853,8 @@ function createTypeChecker(host) {
|
|
|
70804
70853
|
),
|
|
70805
70854
|
map(
|
|
70806
70855
|
filter(getPropertiesOfType(contextualType), (s) => {
|
|
70807
|
-
var
|
|
70808
|
-
return !!(s.flags & 16777216 /* Optional */) && !!((
|
|
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);
|
|
70809
70858
|
}),
|
|
70810
70859
|
(s) => [() => undefinedType, s.escapedName]
|
|
70811
70860
|
)
|
|
@@ -70831,8 +70880,8 @@ function createTypeChecker(host) {
|
|
|
70831
70880
|
),
|
|
70832
70881
|
map(
|
|
70833
70882
|
filter(getPropertiesOfType(contextualType), (s) => {
|
|
70834
|
-
var
|
|
70835
|
-
if (!(s.flags & 16777216 /* Optional */) || !((
|
|
70883
|
+
var _a2;
|
|
70884
|
+
if (!(s.flags & 16777216 /* Optional */) || !((_a2 = node == null ? void 0 : node.symbol) == null ? void 0 : _a2.members)) {
|
|
70836
70885
|
return false;
|
|
70837
70886
|
}
|
|
70838
70887
|
const element = node.parent.parent;
|
|
@@ -70891,7 +70940,7 @@ function createTypeChecker(host) {
|
|
|
70891
70940
|
return type;
|
|
70892
70941
|
}
|
|
70893
70942
|
function getContextualType(node, contextFlags) {
|
|
70894
|
-
var
|
|
70943
|
+
var _a2;
|
|
70895
70944
|
if (node.flags & 67108864 /* InWithStatement */) {
|
|
70896
70945
|
return void 0;
|
|
70897
70946
|
}
|
|
@@ -70937,7 +70986,7 @@ function createTypeChecker(host) {
|
|
|
70937
70986
|
const arrayLiteral = parent;
|
|
70938
70987
|
const type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
|
|
70939
70988
|
const elementIndex = indexOfNode(arrayLiteral.elements, node);
|
|
70940
|
-
const spreadIndices = (
|
|
70989
|
+
const spreadIndices = (_a2 = getNodeLinks(arrayLiteral)).spreadIndices ?? (_a2.spreadIndices = getSpreadIndices(arrayLiteral.elements));
|
|
70941
70990
|
return getContextualTypeForElementExpression(type, elementIndex, arrayLiteral.elements.length, spreadIndices.first, spreadIndices.last);
|
|
70942
70991
|
}
|
|
70943
70992
|
case 227 /* ConditionalExpression */:
|
|
@@ -71469,13 +71518,13 @@ function createTypeChecker(host) {
|
|
|
71469
71518
|
return links.resolvedType;
|
|
71470
71519
|
}
|
|
71471
71520
|
function isSymbolWithNumericName(symbol) {
|
|
71472
|
-
var
|
|
71473
|
-
const firstDecl = (
|
|
71521
|
+
var _a2;
|
|
71522
|
+
const firstDecl = (_a2 = symbol.declarations) == null ? void 0 : _a2[0];
|
|
71474
71523
|
return isNumericLiteralName(symbol.escapedName) || firstDecl && isNamedDeclaration(firstDecl) && isNumericName(firstDecl.name);
|
|
71475
71524
|
}
|
|
71476
71525
|
function isSymbolWithSymbolName(symbol) {
|
|
71477
|
-
var
|
|
71478
|
-
const firstDecl = (
|
|
71526
|
+
var _a2;
|
|
71527
|
+
const firstDecl = (_a2 = symbol.declarations) == null ? void 0 : _a2[0];
|
|
71479
71528
|
return isKnownSymbol(symbol) || firstDecl && isNamedDeclaration(firstDecl) && isComputedPropertyName(firstDecl.name) && isTypeAssignableToKind(checkComputedPropertyName(firstDecl.name), 4096 /* ESSymbol */);
|
|
71480
71529
|
}
|
|
71481
71530
|
function getObjectLiteralIndexInfo(node, offset, properties, keyType) {
|
|
@@ -71505,7 +71554,7 @@ function createTypeChecker(host) {
|
|
|
71505
71554
|
return links.immediateTarget;
|
|
71506
71555
|
}
|
|
71507
71556
|
function checkObjectLiteral(node, checkMode = 0 /* Normal */) {
|
|
71508
|
-
var
|
|
71557
|
+
var _a2;
|
|
71509
71558
|
const inDestructuringPattern = isAssignmentTarget(node);
|
|
71510
71559
|
checkGrammarObjectLiteralExpression(node, inDestructuringPattern);
|
|
71511
71560
|
const allPropertiesTable = strictNullChecks ? createSymbolTable() : void 0;
|
|
@@ -71646,7 +71695,7 @@ function createTypeChecker(host) {
|
|
|
71646
71695
|
for (const prop of getPropertiesOfType(contextualType)) {
|
|
71647
71696
|
if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) {
|
|
71648
71697
|
if (!(prop.flags & 16777216 /* Optional */)) {
|
|
71649
|
-
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);
|
|
71650
71699
|
}
|
|
71651
71700
|
propertiesTable.set(prop.escapedName, prop);
|
|
71652
71701
|
propertiesArray.push(prop);
|
|
@@ -72110,7 +72159,7 @@ function createTypeChecker(host) {
|
|
|
72110
72159
|
}
|
|
72111
72160
|
}
|
|
72112
72161
|
function getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node) {
|
|
72113
|
-
var
|
|
72162
|
+
var _a2;
|
|
72114
72163
|
Debug.assert(isJsxIntrinsicTagName(node.tagName));
|
|
72115
72164
|
const links = getNodeLinks(node);
|
|
72116
72165
|
if (!links.resolvedJsxElementAttributesType) {
|
|
@@ -72119,7 +72168,7 @@ function createTypeChecker(host) {
|
|
|
72119
72168
|
return links.resolvedJsxElementAttributesType = getTypeOfSymbol(symbol) || errorType;
|
|
72120
72169
|
} else if (links.jsxFlags & 2 /* IntrinsicIndexedElement */) {
|
|
72121
72170
|
const propName = isJsxNamespacedName(node.tagName) ? getEscapedTextOfJsxNamespacedName(node.tagName) : node.tagName.escapedText;
|
|
72122
|
-
return links.resolvedJsxElementAttributesType = ((
|
|
72171
|
+
return links.resolvedJsxElementAttributesType = ((_a2 = getApplicableIndexInfoForName(getJsxType(JsxNames.IntrinsicElements, node), propName)) == null ? void 0 : _a2.type) || errorType;
|
|
72123
72172
|
} else {
|
|
72124
72173
|
return links.resolvedJsxElementAttributesType = errorType;
|
|
72125
72174
|
}
|
|
@@ -72296,7 +72345,7 @@ function createTypeChecker(host) {
|
|
|
72296
72345
|
return checkPropertyAccessibilityAtLocation(node, isSuper, writing, type, prop, errorNode);
|
|
72297
72346
|
}
|
|
72298
72347
|
function checkPropertyAccessibilityAtLocation(location, isSuper, writing, containingType, prop, errorNode) {
|
|
72299
|
-
var
|
|
72348
|
+
var _a2;
|
|
72300
72349
|
const flags = getDeclarationModifierFlagsFromSymbol(prop, writing);
|
|
72301
72350
|
if (isSuper) {
|
|
72302
72351
|
if (languageVersion < 2 /* ES2015 */) {
|
|
@@ -72313,7 +72362,7 @@ function createTypeChecker(host) {
|
|
|
72313
72362
|
}
|
|
72314
72363
|
return false;
|
|
72315
72364
|
}
|
|
72316
|
-
if (!(flags & 256 /* Static */) && ((
|
|
72365
|
+
if (!(flags & 256 /* Static */) && ((_a2 = prop.declarations) == null ? void 0 : _a2.some(isClassInstanceProperty))) {
|
|
72317
72366
|
if (errorNode) {
|
|
72318
72367
|
error(errorNode, Diagnostics.Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super, symbolToString(prop));
|
|
72319
72368
|
}
|
|
@@ -72700,7 +72749,7 @@ function createTypeChecker(host) {
|
|
|
72700
72749
|
error(node, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(apparentType));
|
|
72701
72750
|
}
|
|
72702
72751
|
propType = indexInfo.type;
|
|
72703
|
-
if (
|
|
72752
|
+
if (noUncheckedIndexedAccess && getAssignmentTargetKind(node) !== 1 /* Definite */) {
|
|
72704
72753
|
propType = getUnionType([propType, missingType]);
|
|
72705
72754
|
}
|
|
72706
72755
|
if (compilerOptions.noPropertyAccessFromIndexSignature && isPropertyAccessExpression(node)) {
|
|
@@ -72727,12 +72776,12 @@ function createTypeChecker(host) {
|
|
|
72727
72776
|
return getFlowTypeOfAccessExpression(node, prop, propType, right, checkMode);
|
|
72728
72777
|
}
|
|
72729
72778
|
function isUncheckedJSSuggestion(node, suggestion, excludeClasses) {
|
|
72730
|
-
var
|
|
72779
|
+
var _a2;
|
|
72731
72780
|
const file = getSourceFileOfNode(node);
|
|
72732
72781
|
if (file) {
|
|
72733
72782
|
if (compilerOptions.checkJs === void 0 && file.checkJsDirective === void 0 && (file.scriptKind === 1 /* JS */ || file.scriptKind === 2 /* JSX */)) {
|
|
72734
72783
|
const declarationFile = forEach(suggestion == null ? void 0 : suggestion.declarations, getSourceFileOfNode);
|
|
72735
|
-
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(
|
|
72736
72785
|
/*useLegacyDecorators*/
|
|
72737
72786
|
false,
|
|
72738
72787
|
suggestion.valueDeclaration
|
|
@@ -73530,7 +73579,7 @@ function createTypeChecker(host) {
|
|
|
73530
73579
|
errorOutputContainer
|
|
73531
73580
|
);
|
|
73532
73581
|
function checkTagNameDoesNotExpectTooManyArguments() {
|
|
73533
|
-
var
|
|
73582
|
+
var _a2;
|
|
73534
73583
|
if (getJsxNamespaceContainerForImplicitImport(node)) {
|
|
73535
73584
|
return true;
|
|
73536
73585
|
}
|
|
@@ -73596,7 +73645,7 @@ function createTypeChecker(host) {
|
|
|
73596
73645
|
}
|
|
73597
73646
|
if (reportErrors2) {
|
|
73598
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);
|
|
73599
|
-
const tagNameDeclaration = (
|
|
73648
|
+
const tagNameDeclaration = (_a2 = getSymbolAtLocation(node.tagName)) == null ? void 0 : _a2.valueDeclaration;
|
|
73600
73649
|
if (tagNameDeclaration) {
|
|
73601
73650
|
addRelatedInfo(diag2, createDiagnosticForNode(tagNameDeclaration, Diagnostics._0_is_declared_here, entityNameToString(node.tagName)));
|
|
73602
73651
|
}
|
|
@@ -73745,9 +73794,9 @@ function createTypeChecker(host) {
|
|
|
73745
73794
|
const spreadType = arg.kind === 230 /* SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
|
|
73746
73795
|
if (spreadType && isTupleType(spreadType)) {
|
|
73747
73796
|
forEach(getElementTypes(spreadType), (t, i2) => {
|
|
73748
|
-
var
|
|
73797
|
+
var _a2;
|
|
73749
73798
|
const flags = spreadType.target.elementFlags[i2];
|
|
73750
|
-
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]);
|
|
73751
73800
|
effectiveArgs.push(syntheticArg);
|
|
73752
73801
|
});
|
|
73753
73802
|
} else {
|
|
@@ -73855,7 +73904,7 @@ function createTypeChecker(host) {
|
|
|
73855
73904
|
return constructorSymbol === globalPromiseSymbol;
|
|
73856
73905
|
}
|
|
73857
73906
|
function getArgumentArityError(node, signatures, args, headMessage) {
|
|
73858
|
-
var
|
|
73907
|
+
var _a2;
|
|
73859
73908
|
const spreadIndex = getSpreadArgumentIndex(args);
|
|
73860
73909
|
if (spreadIndex > -1) {
|
|
73861
73910
|
return createDiagnosticForNode(args[spreadIndex], Diagnostics.A_spread_argument_must_either_have_a_tuple_type_or_be_passed_to_a_rest_parameter);
|
|
@@ -73914,7 +73963,7 @@ function createTypeChecker(host) {
|
|
|
73914
73963
|
} else {
|
|
73915
73964
|
diagnostic = getDiagnosticForCallNode(node, error2, parameterRange, args.length);
|
|
73916
73965
|
}
|
|
73917
|
-
const parameter = (
|
|
73966
|
+
const parameter = (_a2 = closestSignature == null ? void 0 : closestSignature.declaration) == null ? void 0 : _a2.parameters[closestSignature.thisParameter ? args.length + 1 : args.length];
|
|
73918
73967
|
if (parameter) {
|
|
73919
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))];
|
|
73920
73969
|
const parameterError = createDiagnosticForNode(parameter, ...messageAndArgs);
|
|
@@ -74154,11 +74203,11 @@ function createTypeChecker(host) {
|
|
|
74154
74203
|
}
|
|
74155
74204
|
return result;
|
|
74156
74205
|
function addImplementationSuccessElaboration(failed, diagnostic) {
|
|
74157
|
-
var
|
|
74206
|
+
var _a2, _b;
|
|
74158
74207
|
const oldCandidatesForArgumentError = candidatesForArgumentError;
|
|
74159
74208
|
const oldCandidateForArgumentArityError = candidateForArgumentArityError;
|
|
74160
74209
|
const oldCandidateForTypeArgumentError = candidateForTypeArgumentError;
|
|
74161
|
-
const failedSignatureDeclarations = ((_b = (
|
|
74210
|
+
const failedSignatureDeclarations = ((_b = (_a2 = failed.declaration) == null ? void 0 : _a2.symbol) == null ? void 0 : _b.declarations) || emptyArray;
|
|
74162
74211
|
const isOverload = failedSignatureDeclarations.length > 1;
|
|
74163
74212
|
const implDecl = isOverload ? find(failedSignatureDeclarations, (d) => isFunctionLikeDeclaration(d) && nodeIsPresent(d.body)) : void 0;
|
|
74164
74213
|
if (implDecl) {
|
|
@@ -74173,7 +74222,7 @@ function createTypeChecker(host) {
|
|
|
74173
74222
|
candidateForTypeArgumentError = oldCandidateForTypeArgumentError;
|
|
74174
74223
|
}
|
|
74175
74224
|
function chooseOverload(candidates2, relation, isSingleNonGenericCandidate2, signatureHelpTrailingComma2 = false) {
|
|
74176
|
-
var
|
|
74225
|
+
var _a2, _b;
|
|
74177
74226
|
candidatesForArgumentError = void 0;
|
|
74178
74227
|
candidateForArgumentArityError = void 0;
|
|
74179
74228
|
candidateForTypeArgumentError = void 0;
|
|
@@ -74208,7 +74257,7 @@ function createTypeChecker(host) {
|
|
|
74208
74257
|
let checkCandidate;
|
|
74209
74258
|
let inferenceContext;
|
|
74210
74259
|
if (candidate.typeParameters) {
|
|
74211
|
-
const paramLocation = (_b = (
|
|
74260
|
+
const paramLocation = (_b = (_a2 = candidate.typeParameters[0].symbol.declarations) == null ? void 0 : _a2[0]) == null ? void 0 : _b.parent;
|
|
74212
74261
|
const candidateParameterContext = paramLocation || (candidate.declaration && isConstructorDeclaration(candidate.declaration) ? candidate.declaration.parent : candidate.declaration);
|
|
74213
74262
|
if (candidateParameterContext && findAncestor(node, (a) => a === candidateParameterContext)) {
|
|
74214
74263
|
candidate = getImplementationSignature(candidate);
|
|
@@ -74897,7 +74946,7 @@ function createTypeChecker(host) {
|
|
|
74897
74946
|
return result;
|
|
74898
74947
|
}
|
|
74899
74948
|
function isJSConstructor(node) {
|
|
74900
|
-
var
|
|
74949
|
+
var _a2;
|
|
74901
74950
|
if (!node || !isInJSFile(node)) {
|
|
74902
74951
|
return false;
|
|
74903
74952
|
}
|
|
@@ -74908,12 +74957,12 @@ function createTypeChecker(host) {
|
|
|
74908
74957
|
if (isPropertyAssignment(walkUpParenthesizedExpressions(func.parent)))
|
|
74909
74958
|
return false;
|
|
74910
74959
|
const symbol = getSymbolOfDeclaration(func);
|
|
74911
|
-
return !!((
|
|
74960
|
+
return !!((_a2 = symbol == null ? void 0 : symbol.members) == null ? void 0 : _a2.size);
|
|
74912
74961
|
}
|
|
74913
74962
|
return false;
|
|
74914
74963
|
}
|
|
74915
74964
|
function mergeJSSymbols(target, source) {
|
|
74916
|
-
var
|
|
74965
|
+
var _a2, _b;
|
|
74917
74966
|
if (source) {
|
|
74918
74967
|
const links = getSymbolLinks(source);
|
|
74919
74968
|
if (!links.inferredClassSymbol || !links.inferredClassSymbol.has(getSymbolId(target))) {
|
|
@@ -74921,7 +74970,7 @@ function createTypeChecker(host) {
|
|
|
74921
74970
|
inferred.exports = inferred.exports || createSymbolTable();
|
|
74922
74971
|
inferred.members = inferred.members || createSymbolTable();
|
|
74923
74972
|
inferred.flags |= source.flags & 32 /* Class */;
|
|
74924
|
-
if ((
|
|
74973
|
+
if ((_a2 = source.exports) == null ? void 0 : _a2.size) {
|
|
74925
74974
|
mergeSymbolTable(inferred.exports, source.exports);
|
|
74926
74975
|
}
|
|
74927
74976
|
if ((_b = source.members) == null ? void 0 : _b.size) {
|
|
@@ -74934,13 +74983,13 @@ function createTypeChecker(host) {
|
|
|
74934
74983
|
}
|
|
74935
74984
|
}
|
|
74936
74985
|
function getAssignedClassSymbol(decl) {
|
|
74937
|
-
var
|
|
74986
|
+
var _a2;
|
|
74938
74987
|
const assignmentSymbol = decl && getSymbolOfExpando(
|
|
74939
74988
|
decl,
|
|
74940
74989
|
/*allowDeclaration*/
|
|
74941
74990
|
true
|
|
74942
74991
|
);
|
|
74943
|
-
const prototype = (
|
|
74992
|
+
const prototype = (_a2 = assignmentSymbol == null ? void 0 : assignmentSymbol.exports) == null ? void 0 : _a2.get("prototype");
|
|
74944
74993
|
const init = (prototype == null ? void 0 : prototype.valueDeclaration) && getAssignedJSPrototype(prototype.valueDeclaration);
|
|
74945
74994
|
return init ? getSymbolOfDeclaration(init) : void 0;
|
|
74946
74995
|
}
|
|
@@ -74997,7 +75046,7 @@ function createTypeChecker(host) {
|
|
|
74997
75046
|
}
|
|
74998
75047
|
}
|
|
74999
75048
|
function checkCallExpression(node, checkMode) {
|
|
75000
|
-
var
|
|
75049
|
+
var _a2, _b, _c;
|
|
75001
75050
|
checkGrammarTypeArguments(node, node.typeArguments);
|
|
75002
75051
|
const signature = getResolvedSignature(
|
|
75003
75052
|
node,
|
|
@@ -75014,7 +75063,7 @@ function createTypeChecker(host) {
|
|
|
75014
75063
|
}
|
|
75015
75064
|
if (node.kind === 214 /* NewExpression */) {
|
|
75016
75065
|
const declaration = signature.declaration;
|
|
75017
|
-
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)) {
|
|
75018
75067
|
if (noImplicitAny) {
|
|
75019
75068
|
error(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);
|
|
75020
75069
|
}
|
|
@@ -75173,11 +75222,11 @@ function createTypeChecker(host) {
|
|
|
75173
75222
|
return void 0;
|
|
75174
75223
|
}
|
|
75175
75224
|
function getTypeWithSyntheticDefaultImportType(type, symbol, originalSymbol, moduleSpecifier) {
|
|
75176
|
-
var
|
|
75225
|
+
var _a2;
|
|
75177
75226
|
if (allowSyntheticDefaultImports && type && !isErrorType(type)) {
|
|
75178
75227
|
const synthType = type;
|
|
75179
75228
|
if (!synthType.syntheticType) {
|
|
75180
|
-
const file = (
|
|
75229
|
+
const file = (_a2 = originalSymbol.declarations) == null ? void 0 : _a2.find(isSourceFile);
|
|
75181
75230
|
const hasSyntheticDefault = canHaveSyntheticDefault(
|
|
75182
75231
|
file,
|
|
75183
75232
|
originalSymbol,
|
|
@@ -75511,8 +75560,8 @@ function createTypeChecker(host) {
|
|
|
75511
75560
|
return restParameter.escapedName;
|
|
75512
75561
|
}
|
|
75513
75562
|
function getParameterIdentifierInfoAtPosition(signature, pos) {
|
|
75514
|
-
var
|
|
75515
|
-
if (((
|
|
75563
|
+
var _a2;
|
|
75564
|
+
if (((_a2 = signature.declaration) == null ? void 0 : _a2.kind) === 317 /* JSDocFunctionType */) {
|
|
75516
75565
|
return void 0;
|
|
75517
75566
|
}
|
|
75518
75567
|
const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
|
|
@@ -76622,7 +76671,7 @@ function createTypeChecker(host) {
|
|
|
76622
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));
|
|
76623
76672
|
}
|
|
76624
76673
|
function isAssignmentToReadonlyEntity(expr, symbol, assignmentKind) {
|
|
76625
|
-
var
|
|
76674
|
+
var _a2, _b;
|
|
76626
76675
|
if (assignmentKind === 0 /* None */) {
|
|
76627
76676
|
return false;
|
|
76628
76677
|
}
|
|
@@ -76636,7 +76685,7 @@ function createTypeChecker(host) {
|
|
|
76636
76685
|
const isAssignmentDeclaration2 = isBinaryExpression(symbol.valueDeclaration);
|
|
76637
76686
|
const isLocalPropertyDeclaration = ctor.parent === symbol.valueDeclaration.parent;
|
|
76638
76687
|
const isLocalParameterProperty = ctor === symbol.valueDeclaration.parent;
|
|
76639
|
-
const isLocalThisPropertyAssignment = isAssignmentDeclaration2 && ((
|
|
76688
|
+
const isLocalThisPropertyAssignment = isAssignmentDeclaration2 && ((_a2 = symbol.parent) == null ? void 0 : _a2.valueDeclaration) === ctor.parent;
|
|
76640
76689
|
const isLocalThisPropertyAssignmentConstructorFunction = isAssignmentDeclaration2 && ((_b = symbol.parent) == null ? void 0 : _b.valueDeclaration) === ctor;
|
|
76641
76690
|
const isWriteableSymbol = isLocalPropertyDeclaration || isLocalParameterProperty || isLocalThisPropertyAssignment || isLocalThisPropertyAssignmentConstructorFunction;
|
|
76642
76691
|
return !isWriteableSymbol;
|
|
@@ -77034,7 +77083,7 @@ function createTypeChecker(host) {
|
|
|
77034
77083
|
checkExternalEmitHelpers(node, 512 /* Read */);
|
|
77035
77084
|
}
|
|
77036
77085
|
const possiblyOutOfBoundsType = checkIteratedTypeOrElementType(65 /* Destructuring */ | 128 /* PossiblyOutOfBounds */, sourceType, undefinedType, node) || errorType;
|
|
77037
|
-
let inBoundsType =
|
|
77086
|
+
let inBoundsType = noUncheckedIndexedAccess ? void 0 : possiblyOutOfBoundsType;
|
|
77038
77087
|
for (let i = 0; i < elements.length; i++) {
|
|
77039
77088
|
let type = possiblyOutOfBoundsType;
|
|
77040
77089
|
if (node.elements[i].kind === 230 /* SpreadElement */) {
|
|
@@ -77623,7 +77672,7 @@ function createTypeChecker(host) {
|
|
|
77623
77672
|
}
|
|
77624
77673
|
}
|
|
77625
77674
|
function isAssignmentDeclaration2(kind) {
|
|
77626
|
-
var
|
|
77675
|
+
var _a2;
|
|
77627
77676
|
switch (kind) {
|
|
77628
77677
|
case 2 /* ModuleExports */:
|
|
77629
77678
|
return true;
|
|
@@ -77634,7 +77683,7 @@ function createTypeChecker(host) {
|
|
|
77634
77683
|
case 4 /* ThisProperty */:
|
|
77635
77684
|
const symbol = getSymbolOfNode(left);
|
|
77636
77685
|
const init = getAssignedExpandoInitializer(right);
|
|
77637
|
-
return !!init && isObjectLiteralExpression(init) && !!((
|
|
77686
|
+
return !!init && isObjectLiteralExpression(init) && !!((_a2 = symbol == null ? void 0 : symbol.exports) == null ? void 0 : _a2.size);
|
|
77638
77687
|
default:
|
|
77639
77688
|
return false;
|
|
77640
77689
|
}
|
|
@@ -78184,8 +78233,8 @@ function createTypeChecker(host) {
|
|
|
78184
78233
|
return type;
|
|
78185
78234
|
}
|
|
78186
78235
|
function checkExpression(node, checkMode, forceTuple) {
|
|
78187
|
-
var
|
|
78188
|
-
(
|
|
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 });
|
|
78189
78238
|
const saveCurrentNode = currentNode;
|
|
78190
78239
|
currentNode = node;
|
|
78191
78240
|
instantiationCount = 0;
|
|
@@ -78360,7 +78409,7 @@ function createTypeChecker(host) {
|
|
|
78360
78409
|
addLazyDiagnostic(() => checkTypeNameIsReserved(node.name, Diagnostics.Type_parameter_name_cannot_be_0));
|
|
78361
78410
|
}
|
|
78362
78411
|
function checkTypeParameterDeferred(node) {
|
|
78363
|
-
var
|
|
78412
|
+
var _a2, _b;
|
|
78364
78413
|
if (isInterfaceDeclaration(node.parent) || isClassLike(node.parent) || isTypeAliasDeclaration(node.parent)) {
|
|
78365
78414
|
const typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node));
|
|
78366
78415
|
const modifiers = getTypeParameterModifiers(typeParameter) & (8192 /* In */ | 16384 /* Out */);
|
|
@@ -78369,7 +78418,7 @@ function createTypeChecker(host) {
|
|
|
78369
78418
|
if (isTypeAliasDeclaration(node.parent) && !(getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (4 /* Reference */ | 16 /* Anonymous */ | 32 /* Mapped */))) {
|
|
78370
78419
|
error(node, Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
78371
78420
|
} else if (modifiers === 8192 /* In */ || modifiers === 16384 /* Out */) {
|
|
78372
|
-
(
|
|
78421
|
+
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.CheckTypes, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
|
|
78373
78422
|
const source = createMarkerType(symbol, typeParameter, modifiers === 16384 /* Out */ ? markerSubTypeForCheck : markerSuperTypeForCheck);
|
|
78374
78423
|
const target = createMarkerType(symbol, typeParameter, modifiers === 16384 /* Out */ ? markerSuperTypeForCheck : markerSubTypeForCheck);
|
|
78375
78424
|
const saveVarianceTypeParameter = typeParameter;
|
|
@@ -79079,8 +79128,8 @@ function createTypeChecker(host) {
|
|
|
79079
79128
|
}
|
|
79080
79129
|
}
|
|
79081
79130
|
function checkGrammarMappedType(node) {
|
|
79082
|
-
var
|
|
79083
|
-
if ((
|
|
79131
|
+
var _a2;
|
|
79132
|
+
if ((_a2 = node.members) == null ? void 0 : _a2.length) {
|
|
79084
79133
|
return grammarErrorOnNode(node.members[0], Diagnostics.A_mapped_type_may_not_declare_properties_or_methods);
|
|
79085
79134
|
}
|
|
79086
79135
|
}
|
|
@@ -79514,13 +79563,13 @@ function createTypeChecker(host) {
|
|
|
79514
79563
|
return !!thenFunction && getSignaturesOfType(getTypeWithFacts(thenFunction, 2097152 /* NEUndefinedOrNull */), 0 /* Call */).length > 0;
|
|
79515
79564
|
}
|
|
79516
79565
|
function isAwaitedTypeInstantiation(type) {
|
|
79517
|
-
var
|
|
79566
|
+
var _a2;
|
|
79518
79567
|
if (type.flags & 16777216 /* Conditional */) {
|
|
79519
79568
|
const awaitedSymbol = getGlobalAwaitedSymbol(
|
|
79520
79569
|
/*reportErrors*/
|
|
79521
79570
|
false
|
|
79522
79571
|
);
|
|
79523
|
-
return !!awaitedSymbol && type.aliasSymbol === awaitedSymbol && ((
|
|
79572
|
+
return !!awaitedSymbol && type.aliasSymbol === awaitedSymbol && ((_a2 = type.aliasTypeArguments) == null ? void 0 : _a2.length) === 1;
|
|
79524
79573
|
}
|
|
79525
79574
|
return false;
|
|
79526
79575
|
}
|
|
@@ -80106,7 +80155,7 @@ function createTypeChecker(host) {
|
|
|
80106
80155
|
}
|
|
80107
80156
|
}
|
|
80108
80157
|
function checkFunctionOrMethodDeclaration(node) {
|
|
80109
|
-
var
|
|
80158
|
+
var _a2;
|
|
80110
80159
|
checkDecorators(node);
|
|
80111
80160
|
checkSignatureDeclaration(node);
|
|
80112
80161
|
const functionFlags = getFunctionFlags(node);
|
|
@@ -80116,7 +80165,7 @@ function createTypeChecker(host) {
|
|
|
80116
80165
|
if (hasBindableName(node)) {
|
|
80117
80166
|
const symbol = getSymbolOfDeclaration(node);
|
|
80118
80167
|
const localSymbol = node.localSymbol || symbol;
|
|
80119
|
-
const firstDeclaration = (
|
|
80168
|
+
const firstDeclaration = (_a2 = localSymbol.declarations) == null ? void 0 : _a2.find(
|
|
80120
80169
|
// Get first non javascript function declaration
|
|
80121
80170
|
(declaration) => declaration.kind === node.kind && !(declaration.flags & 524288 /* JavaScriptFile */)
|
|
80122
80171
|
);
|
|
@@ -80390,9 +80439,9 @@ function createTypeChecker(host) {
|
|
|
80390
80439
|
});
|
|
80391
80440
|
}
|
|
80392
80441
|
function checkPotentialUncheckedRenamedBindingElementsInTypes() {
|
|
80393
|
-
var
|
|
80442
|
+
var _a2;
|
|
80394
80443
|
for (const node of potentialUnusedRenamedBindingElementsInTypes) {
|
|
80395
|
-
if (!((
|
|
80444
|
+
if (!((_a2 = getSymbolOfDeclaration(node)) == null ? void 0 : _a2.isReferenced)) {
|
|
80396
80445
|
const wrappingDeclaration = walkUpBindingElementsAndPatterns(node);
|
|
80397
80446
|
Debug.assert(isPartOfParameterDeclaration(wrappingDeclaration), "Only parameter declaration should be checked here");
|
|
80398
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));
|
|
@@ -80615,7 +80664,7 @@ function createTypeChecker(host) {
|
|
|
80615
80664
|
return type === autoType ? anyType : type === autoArrayType ? anyArrayType : type;
|
|
80616
80665
|
}
|
|
80617
80666
|
function checkVariableLikeDeclaration(node) {
|
|
80618
|
-
var
|
|
80667
|
+
var _a2;
|
|
80619
80668
|
checkDecorators(node);
|
|
80620
80669
|
if (!isBindingElement(node)) {
|
|
80621
80670
|
checkSourceElement(node.type);
|
|
@@ -80714,7 +80763,7 @@ function createTypeChecker(host) {
|
|
|
80714
80763
|
if (node === symbol.valueDeclaration) {
|
|
80715
80764
|
const initializer = hasOnlyExpressionInitializer(node) && getEffectiveInitializer(node);
|
|
80716
80765
|
if (initializer) {
|
|
80717
|
-
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);
|
|
80718
80767
|
if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 249 /* ForInStatement */) {
|
|
80719
80768
|
const initializerType = checkExpressionCached(initializer);
|
|
80720
80769
|
checkTypeAssignableToAndOptionallyElaborate(
|
|
@@ -80809,8 +80858,8 @@ function createTypeChecker(host) {
|
|
|
80809
80858
|
return getSelectedEffectiveModifierFlags(left, interestingFlags) === getSelectedEffectiveModifierFlags(right, interestingFlags);
|
|
80810
80859
|
}
|
|
80811
80860
|
function checkVariableDeclaration(node) {
|
|
80812
|
-
var
|
|
80813
|
-
(
|
|
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 });
|
|
80814
80863
|
checkGrammarVariableDeclaration(node);
|
|
80815
80864
|
checkVariableLikeDeclaration(node);
|
|
80816
80865
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
@@ -81088,7 +81137,7 @@ function createTypeChecker(host) {
|
|
|
81088
81137
|
}
|
|
81089
81138
|
const uplevelIteration = languageVersion >= 2 /* ES2015 */;
|
|
81090
81139
|
const downlevelIteration = !uplevelIteration && compilerOptions.downlevelIteration;
|
|
81091
|
-
const possibleOutOfBounds =
|
|
81140
|
+
const possibleOutOfBounds = noUncheckedIndexedAccess && !!(use & 128 /* PossiblyOutOfBounds */);
|
|
81092
81141
|
if (uplevelIteration || downlevelIteration || allowAsyncIterables) {
|
|
81093
81142
|
const iterationTypes = getIterationTypesOfIterable(inputType, use, uplevelIteration ? errorNode : void 0);
|
|
81094
81143
|
if (checkAssignability) {
|
|
@@ -81137,14 +81186,14 @@ function createTypeChecker(host) {
|
|
|
81137
81186
|
}
|
|
81138
81187
|
const arrayElementType = getIndexTypeOfType(arrayType, numberType);
|
|
81139
81188
|
if (hasStringConstituent && arrayElementType) {
|
|
81140
|
-
if (arrayElementType.flags & 402653316 /* StringLike */ && !
|
|
81189
|
+
if (arrayElementType.flags & 402653316 /* StringLike */ && !noUncheckedIndexedAccess) {
|
|
81141
81190
|
return stringType;
|
|
81142
81191
|
}
|
|
81143
81192
|
return getUnionType(possibleOutOfBounds ? [arrayElementType, stringType, undefinedType] : [arrayElementType, stringType], 2 /* Subtype */);
|
|
81144
81193
|
}
|
|
81145
81194
|
return use & 128 /* PossiblyOutOfBounds */ ? includeUndefinedInIndexSignature(arrayElementType) : arrayElementType;
|
|
81146
81195
|
function getIterationDiagnosticDetails(allowsStrings, downlevelIteration2) {
|
|
81147
|
-
var
|
|
81196
|
+
var _a2;
|
|
81148
81197
|
if (downlevelIteration2) {
|
|
81149
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];
|
|
81150
81199
|
}
|
|
@@ -81158,7 +81207,7 @@ function createTypeChecker(host) {
|
|
|
81158
81207
|
if (yieldType) {
|
|
81159
81208
|
return [Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher, false];
|
|
81160
81209
|
}
|
|
81161
|
-
if (isES2015OrLaterIterable((
|
|
81210
|
+
if (isES2015OrLaterIterable((_a2 = inputType.symbol) == null ? void 0 : _a2.escapedName)) {
|
|
81162
81211
|
return [Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher, true];
|
|
81163
81212
|
}
|
|
81164
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];
|
|
@@ -81230,7 +81279,7 @@ function createTypeChecker(host) {
|
|
|
81230
81279
|
return type[cacheKey] = cachedTypes2;
|
|
81231
81280
|
}
|
|
81232
81281
|
function getIterationTypesOfIterable(type, use, errorNode) {
|
|
81233
|
-
var
|
|
81282
|
+
var _a2, _b;
|
|
81234
81283
|
if (isTypeAny(type)) {
|
|
81235
81284
|
return anyIterationTypes;
|
|
81236
81285
|
}
|
|
@@ -81245,7 +81294,7 @@ function createTypeChecker(host) {
|
|
|
81245
81294
|
}
|
|
81246
81295
|
}
|
|
81247
81296
|
return void 0;
|
|
81248
|
-
} else if ((
|
|
81297
|
+
} else if ((_a2 = errorOutputContainer == null ? void 0 : errorOutputContainer.errors) == null ? void 0 : _a2.length) {
|
|
81249
81298
|
for (const diag2 of errorOutputContainer.errors) {
|
|
81250
81299
|
diagnostics.add(diag2);
|
|
81251
81300
|
}
|
|
@@ -81553,7 +81602,7 @@ function createTypeChecker(host) {
|
|
|
81553
81602
|
));
|
|
81554
81603
|
}
|
|
81555
81604
|
function getIterationTypesOfMethod(type, resolver, methodName, errorNode, errorOutputContainer) {
|
|
81556
|
-
var
|
|
81605
|
+
var _a2, _b, _c, _d;
|
|
81557
81606
|
const method = getPropertyOfType(type, methodName);
|
|
81558
81607
|
if (!method && methodName !== "next") {
|
|
81559
81608
|
return void 0;
|
|
@@ -81584,7 +81633,7 @@ function createTypeChecker(host) {
|
|
|
81584
81633
|
/*reportErrors*/
|
|
81585
81634
|
false
|
|
81586
81635
|
);
|
|
81587
|
-
const isGeneratorMethod = ((_b = (
|
|
81636
|
+
const isGeneratorMethod = ((_b = (_a2 = globalGeneratorType.symbol) == null ? void 0 : _a2.members) == null ? void 0 : _b.get(methodName)) === methodType.symbol;
|
|
81588
81637
|
const isIteratorMethod = !isGeneratorMethod && ((_d = (_c = globalIteratorType.symbol) == null ? void 0 : _c.members) == null ? void 0 : _d.get(methodName)) === methodType.symbol;
|
|
81589
81638
|
if (isGeneratorMethod || isIteratorMethod) {
|
|
81590
81639
|
const globalType = isGeneratorMethod ? globalGeneratorType : globalIteratorType;
|
|
@@ -82456,7 +82505,7 @@ function createTypeChecker(host) {
|
|
|
82456
82505
|
return filter(symbol.declarations, (d) => d.kind === 263 /* ClassDeclaration */ || d.kind === 264 /* InterfaceDeclaration */);
|
|
82457
82506
|
}
|
|
82458
82507
|
function checkKindsOfPropertyMemberOverrides(type, baseType) {
|
|
82459
|
-
var
|
|
82508
|
+
var _a2, _b, _c, _d, _e;
|
|
82460
82509
|
const baseProperties = getPropertiesOfType(baseType);
|
|
82461
82510
|
const notImplementedInfo = /* @__PURE__ */ new Map();
|
|
82462
82511
|
basePropertyCheck:
|
|
@@ -82487,7 +82536,7 @@ function createTypeChecker(host) {
|
|
|
82487
82536
|
const baseTypeName = typeToString(baseType);
|
|
82488
82537
|
const typeName = typeToString(type);
|
|
82489
82538
|
const basePropertyName = symbolToString(baseProperty);
|
|
82490
|
-
const missedProperties = append((
|
|
82539
|
+
const missedProperties = append((_a2 = notImplementedInfo.get(derivedClassDecl)) == null ? void 0 : _a2.missedProperties, basePropertyName);
|
|
82491
82540
|
notImplementedInfo.set(derivedClassDecl, { baseTypeName, typeName, missedProperties });
|
|
82492
82541
|
}
|
|
82493
82542
|
} else {
|
|
@@ -82499,7 +82548,7 @@ function createTypeChecker(host) {
|
|
|
82499
82548
|
const basePropertyFlags = base.flags & 98308 /* PropertyOrAccessor */;
|
|
82500
82549
|
const derivedPropertyFlags = derived.flags & 98308 /* PropertyOrAccessor */;
|
|
82501
82550
|
if (basePropertyFlags && derivedPropertyFlags) {
|
|
82502
|
-
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)) {
|
|
82503
82552
|
continue;
|
|
82504
82553
|
}
|
|
82505
82554
|
const overriddenInstanceProperty = basePropertyFlags !== 4 /* Property */ && derivedPropertyFlags === 4 /* Property */;
|
|
@@ -82980,7 +83029,7 @@ function createTypeChecker(host) {
|
|
|
82980
83029
|
}
|
|
82981
83030
|
addLazyDiagnostic(checkModuleDeclarationDiagnostics);
|
|
82982
83031
|
function checkModuleDeclarationDiagnostics() {
|
|
82983
|
-
var
|
|
83032
|
+
var _a2, _b;
|
|
82984
83033
|
const isGlobalAugmentation = isGlobalScopeAugmentation(node);
|
|
82985
83034
|
const inAmbientContext = node.flags & 33554432 /* Ambient */;
|
|
82986
83035
|
if (isGlobalAugmentation && !inAmbientContext) {
|
|
@@ -83005,7 +83054,7 @@ function createTypeChecker(host) {
|
|
|
83005
83054
|
if (getIsolatedModules(compilerOptions) && !getSourceFileOfNode(node).externalModuleIndicator) {
|
|
83006
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);
|
|
83007
83056
|
}
|
|
83008
|
-
if (((
|
|
83057
|
+
if (((_a2 = symbol.declarations) == null ? void 0 : _a2.length) > 1) {
|
|
83009
83058
|
const firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol);
|
|
83010
83059
|
if (firstNonAmbientClassOrFunc) {
|
|
83011
83060
|
if (getSourceFileOfNode(node) !== getSourceFileOfNode(firstNonAmbientClassOrFunc)) {
|
|
@@ -83142,7 +83191,7 @@ function createTypeChecker(host) {
|
|
|
83142
83191
|
return true;
|
|
83143
83192
|
}
|
|
83144
83193
|
function checkAliasSymbol(node) {
|
|
83145
|
-
var
|
|
83194
|
+
var _a2, _b, _c, _d;
|
|
83146
83195
|
let symbol = getSymbolOfDeclaration(node);
|
|
83147
83196
|
const target = resolveAlias(symbol);
|
|
83148
83197
|
if (target !== unknownSymbol) {
|
|
@@ -83152,7 +83201,7 @@ function createTypeChecker(host) {
|
|
|
83152
83201
|
Debug.assert(node.kind !== 280 /* NamespaceExport */);
|
|
83153
83202
|
if (node.kind === 281 /* ExportSpecifier */) {
|
|
83154
83203
|
const diag2 = error(errorNode, Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files);
|
|
83155
|
-
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);
|
|
83156
83205
|
if (alreadyExportedSymbol === target) {
|
|
83157
83206
|
const exportingDeclaration = (_c = alreadyExportedSymbol.declarations) == null ? void 0 : _c.find(isJSDocNode);
|
|
83158
83207
|
if (exportingDeclaration) {
|
|
@@ -83279,7 +83328,7 @@ function createTypeChecker(host) {
|
|
|
83279
83328
|
}
|
|
83280
83329
|
}
|
|
83281
83330
|
function checkImportAttributes(declaration) {
|
|
83282
|
-
var
|
|
83331
|
+
var _a2;
|
|
83283
83332
|
const node = declaration.attributes;
|
|
83284
83333
|
if (node) {
|
|
83285
83334
|
const importAttributesType = getGlobalImportAttributesType(
|
|
@@ -83300,7 +83349,7 @@ function createTypeChecker(host) {
|
|
|
83300
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;
|
|
83301
83350
|
return grammarErrorOnNode(node, message);
|
|
83302
83351
|
}
|
|
83303
|
-
const isTypeOnly = isJSDocImportTag(declaration) || (isImportDeclaration(declaration) ? (
|
|
83352
|
+
const isTypeOnly = isJSDocImportTag(declaration) || (isImportDeclaration(declaration) ? (_a2 = declaration.importClause) == null ? void 0 : _a2.isTypeOnly : declaration.isTypeOnly);
|
|
83304
83353
|
if (isTypeOnly) {
|
|
83305
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);
|
|
83306
83355
|
}
|
|
@@ -83413,8 +83462,8 @@ function createTypeChecker(host) {
|
|
|
83413
83462
|
checkImportAttributes(node);
|
|
83414
83463
|
}
|
|
83415
83464
|
function checkGrammarExportDeclaration(node) {
|
|
83416
|
-
var
|
|
83417
|
-
if (node.isTypeOnly && ((
|
|
83465
|
+
var _a2;
|
|
83466
|
+
if (node.isTypeOnly && ((_a2 = node.exportClause) == null ? void 0 : _a2.kind) === 279 /* NamedExports */) {
|
|
83418
83467
|
return checkGrammarNamedImportsOrExports(node.exportClause);
|
|
83419
83468
|
}
|
|
83420
83469
|
return false;
|
|
@@ -83916,8 +83965,8 @@ function createTypeChecker(host) {
|
|
|
83916
83965
|
links.deferredNodes = void 0;
|
|
83917
83966
|
}
|
|
83918
83967
|
function checkDeferredNode(node) {
|
|
83919
|
-
var
|
|
83920
|
-
(
|
|
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 });
|
|
83921
83970
|
const saveCurrentNode = currentNode;
|
|
83922
83971
|
currentNode = node;
|
|
83923
83972
|
instantiationCount = 0;
|
|
@@ -83969,8 +84018,8 @@ function createTypeChecker(host) {
|
|
|
83969
84018
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
83970
84019
|
}
|
|
83971
84020
|
function checkSourceFile(node) {
|
|
83972
|
-
var
|
|
83973
|
-
(
|
|
84021
|
+
var _a2, _b;
|
|
84022
|
+
(_a2 = tracing) == null ? void 0 : _a2.push(
|
|
83974
84023
|
tracing.Phase.Check,
|
|
83975
84024
|
"checkSourceFile",
|
|
83976
84025
|
{ path: node.path },
|
|
@@ -84764,7 +84813,7 @@ function createTypeChecker(host) {
|
|
|
84764
84813
|
return roots ? flatMap(roots, getRootSymbols) : [symbol];
|
|
84765
84814
|
}
|
|
84766
84815
|
function getImmediateRootSymbols(symbol) {
|
|
84767
|
-
if (getCheckFlags(symbol) & 6 /*
|
|
84816
|
+
if (getCheckFlags(symbol) & 6 /* SyntheticMember */) {
|
|
84768
84817
|
return mapDefined(getSymbolLinks(symbol).containingType.types, (type) => getPropertyOfType(type, symbol.escapedName));
|
|
84769
84818
|
} else if (symbol.flags & 33554432 /* Transient */) {
|
|
84770
84819
|
const { links: { leftSpread, rightSpread, syntheticOrigin } } = symbol;
|
|
@@ -84796,7 +84845,7 @@ function createTypeChecker(host) {
|
|
|
84796
84845
|
return isModuleOrEnumDeclaration(node.parent) && node === node.parent.name;
|
|
84797
84846
|
}
|
|
84798
84847
|
function getReferencedExportContainer(nodeIn, prefixLocals) {
|
|
84799
|
-
var
|
|
84848
|
+
var _a2;
|
|
84800
84849
|
const node = getParseTreeNode(nodeIn, isIdentifier);
|
|
84801
84850
|
if (node) {
|
|
84802
84851
|
let symbol = getReferencedValueSymbol(
|
|
@@ -84814,7 +84863,7 @@ function createTypeChecker(host) {
|
|
|
84814
84863
|
}
|
|
84815
84864
|
const parentSymbol = getParentOfSymbol(symbol);
|
|
84816
84865
|
if (parentSymbol) {
|
|
84817
|
-
if (parentSymbol.flags & 512 /* ValueModule */ && ((
|
|
84866
|
+
if (parentSymbol.flags & 512 /* ValueModule */ && ((_a2 = parentSymbol.valueDeclaration) == null ? void 0 : _a2.kind) === 307 /* SourceFile */) {
|
|
84818
84867
|
const symbolFile = parentSymbol.valueDeclaration;
|
|
84819
84868
|
const referenceFile = getSourceFileOfNode(node);
|
|
84820
84869
|
const symbolIsUmdExport = symbolFile !== referenceFile;
|
|
@@ -85041,11 +85090,11 @@ function createTypeChecker(host) {
|
|
|
85041
85090
|
return symbol && getPropertiesOfType(getTypeOfSymbol(symbol)) || emptyArray;
|
|
85042
85091
|
}
|
|
85043
85092
|
function getNodeCheckFlags(node) {
|
|
85044
|
-
var
|
|
85093
|
+
var _a2;
|
|
85045
85094
|
const nodeId = node.id || 0;
|
|
85046
85095
|
if (nodeId < 0 || nodeId >= nodeLinks.length)
|
|
85047
85096
|
return 0;
|
|
85048
|
-
return ((
|
|
85097
|
+
return ((_a2 = nodeLinks[nodeId]) == null ? void 0 : _a2.flags) || 0;
|
|
85049
85098
|
}
|
|
85050
85099
|
function getEnumMemberValue(node) {
|
|
85051
85100
|
computeEnumMemberValues(node.parent);
|
|
@@ -85080,7 +85129,7 @@ function createTypeChecker(host) {
|
|
|
85080
85129
|
return !!(type.flags & 524288 /* Object */) && getSignaturesOfType(type, 0 /* Call */).length > 0;
|
|
85081
85130
|
}
|
|
85082
85131
|
function getTypeReferenceSerializationKind(typeNameIn, location) {
|
|
85083
|
-
var
|
|
85132
|
+
var _a2;
|
|
85084
85133
|
const typeName = getParseTreeNode(typeNameIn, isEntityName);
|
|
85085
85134
|
if (!typeName)
|
|
85086
85135
|
return 0 /* Unknown */;
|
|
@@ -85100,7 +85149,7 @@ function createTypeChecker(host) {
|
|
|
85100
85149
|
true,
|
|
85101
85150
|
location
|
|
85102
85151
|
);
|
|
85103
|
-
isTypeOnly = !!((
|
|
85152
|
+
isTypeOnly = !!((_a2 = rootValueSymbol == null ? void 0 : rootValueSymbol.declarations) == null ? void 0 : _a2.every(isTypeOnlyImportOrExportDeclaration));
|
|
85104
85153
|
}
|
|
85105
85154
|
const valueSymbol = resolveEntityName(
|
|
85106
85155
|
typeName,
|
|
@@ -85812,7 +85861,7 @@ function createTypeChecker(host) {
|
|
|
85812
85861
|
return externalHelpersModule;
|
|
85813
85862
|
}
|
|
85814
85863
|
function checkGrammarModifiers(node) {
|
|
85815
|
-
var
|
|
85864
|
+
var _a2;
|
|
85816
85865
|
const quickResult = reportObviousDecoratorErrors(node) || reportObviousModifierErrors(node);
|
|
85817
85866
|
if (quickResult !== void 0) {
|
|
85818
85867
|
return quickResult;
|
|
@@ -86088,7 +86137,7 @@ function createTypeChecker(host) {
|
|
|
86088
86137
|
case 147 /* OutKeyword */: {
|
|
86089
86138
|
const inOutFlag = modifier.kind === 103 /* InKeyword */ ? 8192 /* In */ : 16384 /* Out */;
|
|
86090
86139
|
const inOutText = modifier.kind === 103 /* InKeyword */ ? "in" : "out";
|
|
86091
|
-
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;
|
|
86092
86141
|
if (node.kind !== 168 /* TypeParameter */ || parent && !(isInterfaceDeclaration(parent) || isClassLike(parent) || isTypeAliasDeclaration(parent) || isJSDocTypedefTag(parent))) {
|
|
86093
86142
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText);
|
|
86094
86143
|
}
|
|
@@ -87165,11 +87214,11 @@ function createTypeChecker(host) {
|
|
|
87165
87214
|
return ambientModulesCache;
|
|
87166
87215
|
}
|
|
87167
87216
|
function checkGrammarImportClause(node) {
|
|
87168
|
-
var
|
|
87217
|
+
var _a2;
|
|
87169
87218
|
if (node.isTypeOnly && node.name && node.namedBindings) {
|
|
87170
87219
|
return grammarErrorOnNode(node, Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both);
|
|
87171
87220
|
}
|
|
87172
|
-
if (node.isTypeOnly && ((
|
|
87221
|
+
if (node.isTypeOnly && ((_a2 = node.namedBindings) == null ? void 0 : _a2.kind) === 275 /* NamedImports */) {
|
|
87173
87222
|
return checkGrammarNamedImportsOrExports(node.namedBindings);
|
|
87174
87223
|
}
|
|
87175
87224
|
return false;
|
|
@@ -119019,6 +119068,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119019
119068
|
const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
|
|
119020
119069
|
const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion2 } = createProgramOptions;
|
|
119021
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
|
+
}
|
|
119022
119078
|
const reportInvalidIgnoreDeprecations = memoize(() => createOptionValueDiagnostic("ignoreDeprecations", Diagnostics.Invalid_value_for_ignoreDeprecations));
|
|
119023
119079
|
let processingDefaultLibFiles;
|
|
119024
119080
|
let processingOtherFiles;
|
|
@@ -121798,8 +121854,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121798
121854
|
message = Diagnostics.File_is_library_specified_here;
|
|
121799
121855
|
break;
|
|
121800
121856
|
}
|
|
121801
|
-
const target =
|
|
121802
|
-
|
|
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;
|
|
121803
121860
|
message = Diagnostics.File_is_default_library_for_target_specified_here;
|
|
121804
121861
|
break;
|
|
121805
121862
|
default:
|