typescript 5.7.0-dev.20240924 → 5.7.0-dev.20240926
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.es2015.core.d.ts +9 -9
- package/lib/lib.es2015.iterable.d.ts +90 -27
- package/lib/lib.es2015.symbol.wellknown.d.ts +10 -10
- package/lib/lib.es2016.array.include.d.ts +9 -9
- package/lib/lib.es2017.sharedmemory.d.ts +12 -12
- package/lib/lib.es2017.typedarrays.d.ts +9 -9
- package/lib/lib.es2020.bigint.d.ts +51 -49
- package/lib/lib.es2020.sharedmemory.d.ts +11 -11
- package/lib/lib.es2022.array.d.ts +11 -11
- package/lib/lib.es2023.array.d.ts +99 -99
- package/lib/lib.es5.d.ts +251 -251
- package/lib/tsc.js +111 -33
- package/lib/typescript.js +123 -38
- package/package.json +2 -2
package/lib/typescript.js
CHANGED
|
@@ -2270,7 +2270,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2270
2270
|
|
|
2271
2271
|
// src/compiler/corePublic.ts
|
|
2272
2272
|
var versionMajorMinor = "5.7";
|
|
2273
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2273
|
+
var version = `${versionMajorMinor}.0-dev.20240926`;
|
|
2274
2274
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2275
2275
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2276
2276
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -9550,6 +9550,8 @@ var Diagnostics = {
|
|
|
9550
9550
|
),
|
|
9551
9551
|
Type_only_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute: diag(1541, 1 /* Error */, "Type_only_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribut_1541", "Type-only import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute."),
|
|
9552
9552
|
Type_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute: diag(1542, 1 /* Error */, "Type_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute_1542", "Type import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute."),
|
|
9553
|
+
Importing_a_JSON_file_into_an_ECMAScript_module_requires_a_type_Colon_json_import_attribute_when_module_is_set_to_0: diag(1543, 1 /* Error */, "Importing_a_JSON_file_into_an_ECMAScript_module_requires_a_type_Colon_json_import_attribute_when_mod_1543", `Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to '{0}'.`),
|
|
9554
|
+
Named_imports_from_a_JSON_file_into_an_ECMAScript_module_are_not_allowed_when_module_is_set_to_0: diag(1544, 1 /* Error */, "Named_imports_from_a_JSON_file_into_an_ECMAScript_module_are_not_allowed_when_module_is_set_to_0_1544", "Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to '{0}'."),
|
|
9553
9555
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
9554
9556
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
9555
9557
|
Call_signature_return_types_0_and_1_are_incompatible: diag(
|
|
@@ -10121,6 +10123,8 @@ var Diagnostics = {
|
|
|
10121
10123
|
This_expression_is_always_nullish: diag(2871, 1 /* Error */, "This_expression_is_always_nullish_2871", "This expression is always nullish."),
|
|
10122
10124
|
This_kind_of_expression_is_always_truthy: diag(2872, 1 /* Error */, "This_kind_of_expression_is_always_truthy_2872", "This kind of expression is always truthy."),
|
|
10123
10125
|
This_kind_of_expression_is_always_falsy: diag(2873, 1 /* Error */, "This_kind_of_expression_is_always_falsy_2873", "This kind of expression is always falsy."),
|
|
10126
|
+
This_JSX_tag_requires_0_to_be_in_scope_but_it_could_not_be_found: diag(2874, 1 /* Error */, "This_JSX_tag_requires_0_to_be_in_scope_but_it_could_not_be_found_2874", "This JSX tag requires '{0}' to be in scope, but it could not be found."),
|
|
10127
|
+
This_JSX_tag_requires_the_module_path_0_to_exist_but_none_could_be_found_Make_sure_you_have_types_for_the_appropriate_package_installed: diag(2875, 1 /* Error */, "This_JSX_tag_requires_the_module_path_0_to_exist_but_none_could_be_found_Make_sure_you_have_types_fo_2875", "This JSX tag requires the module path '{0}' to exist, but none could be found. Make sure you have types for the appropriate package installed."),
|
|
10124
10128
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
10125
10129
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
10126
10130
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -39842,9 +39846,10 @@ function getDeclarationFileExtension(fileName) {
|
|
|
39842
39846
|
return standardExtension;
|
|
39843
39847
|
}
|
|
39844
39848
|
if (fileExtensionIs(fileName, ".ts" /* Ts */)) {
|
|
39845
|
-
const
|
|
39849
|
+
const baseName = getBaseFileName(fileName);
|
|
39850
|
+
const index = baseName.lastIndexOf(".d.");
|
|
39846
39851
|
if (index >= 0) {
|
|
39847
|
-
return
|
|
39852
|
+
return baseName.substring(index);
|
|
39848
39853
|
}
|
|
39849
39854
|
}
|
|
39850
39855
|
return void 0;
|
|
@@ -52416,10 +52421,19 @@ function createTypeChecker(host) {
|
|
|
52416
52421
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
52417
52422
|
return usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */;
|
|
52418
52423
|
}
|
|
52419
|
-
function isOnlyImportableAsDefault(usage) {
|
|
52424
|
+
function isOnlyImportableAsDefault(usage, resolvedModule) {
|
|
52420
52425
|
if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
52421
52426
|
const usageMode = getEmitSyntaxForModuleSpecifierExpression(usage);
|
|
52422
|
-
|
|
52427
|
+
if (usageMode === 99 /* ESNext */) {
|
|
52428
|
+
resolvedModule ?? (resolvedModule = resolveExternalModuleName(
|
|
52429
|
+
usage,
|
|
52430
|
+
usage,
|
|
52431
|
+
/*ignoreErrors*/
|
|
52432
|
+
true
|
|
52433
|
+
));
|
|
52434
|
+
const targetFile = resolvedModule && getSourceFileOfModule(resolvedModule);
|
|
52435
|
+
return targetFile && (isJsonSourceFile(targetFile) || getDeclarationFileExtension(targetFile.fileName) === ".d.json.ts");
|
|
52436
|
+
}
|
|
52423
52437
|
}
|
|
52424
52438
|
return false;
|
|
52425
52439
|
}
|
|
@@ -52490,7 +52504,7 @@ function createTypeChecker(host) {
|
|
|
52490
52504
|
if (!specifier) {
|
|
52491
52505
|
return exportDefaultSymbol;
|
|
52492
52506
|
}
|
|
52493
|
-
const hasDefaultOnly = isOnlyImportableAsDefault(specifier);
|
|
52507
|
+
const hasDefaultOnly = isOnlyImportableAsDefault(specifier, moduleSymbol);
|
|
52494
52508
|
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
|
52495
52509
|
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
52496
52510
|
if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
|
|
@@ -52692,12 +52706,14 @@ function createTypeChecker(host) {
|
|
|
52692
52706
|
let symbolFromModule = getExportOfModule(targetSymbol, nameText, specifier, dontResolveAlias);
|
|
52693
52707
|
if (symbolFromModule === void 0 && nameText === "default" /* Default */) {
|
|
52694
52708
|
const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
|
52695
|
-
if (isOnlyImportableAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
52709
|
+
if (isOnlyImportableAsDefault(moduleSpecifier, moduleSymbol) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
52696
52710
|
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
52697
52711
|
}
|
|
52698
52712
|
}
|
|
52699
52713
|
const symbol = symbolFromModule && symbolFromVariable && symbolFromModule !== symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable;
|
|
52700
|
-
if (
|
|
52714
|
+
if (isImportOrExportSpecifier(specifier) && isOnlyImportableAsDefault(moduleSpecifier, moduleSymbol) && nameText !== "default" /* Default */) {
|
|
52715
|
+
error2(name, Diagnostics.Named_imports_from_a_JSON_file_into_an_ECMAScript_module_are_not_allowed_when_module_is_set_to_0, ModuleKind[moduleKind]);
|
|
52716
|
+
} else if (!symbol) {
|
|
52701
52717
|
errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name);
|
|
52702
52718
|
}
|
|
52703
52719
|
return symbol;
|
|
@@ -53276,7 +53292,7 @@ function createTypeChecker(host) {
|
|
|
53276
53292
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, !ignoreErrors ? moduleReferenceExpression : void 0, isForAugmentation) : void 0;
|
|
53277
53293
|
}
|
|
53278
53294
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
53279
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k
|
|
53295
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
53280
53296
|
if (errorNode && startsWith(moduleReference, "@types/")) {
|
|
53281
53297
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
53282
53298
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -53291,14 +53307,14 @@ function createTypeChecker(host) {
|
|
|
53291
53307
|
return ambientModule;
|
|
53292
53308
|
}
|
|
53293
53309
|
const currentSourceFile = getSourceFileOfNode(location);
|
|
53294
|
-
const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _a.name) || ((_b = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _b.argument.literal) || (
|
|
53310
|
+
const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _a.name) || ((_b = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _b.argument.literal) || (isVariableDeclaration(location) && location.initializer && isRequireCall(
|
|
53295
53311
|
location.initializer,
|
|
53296
53312
|
/*requireStringLiteralLikeArgument*/
|
|
53297
53313
|
true
|
|
53298
|
-
) ? 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)
|
|
53314
|
+
) ? location.initializer.arguments[0] : void 0) || ((_c = findAncestor(location, isImportCall)) == null ? void 0 : _c.arguments[0]) || ((_d = findAncestor(location, or(isImportDeclaration, isJSDocImportTag, isExportDeclaration))) == null ? void 0 : _d.moduleSpecifier) || ((_e = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _e.moduleReference.expression);
|
|
53299
53315
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : host.getDefaultResolutionModeForFile(currentSourceFile);
|
|
53300
53316
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
53301
|
-
const resolvedModule = (
|
|
53317
|
+
const resolvedModule = (_f = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _f.resolvedModule;
|
|
53302
53318
|
const resolutionDiagnostic = errorNode && resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
53303
53319
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
53304
53320
|
if (sourceFile) {
|
|
@@ -53306,7 +53322,7 @@ function createTypeChecker(host) {
|
|
|
53306
53322
|
error2(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
53307
53323
|
}
|
|
53308
53324
|
if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
|
|
53309
|
-
const importOrExport = ((
|
|
53325
|
+
const importOrExport = ((_g = findAncestor(location, isImportDeclaration)) == null ? void 0 : _g.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
53310
53326
|
if (errorNode && importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
|
|
53311
53327
|
error2(
|
|
53312
53328
|
errorNode,
|
|
@@ -53315,7 +53331,7 @@ function createTypeChecker(host) {
|
|
|
53315
53331
|
);
|
|
53316
53332
|
}
|
|
53317
53333
|
} else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
|
|
53318
|
-
const importOrExport = ((
|
|
53334
|
+
const importOrExport = ((_h = findAncestor(location, isImportDeclaration)) == null ? void 0 : _h.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
53319
53335
|
if (errorNode && !((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
|
|
53320
53336
|
const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
|
|
53321
53337
|
error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
|
|
@@ -53345,7 +53361,7 @@ function createTypeChecker(host) {
|
|
|
53345
53361
|
if (ext === ".ts" /* Ts */ || ext === ".js" /* Js */ || ext === ".tsx" /* Tsx */ || ext === ".jsx" /* Jsx */) {
|
|
53346
53362
|
diagnosticDetails = createModeMismatchDetails(currentSourceFile);
|
|
53347
53363
|
}
|
|
53348
|
-
const message = (overrideHost == null ? void 0 : overrideHost.kind) === 272 /* ImportDeclaration */ && ((
|
|
53364
|
+
const message = (overrideHost == null ? void 0 : overrideHost.kind) === 272 /* ImportDeclaration */ && ((_i = overrideHost.importClause) == null ? void 0 : _i.isTypeOnly) ? Diagnostics.Type_only_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute : (overrideHost == null ? void 0 : overrideHost.kind) === 205 /* ImportType */ ? Diagnostics.Type_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute : Diagnostics.The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead;
|
|
53349
53365
|
diagnostics.add(createDiagnosticForNodeFromMessageChain(
|
|
53350
53366
|
getSourceFileOfNode(errorNode),
|
|
53351
53367
|
errorNode,
|
|
@@ -53408,14 +53424,14 @@ function createTypeChecker(host) {
|
|
|
53408
53424
|
error2(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
53409
53425
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
53410
53426
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
53411
|
-
const suggestedExt = (
|
|
53427
|
+
const suggestedExt = (_j = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _j[1];
|
|
53412
53428
|
if (suggestedExt) {
|
|
53413
53429
|
error2(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
|
|
53414
53430
|
} else {
|
|
53415
53431
|
error2(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path);
|
|
53416
53432
|
}
|
|
53417
53433
|
} else {
|
|
53418
|
-
if ((
|
|
53434
|
+
if ((_k = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _k.alternateResult) {
|
|
53419
53435
|
const errorInfo = createModuleNotFoundChain(currentSourceFile, host, moduleReference, mode, moduleReference);
|
|
53420
53436
|
errorOrSuggestion(
|
|
53421
53437
|
/*isError*/
|
|
@@ -56614,7 +56630,13 @@ function createTypeChecker(host) {
|
|
|
56614
56630
|
if (typeFromTypeNode === type) {
|
|
56615
56631
|
return true;
|
|
56616
56632
|
}
|
|
56617
|
-
if (annotatedDeclaration
|
|
56633
|
+
if (!annotatedDeclaration) {
|
|
56634
|
+
return false;
|
|
56635
|
+
}
|
|
56636
|
+
if ((isPropertySignature(annotatedDeclaration) || isPropertyDeclaration(annotatedDeclaration)) && annotatedDeclaration.questionToken) {
|
|
56637
|
+
return getTypeWithFacts(type, 524288 /* NEUndefined */) === typeFromTypeNode;
|
|
56638
|
+
}
|
|
56639
|
+
if (isParameter(annotatedDeclaration) && hasEffectiveQuestionToken(annotatedDeclaration)) {
|
|
56618
56640
|
return getTypeWithFacts(type, 524288 /* NEUndefined */) === typeFromTypeNode;
|
|
56619
56641
|
}
|
|
56620
56642
|
return false;
|
|
@@ -57575,7 +57597,9 @@ function createTypeChecker(host) {
|
|
|
57575
57597
|
const skipMembershipCheck = !isPrivate;
|
|
57576
57598
|
if (skipMembershipCheck || !!length(symbol.declarations) && some(symbol.declarations, (d) => !!findAncestor(d, (n) => n === enclosingDeclaration))) {
|
|
57577
57599
|
const scopeCleanup = cloneNodeBuilderContext(context);
|
|
57600
|
+
context.tracker.pushErrorFallbackNode(find(symbol.declarations, (d) => getSourceFileOfNode(d) === context.enclosingFile));
|
|
57578
57601
|
serializeSymbolWorker(symbol, isPrivate, propertyAsAlias);
|
|
57602
|
+
context.tracker.popErrorFallbackNode();
|
|
57579
57603
|
scopeCleanup();
|
|
57580
57604
|
}
|
|
57581
57605
|
}
|
|
@@ -61578,8 +61602,13 @@ function createTypeChecker(host) {
|
|
|
61578
61602
|
if (left.typeParameters && right.typeParameters) {
|
|
61579
61603
|
paramMapper = createTypeMapper(right.typeParameters, left.typeParameters);
|
|
61580
61604
|
}
|
|
61605
|
+
let flags = (left.flags | right.flags) & (167 /* PropagatingFlags */ & ~1 /* HasRestParameter */);
|
|
61581
61606
|
const declaration = left.declaration;
|
|
61582
61607
|
const params = combineUnionParameters(left, right, paramMapper);
|
|
61608
|
+
const lastParam = lastOrUndefined(params);
|
|
61609
|
+
if (lastParam && getCheckFlags(lastParam) & 32768 /* RestParameter */) {
|
|
61610
|
+
flags |= 1 /* HasRestParameter */;
|
|
61611
|
+
}
|
|
61583
61612
|
const thisParam = combineUnionThisParam(left.thisParameter, right.thisParameter, paramMapper);
|
|
61584
61613
|
const minArgCount = Math.max(left.minArgumentCount, right.minArgumentCount);
|
|
61585
61614
|
const result = createSignature(
|
|
@@ -61592,7 +61621,7 @@ function createTypeChecker(host) {
|
|
|
61592
61621
|
/*resolvedTypePredicate*/
|
|
61593
61622
|
void 0,
|
|
61594
61623
|
minArgCount,
|
|
61595
|
-
|
|
61624
|
+
flags
|
|
61596
61625
|
);
|
|
61597
61626
|
result.compositeKind = 1048576 /* Union */;
|
|
61598
61627
|
result.compositeSignatures = concatenate(left.compositeKind !== 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
|
|
@@ -75078,7 +75107,7 @@ function createTypeChecker(host) {
|
|
|
75078
75107
|
}
|
|
75079
75108
|
function markJsxAliasReferenced(node) {
|
|
75080
75109
|
if (!getJsxNamespaceContainerForImplicitImport(node)) {
|
|
75081
|
-
const jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? Diagnostics.
|
|
75110
|
+
const jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? Diagnostics.This_JSX_tag_requires_0_to_be_in_scope_but_it_could_not_be_found : void 0;
|
|
75082
75111
|
const jsxFactoryNamespace = getJsxNamespace(node);
|
|
75083
75112
|
const jsxFactoryLocation = isJsxOpeningLikeElement(node) ? node.tagName : node;
|
|
75084
75113
|
let jsxFactorySym;
|
|
@@ -77025,13 +77054,14 @@ function createTypeChecker(host) {
|
|
|
77025
77054
|
const paramName = leftName === rightName ? leftName : !leftName ? rightName : !rightName ? leftName : void 0;
|
|
77026
77055
|
const paramSymbol = createSymbol(
|
|
77027
77056
|
1 /* FunctionScopedVariable */ | (isOptional && !isRestParam ? 16777216 /* Optional */ : 0),
|
|
77028
|
-
paramName || `arg${i}
|
|
77057
|
+
paramName || `arg${i}`,
|
|
77058
|
+
isRestParam ? 32768 /* RestParameter */ : isOptional ? 16384 /* OptionalParameter */ : 0
|
|
77029
77059
|
);
|
|
77030
77060
|
paramSymbol.links.type = isRestParam ? createArrayType(unionParamType) : unionParamType;
|
|
77031
77061
|
params[i] = paramSymbol;
|
|
77032
77062
|
}
|
|
77033
77063
|
if (needsExtraRestElement) {
|
|
77034
|
-
const restParamSymbol = createSymbol(1 /* FunctionScopedVariable */, "args");
|
|
77064
|
+
const restParamSymbol = createSymbol(1 /* FunctionScopedVariable */, "args", 32768 /* RestParameter */);
|
|
77035
77065
|
restParamSymbol.links.type = createArrayType(getTypeAtPosition(shorter, longestCount));
|
|
77036
77066
|
if (shorter === right) {
|
|
77037
77067
|
restParamSymbol.links.type = instantiateType(restParamSymbol.links.type, mapper);
|
|
@@ -77046,8 +77076,13 @@ function createTypeChecker(host) {
|
|
|
77046
77076
|
if (left.typeParameters && right.typeParameters) {
|
|
77047
77077
|
paramMapper = createTypeMapper(right.typeParameters, left.typeParameters);
|
|
77048
77078
|
}
|
|
77079
|
+
let flags = (left.flags | right.flags) & (167 /* PropagatingFlags */ & ~1 /* HasRestParameter */);
|
|
77049
77080
|
const declaration = left.declaration;
|
|
77050
77081
|
const params = combineIntersectionParameters(left, right, paramMapper);
|
|
77082
|
+
const lastParam = lastOrUndefined(params);
|
|
77083
|
+
if (lastParam && getCheckFlags(lastParam) & 32768 /* RestParameter */) {
|
|
77084
|
+
flags |= 1 /* HasRestParameter */;
|
|
77085
|
+
}
|
|
77051
77086
|
const thisParam = combineIntersectionThisParam(left.thisParameter, right.thisParameter, paramMapper);
|
|
77052
77087
|
const minArgCount = Math.max(left.minArgumentCount, right.minArgumentCount);
|
|
77053
77088
|
const result = createSignature(
|
|
@@ -77060,7 +77095,7 @@ function createTypeChecker(host) {
|
|
|
77060
77095
|
/*resolvedTypePredicate*/
|
|
77061
77096
|
void 0,
|
|
77062
77097
|
minArgCount,
|
|
77063
|
-
|
|
77098
|
+
flags
|
|
77064
77099
|
);
|
|
77065
77100
|
result.compositeKind = 2097152 /* Intersection */;
|
|
77066
77101
|
result.compositeSignatures = concatenate(left.compositeKind === 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
|
|
@@ -77788,7 +77823,7 @@ function createTypeChecker(host) {
|
|
|
77788
77823
|
return void 0;
|
|
77789
77824
|
}
|
|
77790
77825
|
const isClassic = getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */;
|
|
77791
|
-
const errorMessage = isClassic ? Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option : Diagnostics.
|
|
77826
|
+
const errorMessage = isClassic ? Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option : Diagnostics.This_JSX_tag_requires_the_module_path_0_to_exist_but_none_could_be_found_Make_sure_you_have_types_for_the_appropriate_package_installed;
|
|
77792
77827
|
const specifier = getJSXRuntimeImportSpecifier(file, runtimeImportSpecifier);
|
|
77793
77828
|
const mod = resolveExternalModule(specifier || location, runtimeImportSpecifier, errorMessage, location);
|
|
77794
77829
|
const result = mod && mod !== unknownSymbol ? getMergedSymbol(resolveSymbol(mod)) : void 0;
|
|
@@ -89215,6 +89250,7 @@ function createTypeChecker(host) {
|
|
|
89215
89250
|
grammarErrorOnFirstToken(node, Diagnostics.An_import_declaration_cannot_have_modifiers);
|
|
89216
89251
|
}
|
|
89217
89252
|
if (checkExternalImportOrExportDeclaration(node)) {
|
|
89253
|
+
let resolvedModule;
|
|
89218
89254
|
const importClause = node.importClause;
|
|
89219
89255
|
if (importClause && !checkGrammarImportClause(importClause)) {
|
|
89220
89256
|
if (importClause.name) {
|
|
@@ -89227,18 +89263,27 @@ function createTypeChecker(host) {
|
|
|
89227
89263
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
89228
89264
|
}
|
|
89229
89265
|
} else {
|
|
89230
|
-
|
|
89231
|
-
if (
|
|
89266
|
+
resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier);
|
|
89267
|
+
if (resolvedModule) {
|
|
89232
89268
|
forEach(importClause.namedBindings.elements, checkImportBinding);
|
|
89233
89269
|
}
|
|
89234
89270
|
}
|
|
89235
89271
|
}
|
|
89272
|
+
if (isOnlyImportableAsDefault(node.moduleSpecifier, resolvedModule) && !hasTypeJsonImportAttribute(node)) {
|
|
89273
|
+
error2(node.moduleSpecifier, Diagnostics.Importing_a_JSON_file_into_an_ECMAScript_module_requires_a_type_Colon_json_import_attribute_when_module_is_set_to_0, ModuleKind[moduleKind]);
|
|
89274
|
+
}
|
|
89236
89275
|
} else if (noUncheckedSideEffectImports && !importClause) {
|
|
89237
89276
|
void resolveExternalModuleName(node, node.moduleSpecifier);
|
|
89238
89277
|
}
|
|
89239
89278
|
}
|
|
89240
89279
|
checkImportAttributes(node);
|
|
89241
89280
|
}
|
|
89281
|
+
function hasTypeJsonImportAttribute(node) {
|
|
89282
|
+
return !!node.attributes && node.attributes.elements.some((attr) => {
|
|
89283
|
+
var _a;
|
|
89284
|
+
return getTextOfIdentifierOrLiteral(attr.name) === "type" && ((_a = tryCast(attr.value, isStringLiteralLike)) == null ? void 0 : _a.text) === "json";
|
|
89285
|
+
});
|
|
89286
|
+
}
|
|
89242
89287
|
function checkImportEqualsDeclaration(node) {
|
|
89243
89288
|
if (checkGrammarModuleElementContext(node, isInJSFile(node) ? Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module : Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)) {
|
|
89244
89289
|
return;
|
|
@@ -90355,7 +90400,7 @@ function createTypeChecker(host) {
|
|
|
90355
90400
|
} else if (isJSDocMemberName(name)) {
|
|
90356
90401
|
return resolveJSDocMemberName(name);
|
|
90357
90402
|
}
|
|
90358
|
-
} else if (isTypeReferenceIdentifier(name)) {
|
|
90403
|
+
} else if (isEntityName(name) && isTypeReferenceIdentifier(name)) {
|
|
90359
90404
|
const meaning = name.parent.kind === 183 /* TypeReference */ ? 788968 /* Type */ : 1920 /* Namespace */;
|
|
90360
90405
|
const symbol = resolveEntityName(
|
|
90361
90406
|
name,
|
|
@@ -93565,6 +93610,14 @@ var SymbolTrackerImpl = class _SymbolTrackerImpl {
|
|
|
93565
93610
|
this.inner.reportInferenceFallback(node);
|
|
93566
93611
|
}
|
|
93567
93612
|
}
|
|
93613
|
+
pushErrorFallbackNode(node) {
|
|
93614
|
+
var _a, _b;
|
|
93615
|
+
return (_b = (_a = this.inner) == null ? void 0 : _a.pushErrorFallbackNode) == null ? void 0 : _b.call(_a, node);
|
|
93616
|
+
}
|
|
93617
|
+
popErrorFallbackNode() {
|
|
93618
|
+
var _a, _b;
|
|
93619
|
+
return (_b = (_a = this.inner) == null ? void 0 : _a.popErrorFallbackNode) == null ? void 0 : _b.call(_a);
|
|
93620
|
+
}
|
|
93568
93621
|
};
|
|
93569
93622
|
|
|
93570
93623
|
// src/compiler/visitorPublic.ts
|
|
@@ -116903,6 +116956,7 @@ function transformDeclarations(context) {
|
|
|
116903
116956
|
let suppressNewDiagnosticContexts;
|
|
116904
116957
|
const { factory: factory2 } = context;
|
|
116905
116958
|
const host = context.getEmitHost();
|
|
116959
|
+
let restoreFallbackNode = () => void 0;
|
|
116906
116960
|
const symbolTracker = {
|
|
116907
116961
|
trackSymbol,
|
|
116908
116962
|
reportInaccessibleThisError,
|
|
@@ -116914,7 +116968,19 @@ function transformDeclarations(context) {
|
|
|
116914
116968
|
moduleResolverHost: host,
|
|
116915
116969
|
reportNonlocalAugmentation,
|
|
116916
116970
|
reportNonSerializableProperty,
|
|
116917
|
-
reportInferenceFallback
|
|
116971
|
+
reportInferenceFallback,
|
|
116972
|
+
pushErrorFallbackNode(node) {
|
|
116973
|
+
const currentFallback = errorFallbackNode;
|
|
116974
|
+
const currentRestore = restoreFallbackNode;
|
|
116975
|
+
restoreFallbackNode = () => {
|
|
116976
|
+
restoreFallbackNode = currentRestore;
|
|
116977
|
+
errorFallbackNode = currentFallback;
|
|
116978
|
+
};
|
|
116979
|
+
errorFallbackNode = node;
|
|
116980
|
+
},
|
|
116981
|
+
popErrorFallbackNode() {
|
|
116982
|
+
restoreFallbackNode();
|
|
116983
|
+
}
|
|
116918
116984
|
};
|
|
116919
116985
|
let errorNameNode;
|
|
116920
116986
|
let errorFallbackNode;
|
|
@@ -125756,7 +125822,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
125756
125822
|
return (_a2 = resolvedTypeReferenceDirectiveNames == null ? void 0 : resolvedTypeReferenceDirectiveNames.get(file.path)) == null ? void 0 : _a2.get(typeDirectiveName, mode);
|
|
125757
125823
|
}
|
|
125758
125824
|
function getResolvedTypeReferenceDirectiveFromTypeReferenceDirective(typeRef, sourceFile) {
|
|
125759
|
-
return getResolvedTypeReferenceDirective(
|
|
125825
|
+
return getResolvedTypeReferenceDirective(
|
|
125826
|
+
sourceFile,
|
|
125827
|
+
typeRef.fileName,
|
|
125828
|
+
getModeForTypeReferenceDirectiveInFile(typeRef, sourceFile)
|
|
125829
|
+
);
|
|
125760
125830
|
}
|
|
125761
125831
|
function forEachResolvedModule(callback, file) {
|
|
125762
125832
|
forEachResolution(resolvedModules, callback, file);
|
|
@@ -126143,10 +126213,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
126143
126213
|
const moduleNames = getModuleNames(newSourceFile);
|
|
126144
126214
|
const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
126145
126215
|
(resolvedModulesProcessing ?? (resolvedModulesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, resolutions);
|
|
126216
|
+
const optionsForFile = getCompilerOptionsForFile(newSourceFile);
|
|
126146
126217
|
const resolutionsChanged = hasChangesInResolutions(
|
|
126147
126218
|
moduleNames,
|
|
126148
126219
|
resolutions,
|
|
126149
|
-
(name) => oldProgram.getResolvedModule(newSourceFile, name.text,
|
|
126220
|
+
(name) => oldProgram.getResolvedModule(newSourceFile, name.text, getModeForUsageLocationWorker(newSourceFile, name, optionsForFile)),
|
|
126150
126221
|
moduleResolutionIsEqualTo
|
|
126151
126222
|
);
|
|
126152
126223
|
if (resolutionsChanged) structureIsReused = 1 /* SafeModules */;
|
|
@@ -126156,7 +126227,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
126156
126227
|
const typeReferenceResolutionsChanged = hasChangesInResolutions(
|
|
126157
126228
|
typesReferenceDirectives,
|
|
126158
126229
|
typeReferenceResolutions,
|
|
126159
|
-
(name) => oldProgram.getResolvedTypeReferenceDirective(
|
|
126230
|
+
(name) => oldProgram.getResolvedTypeReferenceDirective(
|
|
126231
|
+
newSourceFile,
|
|
126232
|
+
getTypeReferenceResolutionName(name),
|
|
126233
|
+
getModeForTypeReferenceDirectiveInFile(name, newSourceFile)
|
|
126234
|
+
),
|
|
126160
126235
|
typeDirectiveIsEqualTo
|
|
126161
126236
|
);
|
|
126162
126237
|
if (typeReferenceResolutionsChanged) structureIsReused = 1 /* SafeModules */;
|
|
@@ -127317,8 +127392,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
127317
127392
|
const ref = file.typeReferenceDirectives[index];
|
|
127318
127393
|
const resolvedTypeReferenceDirective = resolutions[index];
|
|
127319
127394
|
const fileName = ref.fileName;
|
|
127320
|
-
|
|
127321
|
-
|
|
127395
|
+
const mode = getModeForTypeReferenceDirectiveInFile(ref, file);
|
|
127396
|
+
resolutionsInFile.set(fileName, mode, resolvedTypeReferenceDirective);
|
|
127322
127397
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: 5 /* TypeReferenceDirective */, file: file.path, index });
|
|
127323
127398
|
}
|
|
127324
127399
|
}
|
|
@@ -128362,6 +128437,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
128362
128437
|
function shouldTransformImportCall(sourceFile) {
|
|
128363
128438
|
return shouldTransformImportCallWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
128364
128439
|
}
|
|
128440
|
+
function getModeForTypeReferenceDirectiveInFile(ref, sourceFile) {
|
|
128441
|
+
return ref.resolutionMode || getDefaultResolutionModeForFile2(sourceFile);
|
|
128442
|
+
}
|
|
128365
128443
|
}
|
|
128366
128444
|
function shouldTransformImportCallWorker(sourceFile, options) {
|
|
128367
128445
|
const moduleKind = getEmitModuleKind(options);
|
|
@@ -149719,6 +149797,7 @@ var SymbolObject = class {
|
|
|
149719
149797
|
if (context) {
|
|
149720
149798
|
if (isGetAccessor(context)) {
|
|
149721
149799
|
if (!this.contextualGetAccessorDocumentationComment) {
|
|
149800
|
+
this.contextualGetAccessorDocumentationComment = emptyArray;
|
|
149722
149801
|
this.contextualGetAccessorDocumentationComment = getDocumentationComment(filter(this.declarations, isGetAccessor), checker);
|
|
149723
149802
|
}
|
|
149724
149803
|
if (length(this.contextualGetAccessorDocumentationComment)) {
|
|
@@ -149727,6 +149806,7 @@ var SymbolObject = class {
|
|
|
149727
149806
|
}
|
|
149728
149807
|
if (isSetAccessor(context)) {
|
|
149729
149808
|
if (!this.contextualSetAccessorDocumentationComment) {
|
|
149809
|
+
this.contextualSetAccessorDocumentationComment = emptyArray;
|
|
149730
149810
|
this.contextualSetAccessorDocumentationComment = getDocumentationComment(filter(this.declarations, isSetAccessor), checker);
|
|
149731
149811
|
}
|
|
149732
149812
|
if (length(this.contextualSetAccessorDocumentationComment)) {
|
|
@@ -149747,6 +149827,7 @@ var SymbolObject = class {
|
|
|
149747
149827
|
if (context) {
|
|
149748
149828
|
if (isGetAccessor(context)) {
|
|
149749
149829
|
if (!this.contextualGetAccessorTags) {
|
|
149830
|
+
this.contextualGetAccessorTags = emptyArray;
|
|
149750
149831
|
this.contextualGetAccessorTags = getJsDocTagsOfDeclarations(filter(this.declarations, isGetAccessor), checker);
|
|
149751
149832
|
}
|
|
149752
149833
|
if (length(this.contextualGetAccessorTags)) {
|
|
@@ -149755,6 +149836,7 @@ var SymbolObject = class {
|
|
|
149755
149836
|
}
|
|
149756
149837
|
if (isSetAccessor(context)) {
|
|
149757
149838
|
if (!this.contextualSetAccessorTags) {
|
|
149839
|
+
this.contextualSetAccessorTags = emptyArray;
|
|
149758
149840
|
this.contextualSetAccessorTags = getJsDocTagsOfDeclarations(filter(this.declarations, isSetAccessor), checker);
|
|
149759
149841
|
}
|
|
149760
149842
|
if (length(this.contextualSetAccessorTags)) {
|
|
@@ -155873,7 +155955,8 @@ var errorCodes19 = [
|
|
|
155873
155955
|
Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha.code,
|
|
155874
155956
|
Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode.code,
|
|
155875
155957
|
Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig.code,
|
|
155876
|
-
Diagnostics.Cannot_find_namespace_0_Did_you_mean_1.code
|
|
155958
|
+
Diagnostics.Cannot_find_namespace_0_Did_you_mean_1.code,
|
|
155959
|
+
Diagnostics.This_JSX_tag_requires_0_to_be_in_scope_but_it_could_not_be_found.code
|
|
155877
155960
|
];
|
|
155878
155961
|
registerCodeFix({
|
|
155879
155962
|
errorCodes: errorCodes19,
|
|
@@ -159195,17 +159278,19 @@ function getParameterType(importAdder, typeNode, scriptTarget) {
|
|
|
159195
159278
|
var fixName2 = "fixCannotFindModule";
|
|
159196
159279
|
var fixIdInstallTypesPackage = "installTypesPackage";
|
|
159197
159280
|
var errorCodeCannotFindModule = Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations.code;
|
|
159281
|
+
var errorCannotFindImplicitJsxImport = Diagnostics.This_JSX_tag_requires_the_module_path_0_to_exist_but_none_could_be_found_Make_sure_you_have_types_for_the_appropriate_package_installed.code;
|
|
159198
159282
|
var errorCodes31 = [
|
|
159199
159283
|
errorCodeCannotFindModule,
|
|
159200
|
-
Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code
|
|
159284
|
+
Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code,
|
|
159285
|
+
errorCannotFindImplicitJsxImport
|
|
159201
159286
|
];
|
|
159202
159287
|
registerCodeFix({
|
|
159203
159288
|
errorCodes: errorCodes31,
|
|
159204
159289
|
getCodeActions: function getCodeActionsToFixNotFoundModule(context) {
|
|
159205
|
-
const { host, sourceFile, span: { start } } = context;
|
|
159206
|
-
const packageName = tryGetImportedPackageName(sourceFile, start);
|
|
159290
|
+
const { host, sourceFile, span: { start }, errorCode } = context;
|
|
159291
|
+
const packageName = errorCode === errorCannotFindImplicitJsxImport ? getJSXImplicitImportBase(context.program.getCompilerOptions(), sourceFile) : tryGetImportedPackageName(sourceFile, start);
|
|
159207
159292
|
if (packageName === void 0) return void 0;
|
|
159208
|
-
const typesPackageName = getTypesPackageNameToInstall(packageName, host,
|
|
159293
|
+
const typesPackageName = getTypesPackageNameToInstall(packageName, host, errorCode);
|
|
159209
159294
|
return typesPackageName === void 0 ? [] : [createCodeFixAction(
|
|
159210
159295
|
fixName2,
|
|
159211
159296
|
/*changes*/
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.7.0-dev.
|
|
5
|
+
"version": "5.7.0-dev.20240926",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -116,5 +116,5 @@
|
|
|
116
116
|
"node": "20.1.0",
|
|
117
117
|
"npm": "8.19.4"
|
|
118
118
|
},
|
|
119
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "3ad0f752482f5e846dc35a69572ccb43311826c0"
|
|
120
120
|
}
|