typescript 5.7.0-dev.20240924 → 5.7.0-dev.20240925
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 +56 -18
- package/lib/typescript.js +64 -23
- package/package.json +2 -2
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.7";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240925`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -6182,6 +6182,8 @@ var Diagnostics = {
|
|
|
6182
6182
|
),
|
|
6183
6183
|
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."),
|
|
6184
6184
|
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."),
|
|
6185
|
+
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}'.`),
|
|
6186
|
+
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}'."),
|
|
6185
6187
|
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."),
|
|
6186
6188
|
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."),
|
|
6187
6189
|
Call_signature_return_types_0_and_1_are_incompatible: diag(
|
|
@@ -6753,6 +6755,8 @@ var Diagnostics = {
|
|
|
6753
6755
|
This_expression_is_always_nullish: diag(2871, 1 /* Error */, "This_expression_is_always_nullish_2871", "This expression is always nullish."),
|
|
6754
6756
|
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."),
|
|
6755
6757
|
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."),
|
|
6758
|
+
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."),
|
|
6759
|
+
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."),
|
|
6756
6760
|
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}'."),
|
|
6757
6761
|
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}'."),
|
|
6758
6762
|
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}'."),
|
|
@@ -35596,9 +35600,10 @@ function getDeclarationFileExtension(fileName) {
|
|
|
35596
35600
|
return standardExtension;
|
|
35597
35601
|
}
|
|
35598
35602
|
if (fileExtensionIs(fileName, ".ts" /* Ts */)) {
|
|
35599
|
-
const
|
|
35603
|
+
const baseName = getBaseFileName(fileName);
|
|
35604
|
+
const index = baseName.lastIndexOf(".d.");
|
|
35600
35605
|
if (index >= 0) {
|
|
35601
|
-
return
|
|
35606
|
+
return baseName.substring(index);
|
|
35602
35607
|
}
|
|
35603
35608
|
}
|
|
35604
35609
|
return void 0;
|
|
@@ -47820,10 +47825,19 @@ function createTypeChecker(host) {
|
|
|
47820
47825
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
47821
47826
|
return usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */;
|
|
47822
47827
|
}
|
|
47823
|
-
function isOnlyImportableAsDefault(usage) {
|
|
47828
|
+
function isOnlyImportableAsDefault(usage, resolvedModule) {
|
|
47824
47829
|
if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
47825
47830
|
const usageMode = getEmitSyntaxForModuleSpecifierExpression(usage);
|
|
47826
|
-
|
|
47831
|
+
if (usageMode === 99 /* ESNext */) {
|
|
47832
|
+
resolvedModule ?? (resolvedModule = resolveExternalModuleName(
|
|
47833
|
+
usage,
|
|
47834
|
+
usage,
|
|
47835
|
+
/*ignoreErrors*/
|
|
47836
|
+
true
|
|
47837
|
+
));
|
|
47838
|
+
const targetFile = resolvedModule && getSourceFileOfModule(resolvedModule);
|
|
47839
|
+
return targetFile && (isJsonSourceFile(targetFile) || getDeclarationFileExtension(targetFile.fileName) === ".d.json.ts");
|
|
47840
|
+
}
|
|
47827
47841
|
}
|
|
47828
47842
|
return false;
|
|
47829
47843
|
}
|
|
@@ -47894,7 +47908,7 @@ function createTypeChecker(host) {
|
|
|
47894
47908
|
if (!specifier) {
|
|
47895
47909
|
return exportDefaultSymbol;
|
|
47896
47910
|
}
|
|
47897
|
-
const hasDefaultOnly = isOnlyImportableAsDefault(specifier);
|
|
47911
|
+
const hasDefaultOnly = isOnlyImportableAsDefault(specifier, moduleSymbol);
|
|
47898
47912
|
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
|
47899
47913
|
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
47900
47914
|
if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
|
|
@@ -48096,12 +48110,14 @@ function createTypeChecker(host) {
|
|
|
48096
48110
|
let symbolFromModule = getExportOfModule(targetSymbol, nameText, specifier, dontResolveAlias);
|
|
48097
48111
|
if (symbolFromModule === void 0 && nameText === "default" /* Default */) {
|
|
48098
48112
|
const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
|
48099
|
-
if (isOnlyImportableAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
48113
|
+
if (isOnlyImportableAsDefault(moduleSpecifier, moduleSymbol) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
48100
48114
|
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
48101
48115
|
}
|
|
48102
48116
|
}
|
|
48103
48117
|
const symbol = symbolFromModule && symbolFromVariable && symbolFromModule !== symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable;
|
|
48104
|
-
if (
|
|
48118
|
+
if (isImportOrExportSpecifier(specifier) && isOnlyImportableAsDefault(moduleSpecifier, moduleSymbol) && nameText !== "default" /* Default */) {
|
|
48119
|
+
error(name, Diagnostics.Named_imports_from_a_JSON_file_into_an_ECMAScript_module_are_not_allowed_when_module_is_set_to_0, ModuleKind[moduleKind]);
|
|
48120
|
+
} else if (!symbol) {
|
|
48105
48121
|
errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name);
|
|
48106
48122
|
}
|
|
48107
48123
|
return symbol;
|
|
@@ -70482,7 +70498,7 @@ function createTypeChecker(host) {
|
|
|
70482
70498
|
}
|
|
70483
70499
|
function markJsxAliasReferenced(node) {
|
|
70484
70500
|
if (!getJsxNamespaceContainerForImplicitImport(node)) {
|
|
70485
|
-
const jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? Diagnostics.
|
|
70501
|
+
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;
|
|
70486
70502
|
const jsxFactoryNamespace = getJsxNamespace(node);
|
|
70487
70503
|
const jsxFactoryLocation = isJsxOpeningLikeElement(node) ? node.tagName : node;
|
|
70488
70504
|
let jsxFactorySym;
|
|
@@ -73192,7 +73208,7 @@ function createTypeChecker(host) {
|
|
|
73192
73208
|
return void 0;
|
|
73193
73209
|
}
|
|
73194
73210
|
const isClassic = getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */;
|
|
73195
|
-
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.
|
|
73211
|
+
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;
|
|
73196
73212
|
const specifier = getJSXRuntimeImportSpecifier(file, runtimeImportSpecifier);
|
|
73197
73213
|
const mod = resolveExternalModule(specifier || location, runtimeImportSpecifier, errorMessage, location);
|
|
73198
73214
|
const result = mod && mod !== unknownSymbol ? getMergedSymbol(resolveSymbol(mod)) : void 0;
|
|
@@ -84619,6 +84635,7 @@ function createTypeChecker(host) {
|
|
|
84619
84635
|
grammarErrorOnFirstToken(node, Diagnostics.An_import_declaration_cannot_have_modifiers);
|
|
84620
84636
|
}
|
|
84621
84637
|
if (checkExternalImportOrExportDeclaration(node)) {
|
|
84638
|
+
let resolvedModule;
|
|
84622
84639
|
const importClause = node.importClause;
|
|
84623
84640
|
if (importClause && !checkGrammarImportClause(importClause)) {
|
|
84624
84641
|
if (importClause.name) {
|
|
@@ -84631,18 +84648,27 @@ function createTypeChecker(host) {
|
|
|
84631
84648
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
84632
84649
|
}
|
|
84633
84650
|
} else {
|
|
84634
|
-
|
|
84635
|
-
if (
|
|
84651
|
+
resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier);
|
|
84652
|
+
if (resolvedModule) {
|
|
84636
84653
|
forEach(importClause.namedBindings.elements, checkImportBinding);
|
|
84637
84654
|
}
|
|
84638
84655
|
}
|
|
84639
84656
|
}
|
|
84657
|
+
if (isOnlyImportableAsDefault(node.moduleSpecifier, resolvedModule) && !hasTypeJsonImportAttribute(node)) {
|
|
84658
|
+
error(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]);
|
|
84659
|
+
}
|
|
84640
84660
|
} else if (noUncheckedSideEffectImports && !importClause) {
|
|
84641
84661
|
void resolveExternalModuleName(node, node.moduleSpecifier);
|
|
84642
84662
|
}
|
|
84643
84663
|
}
|
|
84644
84664
|
checkImportAttributes(node);
|
|
84645
84665
|
}
|
|
84666
|
+
function hasTypeJsonImportAttribute(node) {
|
|
84667
|
+
return !!node.attributes && node.attributes.elements.some((attr) => {
|
|
84668
|
+
var _a;
|
|
84669
|
+
return getTextOfIdentifierOrLiteral(attr.name) === "type" && ((_a = tryCast(attr.value, isStringLiteralLike)) == null ? void 0 : _a.text) === "json";
|
|
84670
|
+
});
|
|
84671
|
+
}
|
|
84646
84672
|
function checkImportEqualsDeclaration(node) {
|
|
84647
84673
|
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)) {
|
|
84648
84674
|
return;
|
|
@@ -85759,7 +85785,7 @@ function createTypeChecker(host) {
|
|
|
85759
85785
|
} else if (isJSDocMemberName(name)) {
|
|
85760
85786
|
return resolveJSDocMemberName(name);
|
|
85761
85787
|
}
|
|
85762
|
-
} else if (isTypeReferenceIdentifier(name)) {
|
|
85788
|
+
} else if (isEntityName(name) && isTypeReferenceIdentifier(name)) {
|
|
85763
85789
|
const meaning = name.parent.kind === 183 /* TypeReference */ ? 788968 /* Type */ : 1920 /* Namespace */;
|
|
85764
85790
|
const symbol = resolveEntityName(
|
|
85765
85791
|
name,
|
|
@@ -120921,7 +120947,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120921
120947
|
return (_a2 = resolvedTypeReferenceDirectiveNames == null ? void 0 : resolvedTypeReferenceDirectiveNames.get(file.path)) == null ? void 0 : _a2.get(typeDirectiveName, mode);
|
|
120922
120948
|
}
|
|
120923
120949
|
function getResolvedTypeReferenceDirectiveFromTypeReferenceDirective(typeRef, sourceFile) {
|
|
120924
|
-
return getResolvedTypeReferenceDirective(
|
|
120950
|
+
return getResolvedTypeReferenceDirective(
|
|
120951
|
+
sourceFile,
|
|
120952
|
+
typeRef.fileName,
|
|
120953
|
+
getModeForTypeReferenceDirectiveInFile(typeRef, sourceFile)
|
|
120954
|
+
);
|
|
120925
120955
|
}
|
|
120926
120956
|
function forEachResolvedModule(callback, file) {
|
|
120927
120957
|
forEachResolution(resolvedModules, callback, file);
|
|
@@ -121308,10 +121338,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121308
121338
|
const moduleNames = getModuleNames(newSourceFile);
|
|
121309
121339
|
const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
121310
121340
|
(resolvedModulesProcessing ?? (resolvedModulesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, resolutions);
|
|
121341
|
+
const optionsForFile = getCompilerOptionsForFile(newSourceFile);
|
|
121311
121342
|
const resolutionsChanged = hasChangesInResolutions(
|
|
121312
121343
|
moduleNames,
|
|
121313
121344
|
resolutions,
|
|
121314
|
-
(name) => oldProgram.getResolvedModule(newSourceFile, name.text,
|
|
121345
|
+
(name) => oldProgram.getResolvedModule(newSourceFile, name.text, getModeForUsageLocationWorker(newSourceFile, name, optionsForFile)),
|
|
121315
121346
|
moduleResolutionIsEqualTo
|
|
121316
121347
|
);
|
|
121317
121348
|
if (resolutionsChanged) structureIsReused = 1 /* SafeModules */;
|
|
@@ -121321,7 +121352,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121321
121352
|
const typeReferenceResolutionsChanged = hasChangesInResolutions(
|
|
121322
121353
|
typesReferenceDirectives,
|
|
121323
121354
|
typeReferenceResolutions,
|
|
121324
|
-
(name) => oldProgram.getResolvedTypeReferenceDirective(
|
|
121355
|
+
(name) => oldProgram.getResolvedTypeReferenceDirective(
|
|
121356
|
+
newSourceFile,
|
|
121357
|
+
getTypeReferenceResolutionName(name),
|
|
121358
|
+
getModeForTypeReferenceDirectiveInFile(name, newSourceFile)
|
|
121359
|
+
),
|
|
121325
121360
|
typeDirectiveIsEqualTo
|
|
121326
121361
|
);
|
|
121327
121362
|
if (typeReferenceResolutionsChanged) structureIsReused = 1 /* SafeModules */;
|
|
@@ -122482,8 +122517,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122482
122517
|
const ref = file.typeReferenceDirectives[index];
|
|
122483
122518
|
const resolvedTypeReferenceDirective = resolutions[index];
|
|
122484
122519
|
const fileName = ref.fileName;
|
|
122485
|
-
|
|
122486
|
-
|
|
122520
|
+
const mode = getModeForTypeReferenceDirectiveInFile(ref, file);
|
|
122521
|
+
resolutionsInFile.set(fileName, mode, resolvedTypeReferenceDirective);
|
|
122487
122522
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: 5 /* TypeReferenceDirective */, file: file.path, index });
|
|
122488
122523
|
}
|
|
122489
122524
|
}
|
|
@@ -123527,6 +123562,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123527
123562
|
function shouldTransformImportCall(sourceFile) {
|
|
123528
123563
|
return shouldTransformImportCallWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
123529
123564
|
}
|
|
123565
|
+
function getModeForTypeReferenceDirectiveInFile(ref, sourceFile) {
|
|
123566
|
+
return ref.resolutionMode || getDefaultResolutionModeForFile2(sourceFile);
|
|
123567
|
+
}
|
|
123530
123568
|
}
|
|
123531
123569
|
function shouldTransformImportCallWorker(sourceFile, options) {
|
|
123532
123570
|
const moduleKind = getEmitModuleKind(options);
|
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.20240925`;
|
|
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;
|
|
@@ -75078,7 +75094,7 @@ function createTypeChecker(host) {
|
|
|
75078
75094
|
}
|
|
75079
75095
|
function markJsxAliasReferenced(node) {
|
|
75080
75096
|
if (!getJsxNamespaceContainerForImplicitImport(node)) {
|
|
75081
|
-
const jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? Diagnostics.
|
|
75097
|
+
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
75098
|
const jsxFactoryNamespace = getJsxNamespace(node);
|
|
75083
75099
|
const jsxFactoryLocation = isJsxOpeningLikeElement(node) ? node.tagName : node;
|
|
75084
75100
|
let jsxFactorySym;
|
|
@@ -77788,7 +77804,7 @@ function createTypeChecker(host) {
|
|
|
77788
77804
|
return void 0;
|
|
77789
77805
|
}
|
|
77790
77806
|
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.
|
|
77807
|
+
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
77808
|
const specifier = getJSXRuntimeImportSpecifier(file, runtimeImportSpecifier);
|
|
77793
77809
|
const mod = resolveExternalModule(specifier || location, runtimeImportSpecifier, errorMessage, location);
|
|
77794
77810
|
const result = mod && mod !== unknownSymbol ? getMergedSymbol(resolveSymbol(mod)) : void 0;
|
|
@@ -89215,6 +89231,7 @@ function createTypeChecker(host) {
|
|
|
89215
89231
|
grammarErrorOnFirstToken(node, Diagnostics.An_import_declaration_cannot_have_modifiers);
|
|
89216
89232
|
}
|
|
89217
89233
|
if (checkExternalImportOrExportDeclaration(node)) {
|
|
89234
|
+
let resolvedModule;
|
|
89218
89235
|
const importClause = node.importClause;
|
|
89219
89236
|
if (importClause && !checkGrammarImportClause(importClause)) {
|
|
89220
89237
|
if (importClause.name) {
|
|
@@ -89227,18 +89244,27 @@ function createTypeChecker(host) {
|
|
|
89227
89244
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
89228
89245
|
}
|
|
89229
89246
|
} else {
|
|
89230
|
-
|
|
89231
|
-
if (
|
|
89247
|
+
resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier);
|
|
89248
|
+
if (resolvedModule) {
|
|
89232
89249
|
forEach(importClause.namedBindings.elements, checkImportBinding);
|
|
89233
89250
|
}
|
|
89234
89251
|
}
|
|
89235
89252
|
}
|
|
89253
|
+
if (isOnlyImportableAsDefault(node.moduleSpecifier, resolvedModule) && !hasTypeJsonImportAttribute(node)) {
|
|
89254
|
+
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]);
|
|
89255
|
+
}
|
|
89236
89256
|
} else if (noUncheckedSideEffectImports && !importClause) {
|
|
89237
89257
|
void resolveExternalModuleName(node, node.moduleSpecifier);
|
|
89238
89258
|
}
|
|
89239
89259
|
}
|
|
89240
89260
|
checkImportAttributes(node);
|
|
89241
89261
|
}
|
|
89262
|
+
function hasTypeJsonImportAttribute(node) {
|
|
89263
|
+
return !!node.attributes && node.attributes.elements.some((attr) => {
|
|
89264
|
+
var _a;
|
|
89265
|
+
return getTextOfIdentifierOrLiteral(attr.name) === "type" && ((_a = tryCast(attr.value, isStringLiteralLike)) == null ? void 0 : _a.text) === "json";
|
|
89266
|
+
});
|
|
89267
|
+
}
|
|
89242
89268
|
function checkImportEqualsDeclaration(node) {
|
|
89243
89269
|
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
89270
|
return;
|
|
@@ -90355,7 +90381,7 @@ function createTypeChecker(host) {
|
|
|
90355
90381
|
} else if (isJSDocMemberName(name)) {
|
|
90356
90382
|
return resolveJSDocMemberName(name);
|
|
90357
90383
|
}
|
|
90358
|
-
} else if (isTypeReferenceIdentifier(name)) {
|
|
90384
|
+
} else if (isEntityName(name) && isTypeReferenceIdentifier(name)) {
|
|
90359
90385
|
const meaning = name.parent.kind === 183 /* TypeReference */ ? 788968 /* Type */ : 1920 /* Namespace */;
|
|
90360
90386
|
const symbol = resolveEntityName(
|
|
90361
90387
|
name,
|
|
@@ -125756,7 +125782,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
125756
125782
|
return (_a2 = resolvedTypeReferenceDirectiveNames == null ? void 0 : resolvedTypeReferenceDirectiveNames.get(file.path)) == null ? void 0 : _a2.get(typeDirectiveName, mode);
|
|
125757
125783
|
}
|
|
125758
125784
|
function getResolvedTypeReferenceDirectiveFromTypeReferenceDirective(typeRef, sourceFile) {
|
|
125759
|
-
return getResolvedTypeReferenceDirective(
|
|
125785
|
+
return getResolvedTypeReferenceDirective(
|
|
125786
|
+
sourceFile,
|
|
125787
|
+
typeRef.fileName,
|
|
125788
|
+
getModeForTypeReferenceDirectiveInFile(typeRef, sourceFile)
|
|
125789
|
+
);
|
|
125760
125790
|
}
|
|
125761
125791
|
function forEachResolvedModule(callback, file) {
|
|
125762
125792
|
forEachResolution(resolvedModules, callback, file);
|
|
@@ -126143,10 +126173,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
126143
126173
|
const moduleNames = getModuleNames(newSourceFile);
|
|
126144
126174
|
const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
126145
126175
|
(resolvedModulesProcessing ?? (resolvedModulesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, resolutions);
|
|
126176
|
+
const optionsForFile = getCompilerOptionsForFile(newSourceFile);
|
|
126146
126177
|
const resolutionsChanged = hasChangesInResolutions(
|
|
126147
126178
|
moduleNames,
|
|
126148
126179
|
resolutions,
|
|
126149
|
-
(name) => oldProgram.getResolvedModule(newSourceFile, name.text,
|
|
126180
|
+
(name) => oldProgram.getResolvedModule(newSourceFile, name.text, getModeForUsageLocationWorker(newSourceFile, name, optionsForFile)),
|
|
126150
126181
|
moduleResolutionIsEqualTo
|
|
126151
126182
|
);
|
|
126152
126183
|
if (resolutionsChanged) structureIsReused = 1 /* SafeModules */;
|
|
@@ -126156,7 +126187,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
126156
126187
|
const typeReferenceResolutionsChanged = hasChangesInResolutions(
|
|
126157
126188
|
typesReferenceDirectives,
|
|
126158
126189
|
typeReferenceResolutions,
|
|
126159
|
-
(name) => oldProgram.getResolvedTypeReferenceDirective(
|
|
126190
|
+
(name) => oldProgram.getResolvedTypeReferenceDirective(
|
|
126191
|
+
newSourceFile,
|
|
126192
|
+
getTypeReferenceResolutionName(name),
|
|
126193
|
+
getModeForTypeReferenceDirectiveInFile(name, newSourceFile)
|
|
126194
|
+
),
|
|
126160
126195
|
typeDirectiveIsEqualTo
|
|
126161
126196
|
);
|
|
126162
126197
|
if (typeReferenceResolutionsChanged) structureIsReused = 1 /* SafeModules */;
|
|
@@ -127317,8 +127352,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
127317
127352
|
const ref = file.typeReferenceDirectives[index];
|
|
127318
127353
|
const resolvedTypeReferenceDirective = resolutions[index];
|
|
127319
127354
|
const fileName = ref.fileName;
|
|
127320
|
-
|
|
127321
|
-
|
|
127355
|
+
const mode = getModeForTypeReferenceDirectiveInFile(ref, file);
|
|
127356
|
+
resolutionsInFile.set(fileName, mode, resolvedTypeReferenceDirective);
|
|
127322
127357
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: 5 /* TypeReferenceDirective */, file: file.path, index });
|
|
127323
127358
|
}
|
|
127324
127359
|
}
|
|
@@ -128362,6 +128397,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
128362
128397
|
function shouldTransformImportCall(sourceFile) {
|
|
128363
128398
|
return shouldTransformImportCallWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
128364
128399
|
}
|
|
128400
|
+
function getModeForTypeReferenceDirectiveInFile(ref, sourceFile) {
|
|
128401
|
+
return ref.resolutionMode || getDefaultResolutionModeForFile2(sourceFile);
|
|
128402
|
+
}
|
|
128365
128403
|
}
|
|
128366
128404
|
function shouldTransformImportCallWorker(sourceFile, options) {
|
|
128367
128405
|
const moduleKind = getEmitModuleKind(options);
|
|
@@ -155873,7 +155911,8 @@ var errorCodes19 = [
|
|
|
155873
155911
|
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
155912
|
Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode.code,
|
|
155875
155913
|
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
|
|
155914
|
+
Diagnostics.Cannot_find_namespace_0_Did_you_mean_1.code,
|
|
155915
|
+
Diagnostics.This_JSX_tag_requires_0_to_be_in_scope_but_it_could_not_be_found.code
|
|
155877
155916
|
];
|
|
155878
155917
|
registerCodeFix({
|
|
155879
155918
|
errorCodes: errorCodes19,
|
|
@@ -159195,17 +159234,19 @@ function getParameterType(importAdder, typeNode, scriptTarget) {
|
|
|
159195
159234
|
var fixName2 = "fixCannotFindModule";
|
|
159196
159235
|
var fixIdInstallTypesPackage = "installTypesPackage";
|
|
159197
159236
|
var errorCodeCannotFindModule = Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations.code;
|
|
159237
|
+
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
159238
|
var errorCodes31 = [
|
|
159199
159239
|
errorCodeCannotFindModule,
|
|
159200
|
-
Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code
|
|
159240
|
+
Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code,
|
|
159241
|
+
errorCannotFindImplicitJsxImport
|
|
159201
159242
|
];
|
|
159202
159243
|
registerCodeFix({
|
|
159203
159244
|
errorCodes: errorCodes31,
|
|
159204
159245
|
getCodeActions: function getCodeActionsToFixNotFoundModule(context) {
|
|
159205
|
-
const { host, sourceFile, span: { start } } = context;
|
|
159206
|
-
const packageName = tryGetImportedPackageName(sourceFile, start);
|
|
159246
|
+
const { host, sourceFile, span: { start }, errorCode } = context;
|
|
159247
|
+
const packageName = errorCode === errorCannotFindImplicitJsxImport ? getJSXImplicitImportBase(context.program.getCompilerOptions(), sourceFile) : tryGetImportedPackageName(sourceFile, start);
|
|
159207
159248
|
if (packageName === void 0) return void 0;
|
|
159208
|
-
const typesPackageName = getTypesPackageNameToInstall(packageName, host,
|
|
159249
|
+
const typesPackageName = getTypesPackageNameToInstall(packageName, host, errorCode);
|
|
159209
159250
|
return typesPackageName === void 0 ? [] : [createCodeFixAction(
|
|
159210
159251
|
fixName2,
|
|
159211
159252
|
/*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.20240925",
|
|
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": "e962037df334de071b8d3a9c70b13e3a600d1bc9"
|
|
120
120
|
}
|