typescript 4.7.1-rc → 4.7.4
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 +88 -40
- package/lib/tsserver.js +160 -74
- package/lib/tsserverlibrary.d.ts +26 -0
- package/lib/tsserverlibrary.js +160 -74
- package/lib/typescript.d.ts +26 -0
- package/lib/typescript.js +160 -74
- package/lib/typescriptServices.d.ts +26 -0
- package/lib/typescriptServices.js +160 -74
- package/lib/typingsInstaller.js +108 -44
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.7";
|
|
72
|
-
ts.version = "
|
|
72
|
+
ts.version = "4.7.4";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -5573,7 +5573,7 @@ var ts;
|
|
|
5573
5573
|
Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed: diag(1449, ts.DiagnosticCategory.Message, "Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed_1449", "Preserve unused imported values in the JavaScript output that would otherwise be removed."),
|
|
5574
5574
|
Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments: diag(1450, ts.DiagnosticCategory.Message, "Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments_1450", "Dynamic imports can only accept a module specifier and an optional assertion as arguments"),
|
|
5575
5575
|
Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression: diag(1451, ts.DiagnosticCategory.Error, "Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member__1451", "Private identifiers are only allowed in class bodies and may only be used as part of a class member declaration, property access, or on the left-hand-side of an 'in' expression"),
|
|
5576
|
-
|
|
5576
|
+
resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext: diag(1452, ts.DiagnosticCategory.Error, "resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext_1452", "'resolution-mode' assertions are only supported when `moduleResolution` is `node16` or `nodenext`."),
|
|
5577
5577
|
resolution_mode_should_be_either_require_or_import: diag(1453, ts.DiagnosticCategory.Error, "resolution_mode_should_be_either_require_or_import_1453", "`resolution-mode` should be either `require` or `import`."),
|
|
5578
5578
|
resolution_mode_can_only_be_set_for_type_only_imports: diag(1454, ts.DiagnosticCategory.Error, "resolution_mode_can_only_be_set_for_type_only_imports_1454", "`resolution-mode` can only be set for type-only imports."),
|
|
5579
5579
|
resolution_mode_is_the_only_valid_key_for_type_import_assertions: diag(1455, ts.DiagnosticCategory.Error, "resolution_mode_is_the_only_valid_key_for_type_import_assertions_1455", "`resolution-mode` is the only valid key for type import assertions."),
|
|
@@ -6077,6 +6077,7 @@ var ts;
|
|
|
6077
6077
|
Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls: diag(2836, ts.DiagnosticCategory.Error, "Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls_2836", "Import assertions are not allowed on statements that transpile to commonjs 'require' calls."),
|
|
6078
6078
|
Import_assertion_values_must_be_string_literal_expressions: diag(2837, ts.DiagnosticCategory.Error, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
|
|
6079
6079
|
All_declarations_of_0_must_have_identical_constraints: diag(2838, ts.DiagnosticCategory.Error, "All_declarations_of_0_must_have_identical_constraints_2838", "All declarations of '{0}' must have identical constraints."),
|
|
6080
|
+
The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_feature_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(2841, ts.DiagnosticCategory.Error, "The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_2841", "The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
|
|
6080
6081
|
Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
6081
6082
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.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}'."),
|
|
6082
6083
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.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}'."),
|
|
@@ -6184,7 +6185,7 @@ var ts;
|
|
|
6184
6185
|
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0: diag(4122, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4122", "This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class '{0}'."),
|
|
6185
6186
|
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4123, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4123", "This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
|
|
6186
6187
|
Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4124, ts.DiagnosticCategory.Error, "Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124", "Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
|
|
6187
|
-
|
|
6188
|
+
resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4125, ts.DiagnosticCategory.Error, "resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_wi_4125", "'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
|
|
6188
6189
|
The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
|
|
6189
6190
|
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
|
|
6190
6191
|
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
|
|
@@ -12408,6 +12409,8 @@ var ts;
|
|
|
12408
12409
|
case 218:
|
|
12409
12410
|
case 231:
|
|
12410
12411
|
return true;
|
|
12412
|
+
case 228:
|
|
12413
|
+
return !ts.isHeritageClause(node.parent);
|
|
12411
12414
|
case 161:
|
|
12412
12415
|
while (node.parent.kind === 161) {
|
|
12413
12416
|
node = node.parent;
|
|
@@ -12571,9 +12574,6 @@ var ts;
|
|
|
12571
12574
|
}
|
|
12572
12575
|
ts.isVariableDeclarationInitializedToBareOrAccessedRequire = isVariableDeclarationInitializedToBareOrAccessedRequire;
|
|
12573
12576
|
function isVariableDeclarationInitializedWithRequireHelper(node, allowAccessedRequire) {
|
|
12574
|
-
if (node.kind === 203) {
|
|
12575
|
-
node = node.parent.parent;
|
|
12576
|
-
}
|
|
12577
12577
|
return ts.isVariableDeclaration(node) &&
|
|
12578
12578
|
!!node.initializer &&
|
|
12579
12579
|
isRequireCall(allowAccessedRequire ? getLeftmostAccessExpression(node.initializer) : node.initializer, true);
|
|
@@ -15843,13 +15843,13 @@ var ts;
|
|
|
15843
15843
|
return !file.isDeclarationFile ? walkTreeForJSXTags(file) : undefined;
|
|
15844
15844
|
}
|
|
15845
15845
|
function isFileForcedToBeModuleByFormat(file) {
|
|
15846
|
-
return file.impliedNodeFormat === ts.ModuleKind.ESNext && !file.isDeclarationFile ? true : undefined;
|
|
15846
|
+
return (file.impliedNodeFormat === ts.ModuleKind.ESNext || (ts.fileExtensionIsOneOf(file.fileName, [".cjs", ".cts"]))) && !file.isDeclarationFile ? true : undefined;
|
|
15847
15847
|
}
|
|
15848
15848
|
function getSetExternalModuleIndicator(options) {
|
|
15849
15849
|
switch (getEmitModuleDetectionKind(options)) {
|
|
15850
15850
|
case ts.ModuleDetectionKind.Force:
|
|
15851
15851
|
return function (file) {
|
|
15852
|
-
file.externalModuleIndicator = !file.isDeclarationFile ||
|
|
15852
|
+
file.externalModuleIndicator = ts.isFileProbablyExternalModule(file) || !file.isDeclarationFile || undefined;
|
|
15853
15853
|
};
|
|
15854
15854
|
case ts.ModuleDetectionKind.Legacy:
|
|
15855
15855
|
return function (file) {
|
|
@@ -15905,7 +15905,8 @@ var ts;
|
|
|
15905
15905
|
}
|
|
15906
15906
|
ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;
|
|
15907
15907
|
function getEmitModuleDetectionKind(options) {
|
|
15908
|
-
return options.moduleDetection ||
|
|
15908
|
+
return options.moduleDetection ||
|
|
15909
|
+
(getEmitModuleKind(options) === ts.ModuleKind.Node16 || getEmitModuleKind(options) === ts.ModuleKind.NodeNext ? ts.ModuleDetectionKind.Force : ts.ModuleDetectionKind.Auto);
|
|
15909
15910
|
}
|
|
15910
15911
|
ts.getEmitModuleDetectionKind = getEmitModuleDetectionKind;
|
|
15911
15912
|
function hasJsonModuleEmitEnabled(options) {
|
|
@@ -23341,6 +23342,10 @@ var ts;
|
|
|
23341
23342
|
return node.kind === 267;
|
|
23342
23343
|
}
|
|
23343
23344
|
ts.isImportClause = isImportClause;
|
|
23345
|
+
function isImportTypeAssertionContainer(node) {
|
|
23346
|
+
return node.kind === 295;
|
|
23347
|
+
}
|
|
23348
|
+
ts.isImportTypeAssertionContainer = isImportTypeAssertionContainer;
|
|
23344
23349
|
function isAssertClause(node) {
|
|
23345
23350
|
return node.kind === 293;
|
|
23346
23351
|
}
|
|
@@ -28442,9 +28447,10 @@ var ts;
|
|
|
28442
28447
|
}
|
|
28443
28448
|
nextToken();
|
|
28444
28449
|
var typeArguments = parseDelimitedList(20, parseType);
|
|
28445
|
-
if (
|
|
28450
|
+
if (reScanGreaterToken() !== 31) {
|
|
28446
28451
|
return undefined;
|
|
28447
28452
|
}
|
|
28453
|
+
nextToken();
|
|
28448
28454
|
return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined;
|
|
28449
28455
|
}
|
|
28450
28456
|
function canFollowTypeArgumentsInExpression() {
|
|
@@ -34231,7 +34237,7 @@ var ts;
|
|
|
34231
34237
|
}
|
|
34232
34238
|
if (ts.isImplicitGlob(spec.substring(spec.lastIndexOf(ts.directorySeparator) + 1))) {
|
|
34233
34239
|
return {
|
|
34234
|
-
key: useCaseSensitiveFileNames ? spec : ts.toFileNameLowerCase(spec),
|
|
34240
|
+
key: ts.removeTrailingDirectorySeparator(useCaseSensitiveFileNames ? spec : ts.toFileNameLowerCase(spec)),
|
|
34235
34241
|
flags: 1
|
|
34236
34242
|
};
|
|
34237
34243
|
}
|
|
@@ -35164,15 +35170,19 @@ var ts;
|
|
|
35164
35170
|
function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
35165
35171
|
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.NodeNextDefault, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
35166
35172
|
}
|
|
35167
|
-
function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
35168
|
-
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
35169
|
-
var esmMode = resolutionMode === ts.ModuleKind.ESNext ? NodeResolutionFeatures.EsmMode : 0;
|
|
35170
|
-
return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions, redirectedReference);
|
|
35171
|
-
}
|
|
35172
35173
|
var jsOnlyExtensions = [Extensions.JavaScript];
|
|
35173
35174
|
var tsExtensions = [Extensions.TypeScript, Extensions.JavaScript];
|
|
35174
35175
|
var tsPlusJsonExtensions = __spreadArray(__spreadArray([], tsExtensions, true), [Extensions.Json], false);
|
|
35175
35176
|
var tsconfigExtensions = [Extensions.TSConfig];
|
|
35177
|
+
function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
35178
|
+
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
35179
|
+
var esmMode = resolutionMode === ts.ModuleKind.ESNext ? NodeResolutionFeatures.EsmMode : 0;
|
|
35180
|
+
var extensions = compilerOptions.noDtsResolution ? [Extensions.TsOnly, Extensions.JavaScript] : tsExtensions;
|
|
35181
|
+
if (compilerOptions.resolveJsonModule) {
|
|
35182
|
+
extensions = __spreadArray(__spreadArray([], extensions, true), [Extensions.Json], false);
|
|
35183
|
+
}
|
|
35184
|
+
return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference);
|
|
35185
|
+
}
|
|
35176
35186
|
function tryResolveJSModuleWorker(moduleName, initialDir, host) {
|
|
35177
35187
|
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, undefined, jsOnlyExtensions, undefined);
|
|
35178
35188
|
}
|
|
@@ -35795,13 +35805,32 @@ var ts;
|
|
|
35795
35805
|
}
|
|
35796
35806
|
return toSearchResult(undefined);
|
|
35797
35807
|
}
|
|
35808
|
+
function comparePatternKeys(a, b) {
|
|
35809
|
+
var aPatternIndex = a.indexOf("*");
|
|
35810
|
+
var bPatternIndex = b.indexOf("*");
|
|
35811
|
+
var baseLenA = aPatternIndex === -1 ? a.length : aPatternIndex + 1;
|
|
35812
|
+
var baseLenB = bPatternIndex === -1 ? b.length : bPatternIndex + 1;
|
|
35813
|
+
if (baseLenA > baseLenB)
|
|
35814
|
+
return -1;
|
|
35815
|
+
if (baseLenB > baseLenA)
|
|
35816
|
+
return 1;
|
|
35817
|
+
if (aPatternIndex === -1)
|
|
35818
|
+
return 1;
|
|
35819
|
+
if (bPatternIndex === -1)
|
|
35820
|
+
return -1;
|
|
35821
|
+
if (a.length > b.length)
|
|
35822
|
+
return -1;
|
|
35823
|
+
if (b.length > a.length)
|
|
35824
|
+
return 1;
|
|
35825
|
+
return 0;
|
|
35826
|
+
}
|
|
35798
35827
|
function loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
|
|
35799
35828
|
var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
|
|
35800
35829
|
if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) {
|
|
35801
35830
|
var target = lookupTable[moduleName];
|
|
35802
35831
|
return loadModuleFromTargetImportOrExport(target, "", false);
|
|
35803
35832
|
}
|
|
35804
|
-
var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }),
|
|
35833
|
+
var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }), comparePatternKeys);
|
|
35805
35834
|
for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) {
|
|
35806
35835
|
var potentialTarget = expandingKeys_1[_i];
|
|
35807
35836
|
if (state.features & NodeResolutionFeatures.ExportsPatternTrailers && matchesPatternWithTrailer(potentialTarget, moduleName)) {
|
|
@@ -36076,8 +36105,7 @@ var ts;
|
|
|
36076
36105
|
var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
|
|
36077
36106
|
loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
|
|
36078
36107
|
if (!pathAndExtension && packageInfo
|
|
36079
|
-
&& packageInfo.packageJsonContent.exports === undefined
|
|
36080
|
-
&& packageInfo.packageJsonContent.main === undefined
|
|
36108
|
+
&& (packageInfo.packageJsonContent.exports === undefined || packageInfo.packageJsonContent.exports === null)
|
|
36081
36109
|
&& state.features & NodeResolutionFeatures.EsmMode) {
|
|
36082
36110
|
pathAndExtension = loadModuleFromFile(extensions, ts.combinePaths(candidate, "index.js"), onlyRecordFailures, state);
|
|
36083
36111
|
}
|
|
@@ -38452,12 +38480,14 @@ var ts;
|
|
|
38452
38480
|
}
|
|
38453
38481
|
}
|
|
38454
38482
|
function setCommonJsModuleIndicator(node) {
|
|
38455
|
-
if (file.externalModuleIndicator) {
|
|
38483
|
+
if (file.externalModuleIndicator && file.externalModuleIndicator !== true) {
|
|
38456
38484
|
return false;
|
|
38457
38485
|
}
|
|
38458
38486
|
if (!file.commonJsModuleIndicator) {
|
|
38459
38487
|
file.commonJsModuleIndicator = node;
|
|
38460
|
-
|
|
38488
|
+
if (!file.externalModuleIndicator) {
|
|
38489
|
+
bindSourceFileAsExternalModule();
|
|
38490
|
+
}
|
|
38461
38491
|
}
|
|
38462
38492
|
return true;
|
|
38463
38493
|
}
|
|
@@ -38810,7 +38840,11 @@ var ts;
|
|
|
38810
38840
|
checkStrictModeEvalOrArguments(node, node.name);
|
|
38811
38841
|
}
|
|
38812
38842
|
if (!ts.isBindingPattern(node.name)) {
|
|
38813
|
-
|
|
38843
|
+
var possibleVariableDecl = node.kind === 254 ? node : node.parent.parent;
|
|
38844
|
+
if (ts.isInJSFile(node) &&
|
|
38845
|
+
ts.isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) &&
|
|
38846
|
+
!ts.getJSDocTypeTag(node) &&
|
|
38847
|
+
!(ts.getCombinedModifierFlags(node) & 1)) {
|
|
38814
38848
|
declareSymbolAndAddToSymbolTable(node, 2097152, 2097152);
|
|
38815
38849
|
}
|
|
38816
38850
|
else if (ts.isBlockOrCatchScoped(node)) {
|
|
@@ -41123,7 +41157,8 @@ var ts;
|
|
|
41123
41157
|
&& isAliasableOrJsExpression(node.parent.right)
|
|
41124
41158
|
|| node.kind === 297
|
|
41125
41159
|
|| node.kind === 296 && isAliasableOrJsExpression(node.initializer)
|
|
41126
|
-
|| ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)
|
|
41160
|
+
|| node.kind === 254 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)
|
|
41161
|
+
|| node.kind === 203 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent);
|
|
41127
41162
|
}
|
|
41128
41163
|
function isAliasableOrJsExpression(e) {
|
|
41129
41164
|
return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e);
|
|
@@ -41204,7 +41239,7 @@ var ts;
|
|
|
41204
41239
|
if (!ts.isSourceFileJS(file)) {
|
|
41205
41240
|
return hasExportAssignmentSymbol(moduleSymbol);
|
|
41206
41241
|
}
|
|
41207
|
-
return
|
|
41242
|
+
return typeof file.externalModuleIndicator !== "object" && !resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), undefined, dontResolveAlias);
|
|
41208
41243
|
}
|
|
41209
41244
|
function getTargetOfImportClause(node, dontResolveAlias) {
|
|
41210
41245
|
var _a;
|
|
@@ -43994,6 +44029,7 @@ var ts;
|
|
|
43994
44029
|
return symbol.parent ? ts.factory.createQualifiedName(symbolToEntityNameNode(symbol.parent), identifier) : identifier;
|
|
43995
44030
|
}
|
|
43996
44031
|
function symbolToTypeNode(symbol, context, meaning, overrideTypeArguments) {
|
|
44032
|
+
var _a, _b, _c, _d;
|
|
43997
44033
|
var chain = lookupSymbolChain(symbol, context, meaning, !(context.flags & 16384));
|
|
43998
44034
|
var isTypeOf = meaning === 111551;
|
|
43999
44035
|
if (ts.some(chain[0].declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
|
|
@@ -44009,6 +44045,7 @@ var ts;
|
|
|
44009
44045
|
assertion = ts.factory.createImportTypeAssertionContainer(ts.factory.createAssertClause(ts.factory.createNodeArray([
|
|
44010
44046
|
ts.factory.createAssertEntry(ts.factory.createStringLiteral("resolution-mode"), ts.factory.createStringLiteral("import"))
|
|
44011
44047
|
])));
|
|
44048
|
+
(_b = (_a = context.tracker).reportImportTypeNodeResolutionModeOverride) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
44012
44049
|
}
|
|
44013
44050
|
}
|
|
44014
44051
|
if (!specifier) {
|
|
@@ -44026,6 +44063,7 @@ var ts;
|
|
|
44026
44063
|
assertion = ts.factory.createImportTypeAssertionContainer(ts.factory.createAssertClause(ts.factory.createNodeArray([
|
|
44027
44064
|
ts.factory.createAssertEntry(ts.factory.createStringLiteral("resolution-mode"), ts.factory.createStringLiteral(swappedMode === ts.ModuleKind.ESNext ? "import" : "require"))
|
|
44028
44065
|
])));
|
|
44066
|
+
(_d = (_c = context.tracker).reportImportTypeNodeResolutionModeOverride) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
44029
44067
|
}
|
|
44030
44068
|
}
|
|
44031
44069
|
if (!assertion) {
|
|
@@ -48695,7 +48733,7 @@ var ts;
|
|
|
48695
48733
|
var objectType;
|
|
48696
48734
|
return !!(type.flags & 8388608 && ts.getObjectFlags(objectType = type.objectType) & 32 &&
|
|
48697
48735
|
!isGenericMappedType(objectType) && isGenericIndexType(type.indexType) &&
|
|
48698
|
-
!objectType
|
|
48736
|
+
!(getMappedTypeModifiers(objectType) & 8) && !objectType.declaration.nameType);
|
|
48699
48737
|
}
|
|
48700
48738
|
function getApparentType(type) {
|
|
48701
48739
|
var t = !(type.flags & 465829888) ? type : getBaseConstraintOfType(type) || unknownType;
|
|
@@ -48703,9 +48741,9 @@ var ts;
|
|
|
48703
48741
|
t.flags & 2097152 ? getApparentTypeOfIntersectionType(t) :
|
|
48704
48742
|
t.flags & 402653316 ? globalStringType :
|
|
48705
48743
|
t.flags & 296 ? globalNumberType :
|
|
48706
|
-
t.flags & 2112 ? getGlobalBigIntType(
|
|
48744
|
+
t.flags & 2112 ? getGlobalBigIntType() :
|
|
48707
48745
|
t.flags & 528 ? globalBooleanType :
|
|
48708
|
-
t.flags & 12288 ? getGlobalESSymbolType(
|
|
48746
|
+
t.flags & 12288 ? getGlobalESSymbolType() :
|
|
48709
48747
|
t.flags & 67108864 ? emptyObjectType :
|
|
48710
48748
|
t.flags & 4194304 ? keyofConstraintType :
|
|
48711
48749
|
t.flags & 2 && !strictNullChecks ? emptyObjectType :
|
|
@@ -50103,8 +50141,8 @@ var ts;
|
|
|
50103
50141
|
function getGlobalESSymbolConstructorTypeSymbol(reportErrors) {
|
|
50104
50142
|
return deferredGlobalESSymbolConstructorTypeSymbol || (deferredGlobalESSymbolConstructorTypeSymbol = getGlobalTypeSymbol("SymbolConstructor", reportErrors));
|
|
50105
50143
|
}
|
|
50106
|
-
function getGlobalESSymbolType(
|
|
50107
|
-
return (deferredGlobalESSymbolType || (deferredGlobalESSymbolType = getGlobalType("Symbol", 0,
|
|
50144
|
+
function getGlobalESSymbolType() {
|
|
50145
|
+
return (deferredGlobalESSymbolType || (deferredGlobalESSymbolType = getGlobalType("Symbol", 0, false))) || emptyObjectType;
|
|
50108
50146
|
}
|
|
50109
50147
|
function getGlobalPromiseType(reportErrors) {
|
|
50110
50148
|
return (deferredGlobalPromiseType || (deferredGlobalPromiseType = getGlobalType("Promise", 1, reportErrors))) || emptyGenericType;
|
|
@@ -50165,8 +50203,8 @@ var ts;
|
|
|
50165
50203
|
deferredGlobalAwaitedSymbol || (deferredGlobalAwaitedSymbol = getGlobalTypeAliasSymbol("Awaited", 1, reportErrors) || (reportErrors ? unknownSymbol : undefined));
|
|
50166
50204
|
return deferredGlobalAwaitedSymbol === unknownSymbol ? undefined : deferredGlobalAwaitedSymbol;
|
|
50167
50205
|
}
|
|
50168
|
-
function getGlobalBigIntType(
|
|
50169
|
-
return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", 0,
|
|
50206
|
+
function getGlobalBigIntType() {
|
|
50207
|
+
return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", 0, false))) || emptyObjectType;
|
|
50170
50208
|
}
|
|
50171
50209
|
function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) {
|
|
50172
50210
|
return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType;
|
|
@@ -53872,7 +53910,7 @@ var ts;
|
|
|
53872
53910
|
if ((globalStringType === source && stringType === target) ||
|
|
53873
53911
|
(globalNumberType === source && numberType === target) ||
|
|
53874
53912
|
(globalBooleanType === source && booleanType === target) ||
|
|
53875
|
-
(getGlobalESSymbolType(
|
|
53913
|
+
(getGlobalESSymbolType() === source && esSymbolType === target)) {
|
|
53876
53914
|
reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType);
|
|
53877
53915
|
}
|
|
53878
53916
|
}
|
|
@@ -67596,8 +67634,11 @@ var ts;
|
|
|
67596
67634
|
if (node.assertions) {
|
|
67597
67635
|
var override = ts.getResolutionModeOverrideForClause(node.assertions.assertClause, grammarErrorOnNode);
|
|
67598
67636
|
if (override) {
|
|
67637
|
+
if (!ts.isNightly()) {
|
|
67638
|
+
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next);
|
|
67639
|
+
}
|
|
67599
67640
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
67600
|
-
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.
|
|
67641
|
+
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
67601
67642
|
}
|
|
67602
67643
|
}
|
|
67603
67644
|
}
|
|
@@ -68965,7 +69006,7 @@ var ts;
|
|
|
68965
69006
|
return;
|
|
68966
69007
|
}
|
|
68967
69008
|
var symbol = getSymbolOfNode(node);
|
|
68968
|
-
if (symbol.flags & 2097152 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)) {
|
|
69009
|
+
if (symbol.flags & 2097152 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 203 ? node.parent.parent : node)) {
|
|
68969
69010
|
checkAliasSymbol(node);
|
|
68970
69011
|
return;
|
|
68971
69012
|
}
|
|
@@ -69114,7 +69155,7 @@ var ts;
|
|
|
69114
69155
|
if (ts.isIdentifier(childNode)) {
|
|
69115
69156
|
var childSymbol = getSymbolAtLocation(childNode);
|
|
69116
69157
|
if (childSymbol && childSymbol === testedSymbol) {
|
|
69117
|
-
if (ts.isIdentifier(expr)) {
|
|
69158
|
+
if (ts.isIdentifier(expr) || ts.isIdentifier(testedNode) && ts.isBinaryExpression(testedNode.parent)) {
|
|
69118
69159
|
return true;
|
|
69119
69160
|
}
|
|
69120
69161
|
var testedExpression = testedNode.parent;
|
|
@@ -71217,10 +71258,10 @@ var ts;
|
|
|
71217
71258
|
var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
|
|
71218
71259
|
if (validForTypeAssertions && override) {
|
|
71219
71260
|
if (!ts.isNightly()) {
|
|
71220
|
-
grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
71261
|
+
grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next);
|
|
71221
71262
|
}
|
|
71222
71263
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
71223
|
-
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
71264
|
+
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
71224
71265
|
}
|
|
71225
71266
|
return;
|
|
71226
71267
|
}
|
|
@@ -88352,7 +88393,8 @@ var ts;
|
|
|
88352
88393
|
trackReferencedAmbientModule: trackReferencedAmbientModule,
|
|
88353
88394
|
trackExternalModuleSymbolOfImportTypeNode: trackExternalModuleSymbolOfImportTypeNode,
|
|
88354
88395
|
reportNonlocalAugmentation: reportNonlocalAugmentation,
|
|
88355
|
-
reportNonSerializableProperty: reportNonSerializableProperty
|
|
88396
|
+
reportNonSerializableProperty: reportNonSerializableProperty,
|
|
88397
|
+
reportImportTypeNodeResolutionModeOverride: reportImportTypeNodeResolutionModeOverride,
|
|
88356
88398
|
};
|
|
88357
88399
|
var errorNameNode;
|
|
88358
88400
|
var errorFallbackNode;
|
|
@@ -88474,6 +88516,11 @@ var ts;
|
|
|
88474
88516
|
context.addDiagnostic(ts.createDiagnosticForNode((errorNameNode || errorFallbackNode), ts.Diagnostics.The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized, propertyName));
|
|
88475
88517
|
}
|
|
88476
88518
|
}
|
|
88519
|
+
function reportImportTypeNodeResolutionModeOverride() {
|
|
88520
|
+
if (!ts.isNightly() && (errorNameNode || errorFallbackNode)) {
|
|
88521
|
+
context.addDiagnostic(ts.createDiagnosticForNode((errorNameNode || errorFallbackNode), ts.Diagnostics.The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_feature_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next));
|
|
88522
|
+
}
|
|
88523
|
+
}
|
|
88477
88524
|
function transformDeclarationsForJS(sourceFile, bundled) {
|
|
88478
88525
|
var oldDiag = getSymbolAccessibilityDiagnostic;
|
|
88479
88526
|
getSymbolAccessibilityDiagnostic = function (s) { return (s.errorNode && ts.canProduceDiagnostics(s.errorNode) ? ts.createGetSymbolAccessibilityDiagnosticForNode(s.errorNode)(s) : ({
|
|
@@ -88890,7 +88937,7 @@ var ts;
|
|
|
88890
88937
|
var mode = ts.getResolutionModeOverrideForClause(assertClause);
|
|
88891
88938
|
if (mode !== undefined) {
|
|
88892
88939
|
if (!ts.isNightly()) {
|
|
88893
|
-
context.addDiagnostic(ts.createDiagnosticForNode(assertClause, ts.Diagnostics.
|
|
88940
|
+
context.addDiagnostic(ts.createDiagnosticForNode(assertClause, ts.Diagnostics.resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next));
|
|
88894
88941
|
}
|
|
88895
88942
|
return assertClause;
|
|
88896
88943
|
}
|
|
@@ -97594,7 +97641,7 @@ var ts;
|
|
|
97594
97641
|
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
97595
97642
|
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
97596
97643
|
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
97597
|
-
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.
|
|
97644
|
+
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
|
|
97598
97645
|
}
|
|
97599
97646
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
97600
97647
|
}
|
|
@@ -102211,6 +102258,7 @@ var ts;
|
|
|
102211
102258
|
}
|
|
102212
102259
|
function reloadFileNamesFromConfigFile() {
|
|
102213
102260
|
writeLog("Reloading new file names and options");
|
|
102261
|
+
reloadLevel = ts.ConfigFileProgramReloadLevel.None;
|
|
102214
102262
|
rootFileNames = ts.getFileNamesFromConfigSpecs(compilerOptions.configFile.configFileSpecs, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost, extraFileExtensions);
|
|
102215
102263
|
if (ts.updateErrorForNoInputFiles(rootFileNames, ts.getNormalizedAbsolutePath(configFileName, currentDirectory), compilerOptions.configFile.configFileSpecs, configFileParsingDiagnostics, canConfigFileJsonReportNoInputFiles)) {
|
|
102216
102264
|
hasChangedConfigFileParsingErrors = true;
|