typescript 4.7.2 → 4.7.3
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 +78 -31
- package/lib/tsserver.js +100 -37
- package/lib/tsserverlibrary.d.ts +26 -0
- package/lib/tsserverlibrary.js +100 -37
- package/lib/typescript.d.ts +26 -0
- package/lib/typescript.js +100 -37
- package/lib/typescriptServices.d.ts +26 -0
- package/lib/typescriptServices.js +100 -37
- package/lib/typingsInstaller.js +98 -35
- package/package.json +1 -1
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 = "4.7.
|
|
92
|
+
ts.version = "4.7.3";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -8378,7 +8378,7 @@ var ts;
|
|
|
8378
8378
|
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."),
|
|
8379
8379
|
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"),
|
|
8380
8380
|
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"),
|
|
8381
|
-
|
|
8381
|
+
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`."),
|
|
8382
8382
|
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`."),
|
|
8383
8383
|
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."),
|
|
8384
8384
|
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."),
|
|
@@ -8882,6 +8882,7 @@ var ts;
|
|
|
8882
8882
|
Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls: diag(2836, ts.DiagnosticCategory.Error, "Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls_2836", "Import assertions are not allowed on statements that transpile to commonjs 'require' calls."),
|
|
8883
8883
|
Import_assertion_values_must_be_string_literal_expressions: diag(2837, ts.DiagnosticCategory.Error, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
|
|
8884
8884
|
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."),
|
|
8885
|
+
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'."),
|
|
8885
8886
|
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}'."),
|
|
8886
8887
|
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}'."),
|
|
8887
8888
|
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}'."),
|
|
@@ -8989,7 +8990,7 @@ var ts;
|
|
|
8989
8990
|
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}'."),
|
|
8990
8991
|
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}'?"),
|
|
8991
8992
|
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'."),
|
|
8992
|
-
|
|
8993
|
+
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'."),
|
|
8993
8994
|
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."),
|
|
8994
8995
|
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."),
|
|
8995
8996
|
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}'."),
|
|
@@ -16007,6 +16008,8 @@ var ts;
|
|
|
16007
16008
|
case 218 /* SyntaxKind.AwaitExpression */:
|
|
16008
16009
|
case 231 /* SyntaxKind.MetaProperty */:
|
|
16009
16010
|
return true;
|
|
16011
|
+
case 228 /* SyntaxKind.ExpressionWithTypeArguments */:
|
|
16012
|
+
return !ts.isHeritageClause(node.parent);
|
|
16010
16013
|
case 161 /* SyntaxKind.QualifiedName */:
|
|
16011
16014
|
while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) {
|
|
16012
16015
|
node = node.parent;
|
|
@@ -16178,9 +16181,6 @@ var ts;
|
|
|
16178
16181
|
}
|
|
16179
16182
|
ts.isVariableDeclarationInitializedToBareOrAccessedRequire = isVariableDeclarationInitializedToBareOrAccessedRequire;
|
|
16180
16183
|
function isVariableDeclarationInitializedWithRequireHelper(node, allowAccessedRequire) {
|
|
16181
|
-
if (node.kind === 203 /* SyntaxKind.BindingElement */) {
|
|
16182
|
-
node = node.parent.parent;
|
|
16183
|
-
}
|
|
16184
16184
|
return ts.isVariableDeclaration(node) &&
|
|
16185
16185
|
!!node.initializer &&
|
|
16186
16186
|
isRequireCall(allowAccessedRequire ? getLeftmostAccessExpression(node.initializer) : node.initializer, /*requireStringLiteralLikeArgument*/ true);
|
|
@@ -20002,8 +20002,9 @@ var ts;
|
|
|
20002
20002
|
*/
|
|
20003
20003
|
function isFileForcedToBeModuleByFormat(file) {
|
|
20004
20004
|
// Excludes declaration files - they still require an explicit `export {}` or the like
|
|
20005
|
-
// for back compat purposes.
|
|
20006
|
-
|
|
20005
|
+
// for back compat purposes. The only non-declaration files _not_ forced to be a module are `.js` files
|
|
20006
|
+
// that aren't esm-mode (meaning not in a `type: module` scope).
|
|
20007
|
+
return (file.impliedNodeFormat === ts.ModuleKind.ESNext || (ts.fileExtensionIsOneOf(file.fileName, [".cjs" /* Extension.Cjs */, ".cts" /* Extension.Cts */]))) && !file.isDeclarationFile ? true : undefined;
|
|
20007
20008
|
}
|
|
20008
20009
|
function getSetExternalModuleIndicator(options) {
|
|
20009
20010
|
// TODO: Should this callback be cached?
|
|
@@ -20011,7 +20012,7 @@ var ts;
|
|
|
20011
20012
|
case ts.ModuleDetectionKind.Force:
|
|
20012
20013
|
// All non-declaration files are modules, declaration files still do the usual isFileProbablyExternalModule
|
|
20013
20014
|
return function (file) {
|
|
20014
|
-
file.externalModuleIndicator = !file.isDeclarationFile ||
|
|
20015
|
+
file.externalModuleIndicator = ts.isFileProbablyExternalModule(file) || !file.isDeclarationFile || undefined;
|
|
20015
20016
|
};
|
|
20016
20017
|
case ts.ModuleDetectionKind.Legacy:
|
|
20017
20018
|
// Files are modules if they have imports, exports, or import.meta
|
|
@@ -20071,7 +20072,8 @@ var ts;
|
|
|
20071
20072
|
}
|
|
20072
20073
|
ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;
|
|
20073
20074
|
function getEmitModuleDetectionKind(options) {
|
|
20074
|
-
return options.moduleDetection ||
|
|
20075
|
+
return options.moduleDetection ||
|
|
20076
|
+
(getEmitModuleKind(options) === ts.ModuleKind.Node16 || getEmitModuleKind(options) === ts.ModuleKind.NodeNext ? ts.ModuleDetectionKind.Force : ts.ModuleDetectionKind.Auto);
|
|
20075
20077
|
}
|
|
20076
20078
|
ts.getEmitModuleDetectionKind = getEmitModuleDetectionKind;
|
|
20077
20079
|
function hasJsonModuleEmitEnabled(options) {
|
|
@@ -29051,6 +29053,10 @@ var ts;
|
|
|
29051
29053
|
return node.kind === 267 /* SyntaxKind.ImportClause */;
|
|
29052
29054
|
}
|
|
29053
29055
|
ts.isImportClause = isImportClause;
|
|
29056
|
+
function isImportTypeAssertionContainer(node) {
|
|
29057
|
+
return node.kind === 295 /* SyntaxKind.ImportTypeAssertionContainer */;
|
|
29058
|
+
}
|
|
29059
|
+
ts.isImportTypeAssertionContainer = isImportTypeAssertionContainer;
|
|
29054
29060
|
function isAssertClause(node) {
|
|
29055
29061
|
return node.kind === 293 /* SyntaxKind.AssertClause */;
|
|
29056
29062
|
}
|
|
@@ -41995,7 +42001,7 @@ var ts;
|
|
|
41995
42001
|
}
|
|
41996
42002
|
if (ts.isImplicitGlob(spec.substring(spec.lastIndexOf(ts.directorySeparator) + 1))) {
|
|
41997
42003
|
return {
|
|
41998
|
-
key: useCaseSensitiveFileNames ? spec : ts.toFileNameLowerCase(spec),
|
|
42004
|
+
key: ts.removeTrailingDirectorySeparator(useCaseSensitiveFileNames ? spec : ts.toFileNameLowerCase(spec)),
|
|
41999
42005
|
flags: 1 /* WatchDirectoryFlags.Recursive */
|
|
42000
42006
|
};
|
|
42001
42007
|
}
|
|
@@ -43100,16 +43106,20 @@ var ts;
|
|
|
43100
43106
|
function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
43101
43107
|
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.NodeNextDefault, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
43102
43108
|
}
|
|
43109
|
+
var jsOnlyExtensions = [Extensions.JavaScript];
|
|
43110
|
+
var tsExtensions = [Extensions.TypeScript, Extensions.JavaScript];
|
|
43111
|
+
var tsPlusJsonExtensions = __spreadArray(__spreadArray([], tsExtensions, true), [Extensions.Json], false);
|
|
43112
|
+
var tsconfigExtensions = [Extensions.TSConfig];
|
|
43103
43113
|
function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
43104
43114
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
43105
43115
|
// es module file or cjs-like input file, use a variant of the legacy cjs resolver that supports the selected modern features
|
|
43106
43116
|
var esmMode = resolutionMode === ts.ModuleKind.ESNext ? NodeResolutionFeatures.EsmMode : 0;
|
|
43107
|
-
|
|
43117
|
+
var extensions = compilerOptions.noDtsResolution ? [Extensions.TsOnly, Extensions.JavaScript] : tsExtensions;
|
|
43118
|
+
if (compilerOptions.resolveJsonModule) {
|
|
43119
|
+
extensions = __spreadArray(__spreadArray([], extensions, true), [Extensions.Json], false);
|
|
43120
|
+
}
|
|
43121
|
+
return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference);
|
|
43108
43122
|
}
|
|
43109
|
-
var jsOnlyExtensions = [Extensions.JavaScript];
|
|
43110
|
-
var tsExtensions = [Extensions.TypeScript, Extensions.JavaScript];
|
|
43111
|
-
var tsPlusJsonExtensions = __spreadArray(__spreadArray([], tsExtensions, true), [Extensions.Json], false);
|
|
43112
|
-
var tsconfigExtensions = [Extensions.TSConfig];
|
|
43113
43123
|
function tryResolveJSModuleWorker(moduleName, initialDir, host) {
|
|
43114
43124
|
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined);
|
|
43115
43125
|
}
|
|
@@ -43792,13 +43802,36 @@ var ts;
|
|
|
43792
43802
|
}
|
|
43793
43803
|
return toSearchResult(/*value*/ undefined);
|
|
43794
43804
|
}
|
|
43805
|
+
/**
|
|
43806
|
+
* From https://github.com/nodejs/node/blob/8f39f51cbbd3b2de14b9ee896e26421cc5b20121/lib/internal/modules/esm/resolve.js#L722 -
|
|
43807
|
+
* "longest" has some nuance as to what "longest" means in the presence of pattern trailers
|
|
43808
|
+
*/
|
|
43809
|
+
function comparePatternKeys(a, b) {
|
|
43810
|
+
var aPatternIndex = a.indexOf("*");
|
|
43811
|
+
var bPatternIndex = b.indexOf("*");
|
|
43812
|
+
var baseLenA = aPatternIndex === -1 ? a.length : aPatternIndex + 1;
|
|
43813
|
+
var baseLenB = bPatternIndex === -1 ? b.length : bPatternIndex + 1;
|
|
43814
|
+
if (baseLenA > baseLenB)
|
|
43815
|
+
return -1;
|
|
43816
|
+
if (baseLenB > baseLenA)
|
|
43817
|
+
return 1;
|
|
43818
|
+
if (aPatternIndex === -1)
|
|
43819
|
+
return 1;
|
|
43820
|
+
if (bPatternIndex === -1)
|
|
43821
|
+
return -1;
|
|
43822
|
+
if (a.length > b.length)
|
|
43823
|
+
return -1;
|
|
43824
|
+
if (b.length > a.length)
|
|
43825
|
+
return 1;
|
|
43826
|
+
return 0;
|
|
43827
|
+
}
|
|
43795
43828
|
function loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
|
|
43796
43829
|
var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
|
|
43797
43830
|
if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) {
|
|
43798
43831
|
var target = lookupTable[moduleName];
|
|
43799
43832
|
return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false);
|
|
43800
43833
|
}
|
|
43801
|
-
var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }),
|
|
43834
|
+
var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }), comparePatternKeys);
|
|
43802
43835
|
for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) {
|
|
43803
43836
|
var potentialTarget = expandingKeys_1[_i];
|
|
43804
43837
|
if (state.features & NodeResolutionFeatures.ExportsPatternTrailers && matchesPatternWithTrailer(potentialTarget, moduleName)) {
|
|
@@ -44117,8 +44150,8 @@ var ts;
|
|
|
44117
44150
|
var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
|
|
44118
44151
|
loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
|
|
44119
44152
|
if (!pathAndExtension && packageInfo
|
|
44120
|
-
|
|
44121
|
-
&& packageInfo.packageJsonContent.
|
|
44153
|
+
// eslint-disable-next-line no-null/no-null
|
|
44154
|
+
&& (packageInfo.packageJsonContent.exports === undefined || packageInfo.packageJsonContent.exports === null)
|
|
44122
44155
|
&& state.features & NodeResolutionFeatures.EsmMode) {
|
|
44123
44156
|
// EsmMode disables index lookup in `loadNodeModuleFromDirectoryWorker` generally, however non-relative package resolutions still assume
|
|
44124
44157
|
// a default `index.js` entrypoint if no `main` or `exports` are present
|
|
@@ -46894,12 +46927,14 @@ var ts;
|
|
|
46894
46927
|
}
|
|
46895
46928
|
}
|
|
46896
46929
|
function setCommonJsModuleIndicator(node) {
|
|
46897
|
-
if (file.externalModuleIndicator) {
|
|
46930
|
+
if (file.externalModuleIndicator && file.externalModuleIndicator !== true) {
|
|
46898
46931
|
return false;
|
|
46899
46932
|
}
|
|
46900
46933
|
if (!file.commonJsModuleIndicator) {
|
|
46901
46934
|
file.commonJsModuleIndicator = node;
|
|
46902
|
-
|
|
46935
|
+
if (!file.externalModuleIndicator) {
|
|
46936
|
+
bindSourceFileAsExternalModule();
|
|
46937
|
+
}
|
|
46903
46938
|
}
|
|
46904
46939
|
return true;
|
|
46905
46940
|
}
|
|
@@ -47313,7 +47348,11 @@ var ts;
|
|
|
47313
47348
|
checkStrictModeEvalOrArguments(node, node.name);
|
|
47314
47349
|
}
|
|
47315
47350
|
if (!ts.isBindingPattern(node.name)) {
|
|
47316
|
-
|
|
47351
|
+
var possibleVariableDecl = node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? node : node.parent.parent;
|
|
47352
|
+
if (ts.isInJSFile(node) &&
|
|
47353
|
+
ts.isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) &&
|
|
47354
|
+
!ts.getJSDocTypeTag(node) &&
|
|
47355
|
+
!(ts.getCombinedModifierFlags(node) & 1 /* ModifierFlags.Export */)) {
|
|
47317
47356
|
declareSymbolAndAddToSymbolTable(node, 2097152 /* SymbolFlags.Alias */, 2097152 /* SymbolFlags.AliasExcludes */);
|
|
47318
47357
|
}
|
|
47319
47358
|
else if (ts.isBlockOrCatchScoped(node)) {
|
|
@@ -50140,7 +50179,8 @@ var ts;
|
|
|
50140
50179
|
&& isAliasableOrJsExpression(node.parent.right)
|
|
50141
50180
|
|| node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */
|
|
50142
50181
|
|| node.kind === 296 /* SyntaxKind.PropertyAssignment */ && isAliasableOrJsExpression(node.initializer)
|
|
50143
|
-
|| ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)
|
|
50182
|
+
|| node.kind === 254 /* SyntaxKind.VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)
|
|
50183
|
+
|| node.kind === 203 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent);
|
|
50144
50184
|
}
|
|
50145
50185
|
function isAliasableOrJsExpression(e) {
|
|
50146
50186
|
return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e);
|
|
@@ -50233,7 +50273,7 @@ var ts;
|
|
|
50233
50273
|
return hasExportAssignmentSymbol(moduleSymbol);
|
|
50234
50274
|
}
|
|
50235
50275
|
// JS files have a synthetic default if they do not contain ES2015+ module syntax (export = is not valid in js) _and_ do not have an __esModule marker
|
|
50236
|
-
return
|
|
50276
|
+
return typeof file.externalModuleIndicator !== "object" && !resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), /*sourceNode*/ undefined, dontResolveAlias);
|
|
50237
50277
|
}
|
|
50238
50278
|
function getTargetOfImportClause(node, dontResolveAlias) {
|
|
50239
50279
|
var _a;
|
|
@@ -53348,6 +53388,7 @@ var ts;
|
|
|
53348
53388
|
return symbol.parent ? ts.factory.createQualifiedName(symbolToEntityNameNode(symbol.parent), identifier) : identifier;
|
|
53349
53389
|
}
|
|
53350
53390
|
function symbolToTypeNode(symbol, context, meaning, overrideTypeArguments) {
|
|
53391
|
+
var _a, _b, _c, _d;
|
|
53351
53392
|
var chain = lookupSymbolChain(symbol, context, meaning, !(context.flags & 16384 /* NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope */)); // If we're using aliases outside the current scope, dont bother with the module
|
|
53352
53393
|
var isTypeOf = meaning === 111551 /* SymbolFlags.Value */;
|
|
53353
53394
|
if (ts.some(chain[0].declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
|
|
@@ -53365,6 +53406,7 @@ var ts;
|
|
|
53365
53406
|
assertion = ts.factory.createImportTypeAssertionContainer(ts.factory.createAssertClause(ts.factory.createNodeArray([
|
|
53366
53407
|
ts.factory.createAssertEntry(ts.factory.createStringLiteral("resolution-mode"), ts.factory.createStringLiteral("import"))
|
|
53367
53408
|
])));
|
|
53409
|
+
(_b = (_a = context.tracker).reportImportTypeNodeResolutionModeOverride) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
53368
53410
|
}
|
|
53369
53411
|
}
|
|
53370
53412
|
if (!specifier) {
|
|
@@ -53384,6 +53426,7 @@ var ts;
|
|
|
53384
53426
|
assertion = ts.factory.createImportTypeAssertionContainer(ts.factory.createAssertClause(ts.factory.createNodeArray([
|
|
53385
53427
|
ts.factory.createAssertEntry(ts.factory.createStringLiteral("resolution-mode"), ts.factory.createStringLiteral(swappedMode === ts.ModuleKind.ESNext ? "import" : "require"))
|
|
53386
53428
|
])));
|
|
53429
|
+
(_d = (_c = context.tracker).reportImportTypeNodeResolutionModeOverride) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
53387
53430
|
}
|
|
53388
53431
|
}
|
|
53389
53432
|
if (!assertion) {
|
|
@@ -58872,7 +58915,7 @@ var ts;
|
|
|
58872
58915
|
var objectType;
|
|
58873
58916
|
return !!(type.flags & 8388608 /* TypeFlags.IndexedAccess */ && ts.getObjectFlags(objectType = type.objectType) & 32 /* ObjectFlags.Mapped */ &&
|
|
58874
58917
|
!isGenericMappedType(objectType) && isGenericIndexType(type.indexType) &&
|
|
58875
|
-
!objectType.
|
|
58918
|
+
!(getMappedTypeModifiers(objectType) & 8 /* MappedTypeModifiers.ExcludeOptional */) && !objectType.declaration.nameType);
|
|
58876
58919
|
}
|
|
58877
58920
|
/**
|
|
58878
58921
|
* For a type parameter, return the base constraint of the type parameter. For the string, number,
|
|
@@ -80623,8 +80666,11 @@ var ts;
|
|
|
80623
80666
|
if (node.assertions) {
|
|
80624
80667
|
var override = ts.getResolutionModeOverrideForClause(node.assertions.assertClause, grammarErrorOnNode);
|
|
80625
80668
|
if (override) {
|
|
80669
|
+
if (!ts.isNightly()) {
|
|
80670
|
+
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);
|
|
80671
|
+
}
|
|
80626
80672
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
80627
|
-
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.
|
|
80673
|
+
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
80628
80674
|
}
|
|
80629
80675
|
}
|
|
80630
80676
|
}
|
|
@@ -82327,7 +82373,7 @@ var ts;
|
|
|
82327
82373
|
}
|
|
82328
82374
|
// For a commonjs `const x = require`, validate the alias and exit
|
|
82329
82375
|
var symbol = getSymbolOfNode(node);
|
|
82330
|
-
if (symbol.flags & 2097152 /* SymbolFlags.Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)) {
|
|
82376
|
+
if (symbol.flags & 2097152 /* SymbolFlags.Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 203 /* SyntaxKind.BindingElement */ ? node.parent.parent : node)) {
|
|
82331
82377
|
checkAliasSymbol(node);
|
|
82332
82378
|
return;
|
|
82333
82379
|
}
|
|
@@ -84995,10 +85041,10 @@ var ts;
|
|
|
84995
85041
|
var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
|
|
84996
85042
|
if (validForTypeAssertions && override) {
|
|
84997
85043
|
if (!ts.isNightly()) {
|
|
84998
|
-
grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
85044
|
+
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);
|
|
84999
85045
|
}
|
|
85000
85046
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
85001
|
-
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
85047
|
+
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
85002
85048
|
}
|
|
85003
85049
|
return; // Other grammar checks do not apply to type-only imports with resolution mode assertions
|
|
85004
85050
|
}
|
|
@@ -107850,7 +107896,8 @@ var ts;
|
|
|
107850
107896
|
trackReferencedAmbientModule: trackReferencedAmbientModule,
|
|
107851
107897
|
trackExternalModuleSymbolOfImportTypeNode: trackExternalModuleSymbolOfImportTypeNode,
|
|
107852
107898
|
reportNonlocalAugmentation: reportNonlocalAugmentation,
|
|
107853
|
-
reportNonSerializableProperty: reportNonSerializableProperty
|
|
107899
|
+
reportNonSerializableProperty: reportNonSerializableProperty,
|
|
107900
|
+
reportImportTypeNodeResolutionModeOverride: reportImportTypeNodeResolutionModeOverride,
|
|
107854
107901
|
};
|
|
107855
107902
|
var errorNameNode;
|
|
107856
107903
|
var errorFallbackNode;
|
|
@@ -107977,6 +108024,11 @@ var ts;
|
|
|
107977
108024
|
context.addDiagnostic(ts.createDiagnosticForNode((errorNameNode || errorFallbackNode), ts.Diagnostics.The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized, propertyName));
|
|
107978
108025
|
}
|
|
107979
108026
|
}
|
|
108027
|
+
function reportImportTypeNodeResolutionModeOverride() {
|
|
108028
|
+
if (!ts.isNightly() && (errorNameNode || errorFallbackNode)) {
|
|
108029
|
+
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));
|
|
108030
|
+
}
|
|
108031
|
+
}
|
|
107980
108032
|
function transformDeclarationsForJS(sourceFile, bundled) {
|
|
107981
108033
|
var oldDiag = getSymbolAccessibilityDiagnostic;
|
|
107982
108034
|
getSymbolAccessibilityDiagnostic = function (s) { return (s.errorNode && ts.canProduceDiagnostics(s.errorNode) ? ts.createGetSymbolAccessibilityDiagnosticForNode(s.errorNode)(s) : ({
|
|
@@ -108427,7 +108479,7 @@ var ts;
|
|
|
108427
108479
|
var mode = ts.getResolutionModeOverrideForClause(assertClause);
|
|
108428
108480
|
if (mode !== undefined) {
|
|
108429
108481
|
if (!ts.isNightly()) {
|
|
108430
|
-
context.addDiagnostic(ts.createDiagnosticForNode(assertClause, ts.Diagnostics.
|
|
108482
|
+
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));
|
|
108431
108483
|
}
|
|
108432
108484
|
return assertClause;
|
|
108433
108485
|
}
|
|
@@ -115934,12 +115986,14 @@ var ts;
|
|
|
115934
115986
|
}
|
|
115935
115987
|
ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache;
|
|
115936
115988
|
;
|
|
115937
|
-
|
|
115989
|
+
/**
|
|
115990
|
+
* Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly
|
|
115991
|
+
* provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file.
|
|
115992
|
+
*/
|
|
115938
115993
|
function getModeForFileReference(ref, containingFileMode) {
|
|
115939
115994
|
return (ts.isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
|
|
115940
115995
|
}
|
|
115941
115996
|
ts.getModeForFileReference = getModeForFileReference;
|
|
115942
|
-
/* @internal */
|
|
115943
115997
|
function getModeForResolutionAtIndex(file, index) {
|
|
115944
115998
|
if (file.impliedNodeFormat === undefined)
|
|
115945
115999
|
return undefined;
|
|
@@ -115960,7 +116014,15 @@ var ts;
|
|
|
115960
116014
|
return false;
|
|
115961
116015
|
}
|
|
115962
116016
|
ts.isExclusivelyTypeOnlyImportOrExport = isExclusivelyTypeOnlyImportOrExport;
|
|
115963
|
-
|
|
116017
|
+
/**
|
|
116018
|
+
* Calculates the final resolution mode for a given module reference node. This is generally the explicitly provided resolution mode, if
|
|
116019
|
+
* one exists, or the mode of the containing source file. (Excepting import=require, which is always commonjs, and dynamic import, which is always esm).
|
|
116020
|
+
* Notably, this function always returns `undefined` if the containing file has an `undefined` `impliedNodeFormat` - this field is only set when
|
|
116021
|
+
* `moduleResolution` is `node16`+.
|
|
116022
|
+
* @param file The file the import or import-like reference is contained within
|
|
116023
|
+
* @param usage The module reference string
|
|
116024
|
+
* @returns The final resolution mode of the import
|
|
116025
|
+
*/
|
|
115964
116026
|
function getModeForUsageLocation(file, usage) {
|
|
115965
116027
|
var _a, _b;
|
|
115966
116028
|
if (file.impliedNodeFormat === undefined)
|
|
@@ -118194,7 +118256,7 @@ var ts;
|
|
|
118194
118256
|
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
118195
118257
|
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
118196
118258
|
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
118197
|
-
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.
|
|
118259
|
+
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
|
|
118198
118260
|
}
|
|
118199
118261
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
118200
118262
|
}
|
|
@@ -123487,6 +123549,7 @@ var ts;
|
|
|
123487
123549
|
}
|
|
123488
123550
|
function reloadFileNamesFromConfigFile() {
|
|
123489
123551
|
writeLog("Reloading new file names and options");
|
|
123552
|
+
reloadLevel = ts.ConfigFileProgramReloadLevel.None;
|
|
123490
123553
|
rootFileNames = ts.getFileNamesFromConfigSpecs(compilerOptions.configFile.configFileSpecs, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost, extraFileExtensions);
|
|
123491
123554
|
if (ts.updateErrorForNoInputFiles(rootFileNames, ts.getNormalizedAbsolutePath(configFileName, currentDirectory), compilerOptions.configFile.configFileSpecs, configFileParsingDiagnostics, canConfigFileJsonReportNoInputFiles)) {
|
|
123492
123555
|
hasChangedConfigFileParsingErrors = true;
|
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.7.
|
|
5
|
+
"version": "4.7.3",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|