typescript 4.8.0-dev.20220602 → 4.8.0-dev.20220603
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 +52 -10
- package/lib/tsserver.js +69 -13
- package/lib/tsserverlibrary.d.ts +26 -0
- package/lib/tsserverlibrary.js +69 -13
- package/lib/typescript.d.ts +26 -0
- package/lib/typescript.js +69 -13
- package/lib/typescriptServices.d.ts +26 -0
- package/lib/typescriptServices.js +69 -13
- package/lib/typingsInstaller.js +69 -13
- 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.8";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220603";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -5381,6 +5381,7 @@ var ts;
|
|
|
5381
5381
|
Decorators_are_not_valid_here: diag(1206, ts.DiagnosticCategory.Error, "Decorators_are_not_valid_here_1206", "Decorators are not valid here."),
|
|
5382
5382
|
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: diag(1207, ts.DiagnosticCategory.Error, "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207", "Decorators cannot be applied to multiple get/set accessors of the same name."),
|
|
5383
5383
|
_0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module: diag(1208, ts.DiagnosticCategory.Error, "_0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_imp_1208", "'{0}' cannot be compiled under '--isolatedModules' because it is considered a global script file. Add an import, export, or an empty 'export {}' statement to make it a module."),
|
|
5384
|
+
Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0: diag(1209, ts.DiagnosticCategory.Error, "Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0_1209", "Invalid optional chain from new expression. Did you mean to call '{0}()'?"),
|
|
5384
5385
|
Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of_0_For_more_information_see_https_Colon_Slash_Slashdeveloper_mozilla_org_Slashen_US_Slashdocs_SlashWeb_SlashJavaScript_SlashReference_SlashStrict_mode: diag(1210, ts.DiagnosticCategory.Error, "Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of__1210", "Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of '{0}'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode."),
|
|
5385
5386
|
A_class_declaration_without_the_default_modifier_must_have_a_name: diag(1211, ts.DiagnosticCategory.Error, "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", "A class declaration without the 'default' modifier must have a name."),
|
|
5386
5387
|
Identifier_expected_0_is_a_reserved_word_in_strict_mode: diag(1212, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", "Identifier expected. '{0}' is a reserved word in strict mode."),
|
|
@@ -5577,7 +5578,7 @@ var ts;
|
|
|
5577
5578
|
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."),
|
|
5578
5579
|
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"),
|
|
5579
5580
|
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"),
|
|
5580
|
-
|
|
5581
|
+
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`."),
|
|
5581
5582
|
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`."),
|
|
5582
5583
|
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."),
|
|
5583
5584
|
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."),
|
|
@@ -6085,6 +6086,7 @@ var ts;
|
|
|
6085
6086
|
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."),
|
|
6086
6087
|
This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value: diag(2839, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839", "This condition will always return '{0}' since JavaScript compares objects by reference, not value."),
|
|
6087
6088
|
An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes: diag(2840, ts.DiagnosticCategory.Error, "An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_clas_2840", "An interface cannot extend a primitive type like '{0}'; an interface can only extend named types and classes"),
|
|
6089
|
+
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'."),
|
|
6088
6090
|
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}'."),
|
|
6089
6091
|
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}'."),
|
|
6090
6092
|
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}'."),
|
|
@@ -6192,7 +6194,7 @@ var ts;
|
|
|
6192
6194
|
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}'."),
|
|
6193
6195
|
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}'?"),
|
|
6194
6196
|
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'."),
|
|
6195
|
-
|
|
6197
|
+
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'."),
|
|
6196
6198
|
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."),
|
|
6197
6199
|
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."),
|
|
6198
6200
|
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}'."),
|
|
@@ -12438,6 +12440,8 @@ var ts;
|
|
|
12438
12440
|
case 218:
|
|
12439
12441
|
case 231:
|
|
12440
12442
|
return true;
|
|
12443
|
+
case 228:
|
|
12444
|
+
return !ts.isHeritageClause(node.parent);
|
|
12441
12445
|
case 161:
|
|
12442
12446
|
while (node.parent.kind === 161) {
|
|
12443
12447
|
node = node.parent;
|
|
@@ -23359,6 +23363,10 @@ var ts;
|
|
|
23359
23363
|
return node.kind === 267;
|
|
23360
23364
|
}
|
|
23361
23365
|
ts.isImportClause = isImportClause;
|
|
23366
|
+
function isImportTypeAssertionContainer(node) {
|
|
23367
|
+
return node.kind === 295;
|
|
23368
|
+
}
|
|
23369
|
+
ts.isImportTypeAssertionContainer = isImportTypeAssertionContainer;
|
|
23362
23370
|
function isAssertClause(node) {
|
|
23363
23371
|
return node.kind === 293;
|
|
23364
23372
|
}
|
|
@@ -28651,6 +28659,9 @@ var ts;
|
|
|
28651
28659
|
typeArguments = expression.typeArguments;
|
|
28652
28660
|
expression = expression.expression;
|
|
28653
28661
|
}
|
|
28662
|
+
if (token() === 28) {
|
|
28663
|
+
parseErrorAtCurrentToken(ts.Diagnostics.Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0, ts.getTextOfNodeFromSourceText(sourceText, expression));
|
|
28664
|
+
}
|
|
28654
28665
|
var argumentList = token() === 20 ? parseArgumentList() : undefined;
|
|
28655
28666
|
return finishNode(factory.createNewExpression(expression, typeArguments, argumentList), pos);
|
|
28656
28667
|
}
|
|
@@ -35834,13 +35845,32 @@ var ts;
|
|
|
35834
35845
|
}
|
|
35835
35846
|
return toSearchResult(undefined);
|
|
35836
35847
|
}
|
|
35848
|
+
function comparePatternKeys(a, b) {
|
|
35849
|
+
var aPatternIndex = a.indexOf("*");
|
|
35850
|
+
var bPatternIndex = b.indexOf("*");
|
|
35851
|
+
var baseLenA = aPatternIndex === -1 ? a.length : aPatternIndex + 1;
|
|
35852
|
+
var baseLenB = bPatternIndex === -1 ? b.length : bPatternIndex + 1;
|
|
35853
|
+
if (baseLenA > baseLenB)
|
|
35854
|
+
return -1;
|
|
35855
|
+
if (baseLenB > baseLenA)
|
|
35856
|
+
return 1;
|
|
35857
|
+
if (aPatternIndex === -1)
|
|
35858
|
+
return 1;
|
|
35859
|
+
if (bPatternIndex === -1)
|
|
35860
|
+
return -1;
|
|
35861
|
+
if (a.length > b.length)
|
|
35862
|
+
return -1;
|
|
35863
|
+
if (b.length > a.length)
|
|
35864
|
+
return 1;
|
|
35865
|
+
return 0;
|
|
35866
|
+
}
|
|
35837
35867
|
function loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
|
|
35838
35868
|
var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
|
|
35839
35869
|
if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) {
|
|
35840
35870
|
var target = lookupTable[moduleName];
|
|
35841
35871
|
return loadModuleFromTargetImportOrExport(target, "", false);
|
|
35842
35872
|
}
|
|
35843
|
-
var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }),
|
|
35873
|
+
var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }), comparePatternKeys);
|
|
35844
35874
|
for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) {
|
|
35845
35875
|
var potentialTarget = expandingKeys_1[_i];
|
|
35846
35876
|
if (state.features & NodeResolutionFeatures.ExportsPatternTrailers && matchesPatternWithTrailer(potentialTarget, moduleName)) {
|
|
@@ -44056,6 +44086,7 @@ var ts;
|
|
|
44056
44086
|
return symbol.parent ? ts.factory.createQualifiedName(symbolToEntityNameNode(symbol.parent), identifier) : identifier;
|
|
44057
44087
|
}
|
|
44058
44088
|
function symbolToTypeNode(symbol, context, meaning, overrideTypeArguments) {
|
|
44089
|
+
var _a, _b, _c, _d;
|
|
44059
44090
|
var chain = lookupSymbolChain(symbol, context, meaning, !(context.flags & 16384));
|
|
44060
44091
|
var isTypeOf = meaning === 111551;
|
|
44061
44092
|
if (ts.some(chain[0].declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
|
|
@@ -44071,6 +44102,7 @@ var ts;
|
|
|
44071
44102
|
assertion = ts.factory.createImportTypeAssertionContainer(ts.factory.createAssertClause(ts.factory.createNodeArray([
|
|
44072
44103
|
ts.factory.createAssertEntry(ts.factory.createStringLiteral("resolution-mode"), ts.factory.createStringLiteral("import"))
|
|
44073
44104
|
])));
|
|
44105
|
+
(_b = (_a = context.tracker).reportImportTypeNodeResolutionModeOverride) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
44074
44106
|
}
|
|
44075
44107
|
}
|
|
44076
44108
|
if (!specifier) {
|
|
@@ -44088,6 +44120,7 @@ var ts;
|
|
|
44088
44120
|
assertion = ts.factory.createImportTypeAssertionContainer(ts.factory.createAssertClause(ts.factory.createNodeArray([
|
|
44089
44121
|
ts.factory.createAssertEntry(ts.factory.createStringLiteral("resolution-mode"), ts.factory.createStringLiteral(swappedMode === ts.ModuleKind.ESNext ? "import" : "require"))
|
|
44090
44122
|
])));
|
|
44123
|
+
(_d = (_c = context.tracker).reportImportTypeNodeResolutionModeOverride) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
44091
44124
|
}
|
|
44092
44125
|
}
|
|
44093
44126
|
if (!assertion) {
|
|
@@ -67802,8 +67835,11 @@ var ts;
|
|
|
67802
67835
|
if (node.assertions) {
|
|
67803
67836
|
var override = ts.getResolutionModeOverrideForClause(node.assertions.assertClause, grammarErrorOnNode);
|
|
67804
67837
|
if (override) {
|
|
67838
|
+
if (!ts.isNightly()) {
|
|
67839
|
+
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);
|
|
67840
|
+
}
|
|
67805
67841
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
67806
|
-
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.
|
|
67842
|
+
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
67807
67843
|
}
|
|
67808
67844
|
}
|
|
67809
67845
|
}
|
|
@@ -71463,10 +71499,10 @@ var ts;
|
|
|
71463
71499
|
var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
|
|
71464
71500
|
if (validForTypeAssertions && override) {
|
|
71465
71501
|
if (!ts.isNightly()) {
|
|
71466
|
-
grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
71502
|
+
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);
|
|
71467
71503
|
}
|
|
71468
71504
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
71469
|
-
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
71505
|
+
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
71470
71506
|
}
|
|
71471
71507
|
return;
|
|
71472
71508
|
}
|
|
@@ -88605,7 +88641,8 @@ var ts;
|
|
|
88605
88641
|
trackReferencedAmbientModule: trackReferencedAmbientModule,
|
|
88606
88642
|
trackExternalModuleSymbolOfImportTypeNode: trackExternalModuleSymbolOfImportTypeNode,
|
|
88607
88643
|
reportNonlocalAugmentation: reportNonlocalAugmentation,
|
|
88608
|
-
reportNonSerializableProperty: reportNonSerializableProperty
|
|
88644
|
+
reportNonSerializableProperty: reportNonSerializableProperty,
|
|
88645
|
+
reportImportTypeNodeResolutionModeOverride: reportImportTypeNodeResolutionModeOverride,
|
|
88609
88646
|
};
|
|
88610
88647
|
var errorNameNode;
|
|
88611
88648
|
var errorFallbackNode;
|
|
@@ -88727,6 +88764,11 @@ var ts;
|
|
|
88727
88764
|
context.addDiagnostic(ts.createDiagnosticForNode((errorNameNode || errorFallbackNode), ts.Diagnostics.The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized, propertyName));
|
|
88728
88765
|
}
|
|
88729
88766
|
}
|
|
88767
|
+
function reportImportTypeNodeResolutionModeOverride() {
|
|
88768
|
+
if (!ts.isNightly() && (errorNameNode || errorFallbackNode)) {
|
|
88769
|
+
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));
|
|
88770
|
+
}
|
|
88771
|
+
}
|
|
88730
88772
|
function transformDeclarationsForJS(sourceFile, bundled) {
|
|
88731
88773
|
var oldDiag = getSymbolAccessibilityDiagnostic;
|
|
88732
88774
|
getSymbolAccessibilityDiagnostic = function (s) { return (s.errorNode && ts.canProduceDiagnostics(s.errorNode) ? ts.createGetSymbolAccessibilityDiagnosticForNode(s.errorNode)(s) : ({
|
|
@@ -89143,7 +89185,7 @@ var ts;
|
|
|
89143
89185
|
var mode = ts.getResolutionModeOverrideForClause(assertClause);
|
|
89144
89186
|
if (mode !== undefined) {
|
|
89145
89187
|
if (!ts.isNightly()) {
|
|
89146
|
-
context.addDiagnostic(ts.createDiagnosticForNode(assertClause, ts.Diagnostics.
|
|
89188
|
+
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));
|
|
89147
89189
|
}
|
|
89148
89190
|
return assertClause;
|
|
89149
89191
|
}
|
|
@@ -97851,7 +97893,7 @@ var ts;
|
|
|
97851
97893
|
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
97852
97894
|
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
97853
97895
|
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
97854
|
-
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.
|
|
97896
|
+
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
|
|
97855
97897
|
}
|
|
97856
97898
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
97857
97899
|
}
|
package/lib/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220603";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -8202,6 +8202,7 @@ var ts;
|
|
|
8202
8202
|
Decorators_are_not_valid_here: diag(1206, ts.DiagnosticCategory.Error, "Decorators_are_not_valid_here_1206", "Decorators are not valid here."),
|
|
8203
8203
|
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: diag(1207, ts.DiagnosticCategory.Error, "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207", "Decorators cannot be applied to multiple get/set accessors of the same name."),
|
|
8204
8204
|
_0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module: diag(1208, ts.DiagnosticCategory.Error, "_0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_imp_1208", "'{0}' cannot be compiled under '--isolatedModules' because it is considered a global script file. Add an import, export, or an empty 'export {}' statement to make it a module."),
|
|
8205
|
+
Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0: diag(1209, ts.DiagnosticCategory.Error, "Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0_1209", "Invalid optional chain from new expression. Did you mean to call '{0}()'?"),
|
|
8205
8206
|
Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of_0_For_more_information_see_https_Colon_Slash_Slashdeveloper_mozilla_org_Slashen_US_Slashdocs_SlashWeb_SlashJavaScript_SlashReference_SlashStrict_mode: diag(1210, ts.DiagnosticCategory.Error, "Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of__1210", "Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of '{0}'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode."),
|
|
8206
8207
|
A_class_declaration_without_the_default_modifier_must_have_a_name: diag(1211, ts.DiagnosticCategory.Error, "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", "A class declaration without the 'default' modifier must have a name."),
|
|
8207
8208
|
Identifier_expected_0_is_a_reserved_word_in_strict_mode: diag(1212, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", "Identifier expected. '{0}' is a reserved word in strict mode."),
|
|
@@ -8398,7 +8399,7 @@ var ts;
|
|
|
8398
8399
|
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."),
|
|
8399
8400
|
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"),
|
|
8400
8401
|
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"),
|
|
8401
|
-
|
|
8402
|
+
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`."),
|
|
8402
8403
|
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`."),
|
|
8403
8404
|
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."),
|
|
8404
8405
|
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."),
|
|
@@ -8906,6 +8907,7 @@ var ts;
|
|
|
8906
8907
|
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."),
|
|
8907
8908
|
This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value: diag(2839, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839", "This condition will always return '{0}' since JavaScript compares objects by reference, not value."),
|
|
8908
8909
|
An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes: diag(2840, ts.DiagnosticCategory.Error, "An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_clas_2840", "An interface cannot extend a primitive type like '{0}'; an interface can only extend named types and classes"),
|
|
8910
|
+
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'."),
|
|
8909
8911
|
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}'."),
|
|
8910
8912
|
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}'."),
|
|
8911
8913
|
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}'."),
|
|
@@ -9013,7 +9015,7 @@ var ts;
|
|
|
9013
9015
|
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}'."),
|
|
9014
9016
|
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}'?"),
|
|
9015
9017
|
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'."),
|
|
9016
|
-
|
|
9018
|
+
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'."),
|
|
9017
9019
|
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."),
|
|
9018
9020
|
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."),
|
|
9019
9021
|
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}'."),
|
|
@@ -16054,6 +16056,8 @@ var ts;
|
|
|
16054
16056
|
case 218 /* AwaitExpression */:
|
|
16055
16057
|
case 231 /* MetaProperty */:
|
|
16056
16058
|
return true;
|
|
16059
|
+
case 228 /* ExpressionWithTypeArguments */:
|
|
16060
|
+
return !ts.isHeritageClause(node.parent);
|
|
16057
16061
|
case 161 /* QualifiedName */:
|
|
16058
16062
|
while (node.parent.kind === 161 /* QualifiedName */) {
|
|
16059
16063
|
node = node.parent;
|
|
@@ -29087,6 +29091,10 @@ var ts;
|
|
|
29087
29091
|
return node.kind === 267 /* ImportClause */;
|
|
29088
29092
|
}
|
|
29089
29093
|
ts.isImportClause = isImportClause;
|
|
29094
|
+
function isImportTypeAssertionContainer(node) {
|
|
29095
|
+
return node.kind === 295 /* ImportTypeAssertionContainer */;
|
|
29096
|
+
}
|
|
29097
|
+
ts.isImportTypeAssertionContainer = isImportTypeAssertionContainer;
|
|
29090
29098
|
function isAssertClause(node) {
|
|
29091
29099
|
return node.kind === 293 /* AssertClause */;
|
|
29092
29100
|
}
|
|
@@ -35659,6 +35667,9 @@ var ts;
|
|
|
35659
35667
|
typeArguments = expression.typeArguments;
|
|
35660
35668
|
expression = expression.expression;
|
|
35661
35669
|
}
|
|
35670
|
+
if (token() === 28 /* QuestionDotToken */) {
|
|
35671
|
+
parseErrorAtCurrentToken(ts.Diagnostics.Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0, ts.getTextOfNodeFromSourceText(sourceText, expression));
|
|
35672
|
+
}
|
|
35662
35673
|
var argumentList = token() === 20 /* OpenParenToken */ ? parseArgumentList() : undefined;
|
|
35663
35674
|
return finishNode(factory.createNewExpression(expression, typeArguments, argumentList), pos);
|
|
35664
35675
|
}
|
|
@@ -43850,13 +43861,36 @@ var ts;
|
|
|
43850
43861
|
}
|
|
43851
43862
|
return toSearchResult(/*value*/ undefined);
|
|
43852
43863
|
}
|
|
43864
|
+
/**
|
|
43865
|
+
* From https://github.com/nodejs/node/blob/8f39f51cbbd3b2de14b9ee896e26421cc5b20121/lib/internal/modules/esm/resolve.js#L722 -
|
|
43866
|
+
* "longest" has some nuance as to what "longest" means in the presence of pattern trailers
|
|
43867
|
+
*/
|
|
43868
|
+
function comparePatternKeys(a, b) {
|
|
43869
|
+
var aPatternIndex = a.indexOf("*");
|
|
43870
|
+
var bPatternIndex = b.indexOf("*");
|
|
43871
|
+
var baseLenA = aPatternIndex === -1 ? a.length : aPatternIndex + 1;
|
|
43872
|
+
var baseLenB = bPatternIndex === -1 ? b.length : bPatternIndex + 1;
|
|
43873
|
+
if (baseLenA > baseLenB)
|
|
43874
|
+
return -1;
|
|
43875
|
+
if (baseLenB > baseLenA)
|
|
43876
|
+
return 1;
|
|
43877
|
+
if (aPatternIndex === -1)
|
|
43878
|
+
return 1;
|
|
43879
|
+
if (bPatternIndex === -1)
|
|
43880
|
+
return -1;
|
|
43881
|
+
if (a.length > b.length)
|
|
43882
|
+
return -1;
|
|
43883
|
+
if (b.length > a.length)
|
|
43884
|
+
return 1;
|
|
43885
|
+
return 0;
|
|
43886
|
+
}
|
|
43853
43887
|
function loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
|
|
43854
43888
|
var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
|
|
43855
43889
|
if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) {
|
|
43856
43890
|
var target = lookupTable[moduleName];
|
|
43857
43891
|
return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false);
|
|
43858
43892
|
}
|
|
43859
|
-
var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }),
|
|
43893
|
+
var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }), comparePatternKeys);
|
|
43860
43894
|
for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) {
|
|
43861
43895
|
var potentialTarget = expandingKeys_1[_i];
|
|
43862
43896
|
if (state.features & NodeResolutionFeatures.ExportsPatternTrailers && matchesPatternWithTrailer(potentialTarget, moduleName)) {
|
|
@@ -53435,6 +53469,7 @@ var ts;
|
|
|
53435
53469
|
return symbol.parent ? ts.factory.createQualifiedName(symbolToEntityNameNode(symbol.parent), identifier) : identifier;
|
|
53436
53470
|
}
|
|
53437
53471
|
function symbolToTypeNode(symbol, context, meaning, overrideTypeArguments) {
|
|
53472
|
+
var _a, _b, _c, _d;
|
|
53438
53473
|
var chain = lookupSymbolChain(symbol, context, meaning, !(context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */)); // If we're using aliases outside the current scope, dont bother with the module
|
|
53439
53474
|
var isTypeOf = meaning === 111551 /* Value */;
|
|
53440
53475
|
if (ts.some(chain[0].declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
|
|
@@ -53452,6 +53487,7 @@ var ts;
|
|
|
53452
53487
|
assertion = ts.factory.createImportTypeAssertionContainer(ts.factory.createAssertClause(ts.factory.createNodeArray([
|
|
53453
53488
|
ts.factory.createAssertEntry(ts.factory.createStringLiteral("resolution-mode"), ts.factory.createStringLiteral("import"))
|
|
53454
53489
|
])));
|
|
53490
|
+
(_b = (_a = context.tracker).reportImportTypeNodeResolutionModeOverride) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
53455
53491
|
}
|
|
53456
53492
|
}
|
|
53457
53493
|
if (!specifier) {
|
|
@@ -53471,6 +53507,7 @@ var ts;
|
|
|
53471
53507
|
assertion = ts.factory.createImportTypeAssertionContainer(ts.factory.createAssertClause(ts.factory.createNodeArray([
|
|
53472
53508
|
ts.factory.createAssertEntry(ts.factory.createStringLiteral("resolution-mode"), ts.factory.createStringLiteral(swappedMode === ts.ModuleKind.ESNext ? "import" : "require"))
|
|
53473
53509
|
])));
|
|
53510
|
+
(_d = (_c = context.tracker).reportImportTypeNodeResolutionModeOverride) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
53474
53511
|
}
|
|
53475
53512
|
}
|
|
53476
53513
|
if (!assertion) {
|
|
@@ -80880,8 +80917,11 @@ var ts;
|
|
|
80880
80917
|
if (node.assertions) {
|
|
80881
80918
|
var override = ts.getResolutionModeOverrideForClause(node.assertions.assertClause, grammarErrorOnNode);
|
|
80882
80919
|
if (override) {
|
|
80920
|
+
if (!ts.isNightly()) {
|
|
80921
|
+
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);
|
|
80922
|
+
}
|
|
80883
80923
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
80884
|
-
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.
|
|
80924
|
+
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
80885
80925
|
}
|
|
80886
80926
|
}
|
|
80887
80927
|
}
|
|
@@ -85287,10 +85327,10 @@ var ts;
|
|
|
85287
85327
|
var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
|
|
85288
85328
|
if (validForTypeAssertions && override) {
|
|
85289
85329
|
if (!ts.isNightly()) {
|
|
85290
|
-
grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
85330
|
+
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);
|
|
85291
85331
|
}
|
|
85292
85332
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
85293
|
-
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
85333
|
+
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
85294
85334
|
}
|
|
85295
85335
|
return; // Other grammar checks do not apply to type-only imports with resolution mode assertions
|
|
85296
85336
|
}
|
|
@@ -108149,7 +108189,8 @@ var ts;
|
|
|
108149
108189
|
trackReferencedAmbientModule: trackReferencedAmbientModule,
|
|
108150
108190
|
trackExternalModuleSymbolOfImportTypeNode: trackExternalModuleSymbolOfImportTypeNode,
|
|
108151
108191
|
reportNonlocalAugmentation: reportNonlocalAugmentation,
|
|
108152
|
-
reportNonSerializableProperty: reportNonSerializableProperty
|
|
108192
|
+
reportNonSerializableProperty: reportNonSerializableProperty,
|
|
108193
|
+
reportImportTypeNodeResolutionModeOverride: reportImportTypeNodeResolutionModeOverride,
|
|
108153
108194
|
};
|
|
108154
108195
|
var errorNameNode;
|
|
108155
108196
|
var errorFallbackNode;
|
|
@@ -108276,6 +108317,11 @@ var ts;
|
|
|
108276
108317
|
context.addDiagnostic(ts.createDiagnosticForNode((errorNameNode || errorFallbackNode), ts.Diagnostics.The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized, propertyName));
|
|
108277
108318
|
}
|
|
108278
108319
|
}
|
|
108320
|
+
function reportImportTypeNodeResolutionModeOverride() {
|
|
108321
|
+
if (!ts.isNightly() && (errorNameNode || errorFallbackNode)) {
|
|
108322
|
+
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));
|
|
108323
|
+
}
|
|
108324
|
+
}
|
|
108279
108325
|
function transformDeclarationsForJS(sourceFile, bundled) {
|
|
108280
108326
|
var oldDiag = getSymbolAccessibilityDiagnostic;
|
|
108281
108327
|
getSymbolAccessibilityDiagnostic = function (s) { return (s.errorNode && ts.canProduceDiagnostics(s.errorNode) ? ts.createGetSymbolAccessibilityDiagnosticForNode(s.errorNode)(s) : ({
|
|
@@ -108726,7 +108772,7 @@ var ts;
|
|
|
108726
108772
|
var mode = ts.getResolutionModeOverrideForClause(assertClause);
|
|
108727
108773
|
if (mode !== undefined) {
|
|
108728
108774
|
if (!ts.isNightly()) {
|
|
108729
|
-
context.addDiagnostic(ts.createDiagnosticForNode(assertClause, ts.Diagnostics.
|
|
108775
|
+
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));
|
|
108730
108776
|
}
|
|
108731
108777
|
return assertClause;
|
|
108732
108778
|
}
|
|
@@ -116235,12 +116281,14 @@ var ts;
|
|
|
116235
116281
|
}
|
|
116236
116282
|
ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache;
|
|
116237
116283
|
;
|
|
116238
|
-
|
|
116284
|
+
/**
|
|
116285
|
+
* Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly
|
|
116286
|
+
* provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file.
|
|
116287
|
+
*/
|
|
116239
116288
|
function getModeForFileReference(ref, containingFileMode) {
|
|
116240
116289
|
return (ts.isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
|
|
116241
116290
|
}
|
|
116242
116291
|
ts.getModeForFileReference = getModeForFileReference;
|
|
116243
|
-
/* @internal */
|
|
116244
116292
|
function getModeForResolutionAtIndex(file, index) {
|
|
116245
116293
|
if (file.impliedNodeFormat === undefined)
|
|
116246
116294
|
return undefined;
|
|
@@ -116261,7 +116309,15 @@ var ts;
|
|
|
116261
116309
|
return false;
|
|
116262
116310
|
}
|
|
116263
116311
|
ts.isExclusivelyTypeOnlyImportOrExport = isExclusivelyTypeOnlyImportOrExport;
|
|
116264
|
-
|
|
116312
|
+
/**
|
|
116313
|
+
* Calculates the final resolution mode for a given module reference node. This is generally the explicitly provided resolution mode, if
|
|
116314
|
+
* one exists, or the mode of the containing source file. (Excepting import=require, which is always commonjs, and dynamic import, which is always esm).
|
|
116315
|
+
* Notably, this function always returns `undefined` if the containing file has an `undefined` `impliedNodeFormat` - this field is only set when
|
|
116316
|
+
* `moduleResolution` is `node16`+.
|
|
116317
|
+
* @param file The file the import or import-like reference is contained within
|
|
116318
|
+
* @param usage The module reference string
|
|
116319
|
+
* @returns The final resolution mode of the import
|
|
116320
|
+
*/
|
|
116265
116321
|
function getModeForUsageLocation(file, usage) {
|
|
116266
116322
|
var _a, _b;
|
|
116267
116323
|
if (file.impliedNodeFormat === undefined)
|
|
@@ -118497,7 +118553,7 @@ var ts;
|
|
|
118497
118553
|
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
118498
118554
|
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
118499
118555
|
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
118500
|
-
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.
|
|
118556
|
+
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
|
|
118501
118557
|
}
|
|
118502
118558
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
118503
118559
|
}
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -4724,6 +4724,7 @@ declare namespace ts {
|
|
|
4724
4724
|
function isImportEqualsDeclaration(node: Node): node is ImportEqualsDeclaration;
|
|
4725
4725
|
function isImportDeclaration(node: Node): node is ImportDeclaration;
|
|
4726
4726
|
function isImportClause(node: Node): node is ImportClause;
|
|
4727
|
+
function isImportTypeAssertionContainer(node: Node): node is ImportTypeAssertionContainer;
|
|
4727
4728
|
function isAssertClause(node: Node): node is AssertClause;
|
|
4728
4729
|
function isAssertEntry(node: Node): node is AssertEntry;
|
|
4729
4730
|
function isNamespaceImport(node: Node): node is NamespaceImport;
|
|
@@ -5102,6 +5103,31 @@ declare namespace ts {
|
|
|
5102
5103
|
export function formatDiagnostic(diagnostic: Diagnostic, host: FormatDiagnosticsHost): string;
|
|
5103
5104
|
export function formatDiagnosticsWithColorAndContext(diagnostics: readonly Diagnostic[], host: FormatDiagnosticsHost): string;
|
|
5104
5105
|
export function flattenDiagnosticMessageText(diag: string | DiagnosticMessageChain | undefined, newLine: string, indent?: number): string;
|
|
5106
|
+
/**
|
|
5107
|
+
* Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly
|
|
5108
|
+
* provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file.
|
|
5109
|
+
*/
|
|
5110
|
+
export function getModeForFileReference(ref: FileReference | string, containingFileMode: SourceFile["impliedNodeFormat"]): ModuleKind.CommonJS | ModuleKind.ESNext | undefined;
|
|
5111
|
+
/**
|
|
5112
|
+
* Calculates the final resolution mode for an import at some index within a file's imports list. This is generally the explicitly
|
|
5113
|
+
* defined mode of the import if provided, or, if not, the mode of the containing file (with some exceptions: import=require is always commonjs, dynamic import is always esm).
|
|
5114
|
+
* If you have an actual import node, prefer using getModeForUsageLocation on the reference string node.
|
|
5115
|
+
* @param file File to fetch the resolution mode within
|
|
5116
|
+
* @param index Index into the file's complete resolution list to get the resolution of - this is a concatenation of the file's imports and module augmentations
|
|
5117
|
+
*/
|
|
5118
|
+
export function getModeForResolutionAtIndex(file: SourceFile, index: number): ModuleKind.CommonJS | ModuleKind.ESNext | undefined;
|
|
5119
|
+
/**
|
|
5120
|
+
* Calculates the final resolution mode for a given module reference node. This is generally the explicitly provided resolution mode, if
|
|
5121
|
+
* one exists, or the mode of the containing source file. (Excepting import=require, which is always commonjs, and dynamic import, which is always esm).
|
|
5122
|
+
* Notably, this function always returns `undefined` if the containing file has an `undefined` `impliedNodeFormat` - this field is only set when
|
|
5123
|
+
* `moduleResolution` is `node16`+.
|
|
5124
|
+
* @param file The file the import or import-like reference is contained within
|
|
5125
|
+
* @param usage The module reference string
|
|
5126
|
+
* @returns The final resolution mode of the import
|
|
5127
|
+
*/
|
|
5128
|
+
export function getModeForUsageLocation(file: {
|
|
5129
|
+
impliedNodeFormat?: SourceFile["impliedNodeFormat"];
|
|
5130
|
+
}, usage: StringLiteralLike): ModuleKind.CommonJS | ModuleKind.ESNext | undefined;
|
|
5105
5131
|
export function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): readonly Diagnostic[];
|
|
5106
5132
|
/**
|
|
5107
5133
|
* A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the
|