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
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220603";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -8396,6 +8396,7 @@ var ts;
|
|
|
8396
8396
|
Decorators_are_not_valid_here: diag(1206, ts.DiagnosticCategory.Error, "Decorators_are_not_valid_here_1206", "Decorators are not valid here."),
|
|
8397
8397
|
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."),
|
|
8398
8398
|
_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."),
|
|
8399
|
+
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}()'?"),
|
|
8399
8400
|
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."),
|
|
8400
8401
|
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."),
|
|
8401
8402
|
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."),
|
|
@@ -8592,7 +8593,7 @@ var ts;
|
|
|
8592
8593
|
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."),
|
|
8593
8594
|
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"),
|
|
8594
8595
|
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"),
|
|
8595
|
-
|
|
8596
|
+
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`."),
|
|
8596
8597
|
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`."),
|
|
8597
8598
|
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."),
|
|
8598
8599
|
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."),
|
|
@@ -9100,6 +9101,7 @@ var ts;
|
|
|
9100
9101
|
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."),
|
|
9101
9102
|
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."),
|
|
9102
9103
|
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"),
|
|
9104
|
+
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'."),
|
|
9103
9105
|
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}'."),
|
|
9104
9106
|
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}'."),
|
|
9105
9107
|
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}'."),
|
|
@@ -9207,7 +9209,7 @@ var ts;
|
|
|
9207
9209
|
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}'."),
|
|
9208
9210
|
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}'?"),
|
|
9209
9211
|
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'."),
|
|
9210
|
-
|
|
9212
|
+
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'."),
|
|
9211
9213
|
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."),
|
|
9212
9214
|
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."),
|
|
9213
9215
|
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}'."),
|
|
@@ -16248,6 +16250,8 @@ var ts;
|
|
|
16248
16250
|
case 218 /* AwaitExpression */:
|
|
16249
16251
|
case 231 /* MetaProperty */:
|
|
16250
16252
|
return true;
|
|
16253
|
+
case 228 /* ExpressionWithTypeArguments */:
|
|
16254
|
+
return !ts.isHeritageClause(node.parent);
|
|
16251
16255
|
case 161 /* QualifiedName */:
|
|
16252
16256
|
while (node.parent.kind === 161 /* QualifiedName */) {
|
|
16253
16257
|
node = node.parent;
|
|
@@ -29281,6 +29285,10 @@ var ts;
|
|
|
29281
29285
|
return node.kind === 267 /* ImportClause */;
|
|
29282
29286
|
}
|
|
29283
29287
|
ts.isImportClause = isImportClause;
|
|
29288
|
+
function isImportTypeAssertionContainer(node) {
|
|
29289
|
+
return node.kind === 295 /* ImportTypeAssertionContainer */;
|
|
29290
|
+
}
|
|
29291
|
+
ts.isImportTypeAssertionContainer = isImportTypeAssertionContainer;
|
|
29284
29292
|
function isAssertClause(node) {
|
|
29285
29293
|
return node.kind === 293 /* AssertClause */;
|
|
29286
29294
|
}
|
|
@@ -35853,6 +35861,9 @@ var ts;
|
|
|
35853
35861
|
typeArguments = expression.typeArguments;
|
|
35854
35862
|
expression = expression.expression;
|
|
35855
35863
|
}
|
|
35864
|
+
if (token() === 28 /* QuestionDotToken */) {
|
|
35865
|
+
parseErrorAtCurrentToken(ts.Diagnostics.Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0, ts.getTextOfNodeFromSourceText(sourceText, expression));
|
|
35866
|
+
}
|
|
35856
35867
|
var argumentList = token() === 20 /* OpenParenToken */ ? parseArgumentList() : undefined;
|
|
35857
35868
|
return finishNode(factory.createNewExpression(expression, typeArguments, argumentList), pos);
|
|
35858
35869
|
}
|
|
@@ -44044,13 +44055,36 @@ var ts;
|
|
|
44044
44055
|
}
|
|
44045
44056
|
return toSearchResult(/*value*/ undefined);
|
|
44046
44057
|
}
|
|
44058
|
+
/**
|
|
44059
|
+
* From https://github.com/nodejs/node/blob/8f39f51cbbd3b2de14b9ee896e26421cc5b20121/lib/internal/modules/esm/resolve.js#L722 -
|
|
44060
|
+
* "longest" has some nuance as to what "longest" means in the presence of pattern trailers
|
|
44061
|
+
*/
|
|
44062
|
+
function comparePatternKeys(a, b) {
|
|
44063
|
+
var aPatternIndex = a.indexOf("*");
|
|
44064
|
+
var bPatternIndex = b.indexOf("*");
|
|
44065
|
+
var baseLenA = aPatternIndex === -1 ? a.length : aPatternIndex + 1;
|
|
44066
|
+
var baseLenB = bPatternIndex === -1 ? b.length : bPatternIndex + 1;
|
|
44067
|
+
if (baseLenA > baseLenB)
|
|
44068
|
+
return -1;
|
|
44069
|
+
if (baseLenB > baseLenA)
|
|
44070
|
+
return 1;
|
|
44071
|
+
if (aPatternIndex === -1)
|
|
44072
|
+
return 1;
|
|
44073
|
+
if (bPatternIndex === -1)
|
|
44074
|
+
return -1;
|
|
44075
|
+
if (a.length > b.length)
|
|
44076
|
+
return -1;
|
|
44077
|
+
if (b.length > a.length)
|
|
44078
|
+
return 1;
|
|
44079
|
+
return 0;
|
|
44080
|
+
}
|
|
44047
44081
|
function loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
|
|
44048
44082
|
var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
|
|
44049
44083
|
if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) {
|
|
44050
44084
|
var target = lookupTable[moduleName];
|
|
44051
44085
|
return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false);
|
|
44052
44086
|
}
|
|
44053
|
-
var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }),
|
|
44087
|
+
var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }), comparePatternKeys);
|
|
44054
44088
|
for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) {
|
|
44055
44089
|
var potentialTarget = expandingKeys_1[_i];
|
|
44056
44090
|
if (state.features & NodeResolutionFeatures.ExportsPatternTrailers && matchesPatternWithTrailer(potentialTarget, moduleName)) {
|
|
@@ -53629,6 +53663,7 @@ var ts;
|
|
|
53629
53663
|
return symbol.parent ? ts.factory.createQualifiedName(symbolToEntityNameNode(symbol.parent), identifier) : identifier;
|
|
53630
53664
|
}
|
|
53631
53665
|
function symbolToTypeNode(symbol, context, meaning, overrideTypeArguments) {
|
|
53666
|
+
var _a, _b, _c, _d;
|
|
53632
53667
|
var chain = lookupSymbolChain(symbol, context, meaning, !(context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */)); // If we're using aliases outside the current scope, dont bother with the module
|
|
53633
53668
|
var isTypeOf = meaning === 111551 /* Value */;
|
|
53634
53669
|
if (ts.some(chain[0].declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
|
|
@@ -53646,6 +53681,7 @@ var ts;
|
|
|
53646
53681
|
assertion = ts.factory.createImportTypeAssertionContainer(ts.factory.createAssertClause(ts.factory.createNodeArray([
|
|
53647
53682
|
ts.factory.createAssertEntry(ts.factory.createStringLiteral("resolution-mode"), ts.factory.createStringLiteral("import"))
|
|
53648
53683
|
])));
|
|
53684
|
+
(_b = (_a = context.tracker).reportImportTypeNodeResolutionModeOverride) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
53649
53685
|
}
|
|
53650
53686
|
}
|
|
53651
53687
|
if (!specifier) {
|
|
@@ -53665,6 +53701,7 @@ var ts;
|
|
|
53665
53701
|
assertion = ts.factory.createImportTypeAssertionContainer(ts.factory.createAssertClause(ts.factory.createNodeArray([
|
|
53666
53702
|
ts.factory.createAssertEntry(ts.factory.createStringLiteral("resolution-mode"), ts.factory.createStringLiteral(swappedMode === ts.ModuleKind.ESNext ? "import" : "require"))
|
|
53667
53703
|
])));
|
|
53704
|
+
(_d = (_c = context.tracker).reportImportTypeNodeResolutionModeOverride) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
53668
53705
|
}
|
|
53669
53706
|
}
|
|
53670
53707
|
if (!assertion) {
|
|
@@ -81074,8 +81111,11 @@ var ts;
|
|
|
81074
81111
|
if (node.assertions) {
|
|
81075
81112
|
var override = ts.getResolutionModeOverrideForClause(node.assertions.assertClause, grammarErrorOnNode);
|
|
81076
81113
|
if (override) {
|
|
81114
|
+
if (!ts.isNightly()) {
|
|
81115
|
+
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);
|
|
81116
|
+
}
|
|
81077
81117
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
81078
|
-
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.
|
|
81118
|
+
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
81079
81119
|
}
|
|
81080
81120
|
}
|
|
81081
81121
|
}
|
|
@@ -85481,10 +85521,10 @@ var ts;
|
|
|
85481
85521
|
var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
|
|
85482
85522
|
if (validForTypeAssertions && override) {
|
|
85483
85523
|
if (!ts.isNightly()) {
|
|
85484
|
-
grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
85524
|
+
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);
|
|
85485
85525
|
}
|
|
85486
85526
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
85487
|
-
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
85527
|
+
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
85488
85528
|
}
|
|
85489
85529
|
return; // Other grammar checks do not apply to type-only imports with resolution mode assertions
|
|
85490
85530
|
}
|
|
@@ -108343,7 +108383,8 @@ var ts;
|
|
|
108343
108383
|
trackReferencedAmbientModule: trackReferencedAmbientModule,
|
|
108344
108384
|
trackExternalModuleSymbolOfImportTypeNode: trackExternalModuleSymbolOfImportTypeNode,
|
|
108345
108385
|
reportNonlocalAugmentation: reportNonlocalAugmentation,
|
|
108346
|
-
reportNonSerializableProperty: reportNonSerializableProperty
|
|
108386
|
+
reportNonSerializableProperty: reportNonSerializableProperty,
|
|
108387
|
+
reportImportTypeNodeResolutionModeOverride: reportImportTypeNodeResolutionModeOverride,
|
|
108347
108388
|
};
|
|
108348
108389
|
var errorNameNode;
|
|
108349
108390
|
var errorFallbackNode;
|
|
@@ -108470,6 +108511,11 @@ var ts;
|
|
|
108470
108511
|
context.addDiagnostic(ts.createDiagnosticForNode((errorNameNode || errorFallbackNode), ts.Diagnostics.The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized, propertyName));
|
|
108471
108512
|
}
|
|
108472
108513
|
}
|
|
108514
|
+
function reportImportTypeNodeResolutionModeOverride() {
|
|
108515
|
+
if (!ts.isNightly() && (errorNameNode || errorFallbackNode)) {
|
|
108516
|
+
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));
|
|
108517
|
+
}
|
|
108518
|
+
}
|
|
108473
108519
|
function transformDeclarationsForJS(sourceFile, bundled) {
|
|
108474
108520
|
var oldDiag = getSymbolAccessibilityDiagnostic;
|
|
108475
108521
|
getSymbolAccessibilityDiagnostic = function (s) { return (s.errorNode && ts.canProduceDiagnostics(s.errorNode) ? ts.createGetSymbolAccessibilityDiagnosticForNode(s.errorNode)(s) : ({
|
|
@@ -108920,7 +108966,7 @@ var ts;
|
|
|
108920
108966
|
var mode = ts.getResolutionModeOverrideForClause(assertClause);
|
|
108921
108967
|
if (mode !== undefined) {
|
|
108922
108968
|
if (!ts.isNightly()) {
|
|
108923
|
-
context.addDiagnostic(ts.createDiagnosticForNode(assertClause, ts.Diagnostics.
|
|
108969
|
+
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));
|
|
108924
108970
|
}
|
|
108925
108971
|
return assertClause;
|
|
108926
108972
|
}
|
|
@@ -116429,12 +116475,14 @@ var ts;
|
|
|
116429
116475
|
}
|
|
116430
116476
|
ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache;
|
|
116431
116477
|
;
|
|
116432
|
-
|
|
116478
|
+
/**
|
|
116479
|
+
* Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly
|
|
116480
|
+
* provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file.
|
|
116481
|
+
*/
|
|
116433
116482
|
function getModeForFileReference(ref, containingFileMode) {
|
|
116434
116483
|
return (ts.isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
|
|
116435
116484
|
}
|
|
116436
116485
|
ts.getModeForFileReference = getModeForFileReference;
|
|
116437
|
-
/* @internal */
|
|
116438
116486
|
function getModeForResolutionAtIndex(file, index) {
|
|
116439
116487
|
if (file.impliedNodeFormat === undefined)
|
|
116440
116488
|
return undefined;
|
|
@@ -116455,7 +116503,15 @@ var ts;
|
|
|
116455
116503
|
return false;
|
|
116456
116504
|
}
|
|
116457
116505
|
ts.isExclusivelyTypeOnlyImportOrExport = isExclusivelyTypeOnlyImportOrExport;
|
|
116458
|
-
|
|
116506
|
+
/**
|
|
116507
|
+
* Calculates the final resolution mode for a given module reference node. This is generally the explicitly provided resolution mode, if
|
|
116508
|
+
* one exists, or the mode of the containing source file. (Excepting import=require, which is always commonjs, and dynamic import, which is always esm).
|
|
116509
|
+
* Notably, this function always returns `undefined` if the containing file has an `undefined` `impliedNodeFormat` - this field is only set when
|
|
116510
|
+
* `moduleResolution` is `node16`+.
|
|
116511
|
+
* @param file The file the import or import-like reference is contained within
|
|
116512
|
+
* @param usage The module reference string
|
|
116513
|
+
* @returns The final resolution mode of the import
|
|
116514
|
+
*/
|
|
116459
116515
|
function getModeForUsageLocation(file, usage) {
|
|
116460
116516
|
var _a, _b;
|
|
116461
116517
|
if (file.impliedNodeFormat === undefined)
|
|
@@ -118691,7 +118747,7 @@ var ts;
|
|
|
118691
118747
|
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
118692
118748
|
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
118693
118749
|
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
118694
|
-
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.
|
|
118750
|
+
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
|
|
118695
118751
|
}
|
|
118696
118752
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
118697
118753
|
}
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220603";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -8191,6 +8191,7 @@ var ts;
|
|
|
8191
8191
|
Decorators_are_not_valid_here: diag(1206, ts.DiagnosticCategory.Error, "Decorators_are_not_valid_here_1206", "Decorators are not valid here."),
|
|
8192
8192
|
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."),
|
|
8193
8193
|
_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."),
|
|
8194
|
+
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}()'?"),
|
|
8194
8195
|
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."),
|
|
8195
8196
|
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."),
|
|
8196
8197
|
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."),
|
|
@@ -8387,7 +8388,7 @@ var ts;
|
|
|
8387
8388
|
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."),
|
|
8388
8389
|
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"),
|
|
8389
8390
|
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"),
|
|
8390
|
-
|
|
8391
|
+
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`."),
|
|
8391
8392
|
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`."),
|
|
8392
8393
|
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."),
|
|
8393
8394
|
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."),
|
|
@@ -8895,6 +8896,7 @@ var ts;
|
|
|
8895
8896
|
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."),
|
|
8896
8897
|
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."),
|
|
8897
8898
|
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"),
|
|
8899
|
+
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'."),
|
|
8898
8900
|
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}'."),
|
|
8899
8901
|
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}'."),
|
|
8900
8902
|
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}'."),
|
|
@@ -9002,7 +9004,7 @@ var ts;
|
|
|
9002
9004
|
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}'."),
|
|
9003
9005
|
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}'?"),
|
|
9004
9006
|
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'."),
|
|
9005
|
-
|
|
9007
|
+
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'."),
|
|
9006
9008
|
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."),
|
|
9007
9009
|
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."),
|
|
9008
9010
|
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}'."),
|
|
@@ -16043,6 +16045,8 @@ var ts;
|
|
|
16043
16045
|
case 218 /* AwaitExpression */:
|
|
16044
16046
|
case 231 /* MetaProperty */:
|
|
16045
16047
|
return true;
|
|
16048
|
+
case 228 /* ExpressionWithTypeArguments */:
|
|
16049
|
+
return !ts.isHeritageClause(node.parent);
|
|
16046
16050
|
case 161 /* QualifiedName */:
|
|
16047
16051
|
while (node.parent.kind === 161 /* QualifiedName */) {
|
|
16048
16052
|
node = node.parent;
|
|
@@ -29076,6 +29080,10 @@ var ts;
|
|
|
29076
29080
|
return node.kind === 267 /* ImportClause */;
|
|
29077
29081
|
}
|
|
29078
29082
|
ts.isImportClause = isImportClause;
|
|
29083
|
+
function isImportTypeAssertionContainer(node) {
|
|
29084
|
+
return node.kind === 295 /* ImportTypeAssertionContainer */;
|
|
29085
|
+
}
|
|
29086
|
+
ts.isImportTypeAssertionContainer = isImportTypeAssertionContainer;
|
|
29079
29087
|
function isAssertClause(node) {
|
|
29080
29088
|
return node.kind === 293 /* AssertClause */;
|
|
29081
29089
|
}
|
|
@@ -35648,6 +35656,9 @@ var ts;
|
|
|
35648
35656
|
typeArguments = expression.typeArguments;
|
|
35649
35657
|
expression = expression.expression;
|
|
35650
35658
|
}
|
|
35659
|
+
if (token() === 28 /* QuestionDotToken */) {
|
|
35660
|
+
parseErrorAtCurrentToken(ts.Diagnostics.Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0, ts.getTextOfNodeFromSourceText(sourceText, expression));
|
|
35661
|
+
}
|
|
35651
35662
|
var argumentList = token() === 20 /* OpenParenToken */ ? parseArgumentList() : undefined;
|
|
35652
35663
|
return finishNode(factory.createNewExpression(expression, typeArguments, argumentList), pos);
|
|
35653
35664
|
}
|
|
@@ -43839,13 +43850,36 @@ var ts;
|
|
|
43839
43850
|
}
|
|
43840
43851
|
return toSearchResult(/*value*/ undefined);
|
|
43841
43852
|
}
|
|
43853
|
+
/**
|
|
43854
|
+
* From https://github.com/nodejs/node/blob/8f39f51cbbd3b2de14b9ee896e26421cc5b20121/lib/internal/modules/esm/resolve.js#L722 -
|
|
43855
|
+
* "longest" has some nuance as to what "longest" means in the presence of pattern trailers
|
|
43856
|
+
*/
|
|
43857
|
+
function comparePatternKeys(a, b) {
|
|
43858
|
+
var aPatternIndex = a.indexOf("*");
|
|
43859
|
+
var bPatternIndex = b.indexOf("*");
|
|
43860
|
+
var baseLenA = aPatternIndex === -1 ? a.length : aPatternIndex + 1;
|
|
43861
|
+
var baseLenB = bPatternIndex === -1 ? b.length : bPatternIndex + 1;
|
|
43862
|
+
if (baseLenA > baseLenB)
|
|
43863
|
+
return -1;
|
|
43864
|
+
if (baseLenB > baseLenA)
|
|
43865
|
+
return 1;
|
|
43866
|
+
if (aPatternIndex === -1)
|
|
43867
|
+
return 1;
|
|
43868
|
+
if (bPatternIndex === -1)
|
|
43869
|
+
return -1;
|
|
43870
|
+
if (a.length > b.length)
|
|
43871
|
+
return -1;
|
|
43872
|
+
if (b.length > a.length)
|
|
43873
|
+
return 1;
|
|
43874
|
+
return 0;
|
|
43875
|
+
}
|
|
43842
43876
|
function loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
|
|
43843
43877
|
var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
|
|
43844
43878
|
if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) {
|
|
43845
43879
|
var target = lookupTable[moduleName];
|
|
43846
43880
|
return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false);
|
|
43847
43881
|
}
|
|
43848
|
-
var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }),
|
|
43882
|
+
var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }), comparePatternKeys);
|
|
43849
43883
|
for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) {
|
|
43850
43884
|
var potentialTarget = expandingKeys_1[_i];
|
|
43851
43885
|
if (state.features & NodeResolutionFeatures.ExportsPatternTrailers && matchesPatternWithTrailer(potentialTarget, moduleName)) {
|
|
@@ -53424,6 +53458,7 @@ var ts;
|
|
|
53424
53458
|
return symbol.parent ? ts.factory.createQualifiedName(symbolToEntityNameNode(symbol.parent), identifier) : identifier;
|
|
53425
53459
|
}
|
|
53426
53460
|
function symbolToTypeNode(symbol, context, meaning, overrideTypeArguments) {
|
|
53461
|
+
var _a, _b, _c, _d;
|
|
53427
53462
|
var chain = lookupSymbolChain(symbol, context, meaning, !(context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */)); // If we're using aliases outside the current scope, dont bother with the module
|
|
53428
53463
|
var isTypeOf = meaning === 111551 /* Value */;
|
|
53429
53464
|
if (ts.some(chain[0].declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
|
|
@@ -53441,6 +53476,7 @@ var ts;
|
|
|
53441
53476
|
assertion = ts.factory.createImportTypeAssertionContainer(ts.factory.createAssertClause(ts.factory.createNodeArray([
|
|
53442
53477
|
ts.factory.createAssertEntry(ts.factory.createStringLiteral("resolution-mode"), ts.factory.createStringLiteral("import"))
|
|
53443
53478
|
])));
|
|
53479
|
+
(_b = (_a = context.tracker).reportImportTypeNodeResolutionModeOverride) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
53444
53480
|
}
|
|
53445
53481
|
}
|
|
53446
53482
|
if (!specifier) {
|
|
@@ -53460,6 +53496,7 @@ var ts;
|
|
|
53460
53496
|
assertion = ts.factory.createImportTypeAssertionContainer(ts.factory.createAssertClause(ts.factory.createNodeArray([
|
|
53461
53497
|
ts.factory.createAssertEntry(ts.factory.createStringLiteral("resolution-mode"), ts.factory.createStringLiteral(swappedMode === ts.ModuleKind.ESNext ? "import" : "require"))
|
|
53462
53498
|
])));
|
|
53499
|
+
(_d = (_c = context.tracker).reportImportTypeNodeResolutionModeOverride) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
53463
53500
|
}
|
|
53464
53501
|
}
|
|
53465
53502
|
if (!assertion) {
|
|
@@ -80869,8 +80906,11 @@ var ts;
|
|
|
80869
80906
|
if (node.assertions) {
|
|
80870
80907
|
var override = ts.getResolutionModeOverrideForClause(node.assertions.assertClause, grammarErrorOnNode);
|
|
80871
80908
|
if (override) {
|
|
80909
|
+
if (!ts.isNightly()) {
|
|
80910
|
+
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);
|
|
80911
|
+
}
|
|
80872
80912
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
80873
|
-
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.
|
|
80913
|
+
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
80874
80914
|
}
|
|
80875
80915
|
}
|
|
80876
80916
|
}
|
|
@@ -85276,10 +85316,10 @@ var ts;
|
|
|
85276
85316
|
var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
|
|
85277
85317
|
if (validForTypeAssertions && override) {
|
|
85278
85318
|
if (!ts.isNightly()) {
|
|
85279
|
-
grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
85319
|
+
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);
|
|
85280
85320
|
}
|
|
85281
85321
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
85282
|
-
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
85322
|
+
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
85283
85323
|
}
|
|
85284
85324
|
return; // Other grammar checks do not apply to type-only imports with resolution mode assertions
|
|
85285
85325
|
}
|
|
@@ -108138,7 +108178,8 @@ var ts;
|
|
|
108138
108178
|
trackReferencedAmbientModule: trackReferencedAmbientModule,
|
|
108139
108179
|
trackExternalModuleSymbolOfImportTypeNode: trackExternalModuleSymbolOfImportTypeNode,
|
|
108140
108180
|
reportNonlocalAugmentation: reportNonlocalAugmentation,
|
|
108141
|
-
reportNonSerializableProperty: reportNonSerializableProperty
|
|
108181
|
+
reportNonSerializableProperty: reportNonSerializableProperty,
|
|
108182
|
+
reportImportTypeNodeResolutionModeOverride: reportImportTypeNodeResolutionModeOverride,
|
|
108142
108183
|
};
|
|
108143
108184
|
var errorNameNode;
|
|
108144
108185
|
var errorFallbackNode;
|
|
@@ -108265,6 +108306,11 @@ var ts;
|
|
|
108265
108306
|
context.addDiagnostic(ts.createDiagnosticForNode((errorNameNode || errorFallbackNode), ts.Diagnostics.The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized, propertyName));
|
|
108266
108307
|
}
|
|
108267
108308
|
}
|
|
108309
|
+
function reportImportTypeNodeResolutionModeOverride() {
|
|
108310
|
+
if (!ts.isNightly() && (errorNameNode || errorFallbackNode)) {
|
|
108311
|
+
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));
|
|
108312
|
+
}
|
|
108313
|
+
}
|
|
108268
108314
|
function transformDeclarationsForJS(sourceFile, bundled) {
|
|
108269
108315
|
var oldDiag = getSymbolAccessibilityDiagnostic;
|
|
108270
108316
|
getSymbolAccessibilityDiagnostic = function (s) { return (s.errorNode && ts.canProduceDiagnostics(s.errorNode) ? ts.createGetSymbolAccessibilityDiagnosticForNode(s.errorNode)(s) : ({
|
|
@@ -108715,7 +108761,7 @@ var ts;
|
|
|
108715
108761
|
var mode = ts.getResolutionModeOverrideForClause(assertClause);
|
|
108716
108762
|
if (mode !== undefined) {
|
|
108717
108763
|
if (!ts.isNightly()) {
|
|
108718
|
-
context.addDiagnostic(ts.createDiagnosticForNode(assertClause, ts.Diagnostics.
|
|
108764
|
+
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));
|
|
108719
108765
|
}
|
|
108720
108766
|
return assertClause;
|
|
108721
108767
|
}
|
|
@@ -116224,12 +116270,14 @@ var ts;
|
|
|
116224
116270
|
}
|
|
116225
116271
|
ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache;
|
|
116226
116272
|
;
|
|
116227
|
-
|
|
116273
|
+
/**
|
|
116274
|
+
* Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly
|
|
116275
|
+
* provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file.
|
|
116276
|
+
*/
|
|
116228
116277
|
function getModeForFileReference(ref, containingFileMode) {
|
|
116229
116278
|
return (ts.isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
|
|
116230
116279
|
}
|
|
116231
116280
|
ts.getModeForFileReference = getModeForFileReference;
|
|
116232
|
-
/* @internal */
|
|
116233
116281
|
function getModeForResolutionAtIndex(file, index) {
|
|
116234
116282
|
if (file.impliedNodeFormat === undefined)
|
|
116235
116283
|
return undefined;
|
|
@@ -116250,7 +116298,15 @@ var ts;
|
|
|
116250
116298
|
return false;
|
|
116251
116299
|
}
|
|
116252
116300
|
ts.isExclusivelyTypeOnlyImportOrExport = isExclusivelyTypeOnlyImportOrExport;
|
|
116253
|
-
|
|
116301
|
+
/**
|
|
116302
|
+
* Calculates the final resolution mode for a given module reference node. This is generally the explicitly provided resolution mode, if
|
|
116303
|
+
* one exists, or the mode of the containing source file. (Excepting import=require, which is always commonjs, and dynamic import, which is always esm).
|
|
116304
|
+
* Notably, this function always returns `undefined` if the containing file has an `undefined` `impliedNodeFormat` - this field is only set when
|
|
116305
|
+
* `moduleResolution` is `node16`+.
|
|
116306
|
+
* @param file The file the import or import-like reference is contained within
|
|
116307
|
+
* @param usage The module reference string
|
|
116308
|
+
* @returns The final resolution mode of the import
|
|
116309
|
+
*/
|
|
116254
116310
|
function getModeForUsageLocation(file, usage) {
|
|
116255
116311
|
var _a, _b;
|
|
116256
116312
|
if (file.impliedNodeFormat === undefined)
|
|
@@ -118486,7 +118542,7 @@ var ts;
|
|
|
118486
118542
|
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
118487
118543
|
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
118488
118544
|
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
118489
|
-
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.
|
|
118545
|
+
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
|
|
118490
118546
|
}
|
|
118491
118547
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
118492
118548
|
}
|
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": "4.8.0-dev.
|
|
5
|
+
"version": "4.8.0-dev.20220603",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|