typescript 4.7.0-dev.20220506 → 4.8.0-dev.20220507
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 +48 -25
- package/lib/tsserver.js +51 -28
- package/lib/tsserverlibrary.d.ts +1 -1
- package/lib/tsserverlibrary.js +51 -28
- package/lib/typescript.d.ts +1 -1
- package/lib/typescript.js +51 -28
- package/lib/typescriptServices.d.ts +1 -1
- package/lib/typescriptServices.js +51 -28
- package/lib/typingsInstaller.js +51 -28
- package/package.json +1 -1
|
@@ -290,11 +290,11 @@ var ts;
|
|
|
290
290
|
(function (ts) {
|
|
291
291
|
// WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values.
|
|
292
292
|
// If changing the text in this section, be sure to test `configurePrerelease` too.
|
|
293
|
-
ts.versionMajorMinor = "4.
|
|
293
|
+
ts.versionMajorMinor = "4.8";
|
|
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.20220507";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -9194,6 +9194,7 @@ var ts;
|
|
|
9194
9194
|
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}'."),
|
|
9195
9195
|
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}'?"),
|
|
9196
9196
|
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'."),
|
|
9197
|
+
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'."),
|
|
9197
9198
|
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."),
|
|
9198
9199
|
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."),
|
|
9199
9200
|
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}'."),
|
|
@@ -18200,6 +18201,10 @@ var ts;
|
|
|
18200
18201
|
return indentStrings[1].length;
|
|
18201
18202
|
}
|
|
18202
18203
|
ts.getIndentSize = getIndentSize;
|
|
18204
|
+
function isNightly() {
|
|
18205
|
+
return ts.stringContains(ts.version, "-dev") || ts.stringContains(ts.version, "-insiders");
|
|
18206
|
+
}
|
|
18207
|
+
ts.isNightly = isNightly;
|
|
18203
18208
|
function createTextWriter(newLine) {
|
|
18204
18209
|
var output;
|
|
18205
18210
|
var indent;
|
|
@@ -33047,6 +33052,7 @@ var ts;
|
|
|
33047
33052
|
var startPos = scanner.getStartPos();
|
|
33048
33053
|
var result = parseListElement(kind, parseElement);
|
|
33049
33054
|
if (!result) {
|
|
33055
|
+
parsingContext = saveParsingContext;
|
|
33050
33056
|
return undefined;
|
|
33051
33057
|
}
|
|
33052
33058
|
list.push(result);
|
|
@@ -85189,6 +85195,9 @@ var ts;
|
|
|
85189
85195
|
var validForTypeAssertions = ts.isExclusivelyTypeOnlyImportOrExport(declaration);
|
|
85190
85196
|
var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
|
|
85191
85197
|
if (validForTypeAssertions && override) {
|
|
85198
|
+
if (!ts.isNightly()) {
|
|
85199
|
+
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);
|
|
85200
|
+
}
|
|
85192
85201
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
85193
85202
|
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
85194
85203
|
}
|
|
@@ -108587,34 +108596,44 @@ var ts;
|
|
|
108587
108596
|
if (!decl.importClause) {
|
|
108588
108597
|
// import "mod" - possibly needed for side effects? (global interface patches, module augmentations, etc)
|
|
108589
108598
|
return factory.updateImportDeclaration(decl,
|
|
108590
|
-
/*decorators*/ undefined, decl.modifiers, decl.importClause, rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108599
|
+
/*decorators*/ undefined, decl.modifiers, decl.importClause, rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
108591
108600
|
}
|
|
108592
108601
|
// The `importClause` visibility corresponds to the default's visibility.
|
|
108593
108602
|
var visibleDefaultBinding = decl.importClause && decl.importClause.name && resolver.isDeclarationVisible(decl.importClause) ? decl.importClause.name : undefined;
|
|
108594
108603
|
if (!decl.importClause.namedBindings) {
|
|
108595
108604
|
// No named bindings (either namespace or list), meaning the import is just default or should be elided
|
|
108596
108605
|
return visibleDefaultBinding && factory.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding,
|
|
108597
|
-
/*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108606
|
+
/*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
108598
108607
|
}
|
|
108599
108608
|
if (decl.importClause.namedBindings.kind === 268 /* NamespaceImport */) {
|
|
108600
108609
|
// Namespace import (optionally with visible default)
|
|
108601
108610
|
var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined;
|
|
108602
|
-
return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108611
|
+
return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)) : undefined;
|
|
108603
108612
|
}
|
|
108604
108613
|
// Named imports (optionally with visible default)
|
|
108605
108614
|
var bindingList = ts.mapDefined(decl.importClause.namedBindings.elements, function (b) { return resolver.isDeclarationVisible(b) ? b : undefined; });
|
|
108606
108615
|
if ((bindingList && bindingList.length) || visibleDefaultBinding) {
|
|
108607
108616
|
return factory.updateImportDeclaration(decl,
|
|
108608
|
-
/*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, bindingList && bindingList.length ? factory.updateNamedImports(decl.importClause.namedBindings, bindingList) : undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108617
|
+
/*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, bindingList && bindingList.length ? factory.updateNamedImports(decl.importClause.namedBindings, bindingList) : undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
108609
108618
|
}
|
|
108610
108619
|
// Augmentation of export depends on import
|
|
108611
108620
|
if (resolver.isImportRequiredByAugmentation(decl)) {
|
|
108612
108621
|
return factory.updateImportDeclaration(decl,
|
|
108613
108622
|
/*decorators*/ undefined, decl.modifiers,
|
|
108614
|
-
/*importClause*/ undefined, rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108623
|
+
/*importClause*/ undefined, rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
108615
108624
|
}
|
|
108616
108625
|
// Nothing visible
|
|
108617
108626
|
}
|
|
108627
|
+
function getResolutionModeOverrideForClauseInNightly(assertClause) {
|
|
108628
|
+
var mode = ts.getResolutionModeOverrideForClause(assertClause);
|
|
108629
|
+
if (mode !== undefined) {
|
|
108630
|
+
if (!ts.isNightly()) {
|
|
108631
|
+
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));
|
|
108632
|
+
}
|
|
108633
|
+
return assertClause;
|
|
108634
|
+
}
|
|
108635
|
+
return undefined;
|
|
108636
|
+
}
|
|
108618
108637
|
function transformAndReplaceLatePaintedStatements(statements) {
|
|
108619
108638
|
// This is a `while` loop because `handleSymbolAccessibilityError` can see additional import aliases marked as visible during
|
|
108620
108639
|
// error handling which must now be included in the output and themselves checked for errors.
|
|
@@ -121922,14 +121941,14 @@ var ts;
|
|
|
121922
121941
|
if (options === void 0) { options = {}; }
|
|
121923
121942
|
var info = getInfo(importingSourceFile.path, host);
|
|
121924
121943
|
var modulePaths = getAllModulePaths(importingSourceFile.path, nodeModulesFileName, host, preferences, options);
|
|
121925
|
-
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ true, options.overrideImportMode); });
|
|
121944
|
+
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, preferences, /*packageNameOnly*/ true, options.overrideImportMode); });
|
|
121926
121945
|
}
|
|
121927
121946
|
moduleSpecifiers_1.getNodeModulesPackageName = getNodeModulesPackageName;
|
|
121928
121947
|
function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host, preferences, userPreferences, options) {
|
|
121929
121948
|
if (options === void 0) { options = {}; }
|
|
121930
121949
|
var info = getInfo(importingSourceFileName, host);
|
|
121931
121950
|
var modulePaths = getAllModulePaths(importingSourceFileName, toFileName, host, userPreferences, options);
|
|
121932
|
-
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ undefined, options.overrideImportMode); }) ||
|
|
121951
|
+
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, userPreferences, /*packageNameOnly*/ undefined, options.overrideImportMode); }) ||
|
|
121933
121952
|
getLocalModuleSpecifier(toFileName, info, compilerOptions, host, preferences);
|
|
121934
121953
|
}
|
|
121935
121954
|
function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences, options) {
|
|
@@ -122005,7 +122024,7 @@ var ts;
|
|
|
122005
122024
|
var relativeSpecifiers;
|
|
122006
122025
|
for (var _i = 0, modulePaths_1 = modulePaths; _i < modulePaths_1.length; _i++) {
|
|
122007
122026
|
var modulePath = modulePaths_1[_i];
|
|
122008
|
-
var specifier = tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ undefined, options.overrideImportMode);
|
|
122027
|
+
var specifier = tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, userPreferences, /*packageNameOnly*/ undefined, options.overrideImportMode);
|
|
122009
122028
|
nodeModulesSpecifiers = ts.append(nodeModulesSpecifiers, specifier);
|
|
122010
122029
|
if (specifier && modulePath.isRedirect) {
|
|
122011
122030
|
// If we got a specifier for a redirect, it was a bare package specifier (e.g. "@foo/bar",
|
|
@@ -122398,7 +122417,7 @@ var ts;
|
|
|
122398
122417
|
? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions)
|
|
122399
122418
|
: ts.removeFileExtension(relativePath);
|
|
122400
122419
|
}
|
|
122401
|
-
function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, packageNameOnly, overrideMode) {
|
|
122420
|
+
function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
|
|
122402
122421
|
var path = _a.path, isRedirect = _a.isRedirect;
|
|
122403
122422
|
var getCanonicalFileName = _b.getCanonicalFileName, sourceDirectory = _b.sourceDirectory;
|
|
122404
122423
|
if (!host.fileExists || !host.readFile) {
|
|
@@ -122412,8 +122431,9 @@ var ts;
|
|
|
122412
122431
|
var moduleSpecifier = path;
|
|
122413
122432
|
var isPackageRootPath = false;
|
|
122414
122433
|
if (!packageNameOnly) {
|
|
122434
|
+
var preferences = getPreferences(host, userPreferences, options, importingSourceFile);
|
|
122415
122435
|
var packageRootIndex = parts.packageRootIndex;
|
|
122416
|
-
var
|
|
122436
|
+
var moduleFileName = void 0;
|
|
122417
122437
|
while (true) {
|
|
122418
122438
|
// If the module could be imported by a directory name, use that directory's name
|
|
122419
122439
|
var _c = tryDirectoryWithPackageJson(packageRootIndex), moduleFileToTry = _c.moduleFileToTry, packageRootPath = _c.packageRootPath, blockedByExports = _c.blockedByExports, verbatimFromExports = _c.verbatimFromExports;
|
|
@@ -122430,12 +122450,12 @@ var ts;
|
|
|
122430
122450
|
isPackageRootPath = true;
|
|
122431
122451
|
break;
|
|
122432
122452
|
}
|
|
122433
|
-
if (!
|
|
122434
|
-
|
|
122453
|
+
if (!moduleFileName)
|
|
122454
|
+
moduleFileName = moduleFileToTry;
|
|
122435
122455
|
// try with next level of directory
|
|
122436
122456
|
packageRootIndex = path.indexOf(ts.directorySeparator, packageRootIndex + 1);
|
|
122437
122457
|
if (packageRootIndex === -1) {
|
|
122438
|
-
moduleSpecifier =
|
|
122458
|
+
moduleSpecifier = removeExtensionAndIndexPostFix(moduleFileName, preferences.ending, options, host);
|
|
122439
122459
|
break;
|
|
122440
122460
|
}
|
|
122441
122461
|
}
|
|
@@ -122493,7 +122513,7 @@ var ts;
|
|
|
122493
122513
|
}
|
|
122494
122514
|
}
|
|
122495
122515
|
// If the file is the main module, it can be imported by the package name
|
|
122496
|
-
var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main;
|
|
122516
|
+
var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main || "index.js";
|
|
122497
122517
|
if (ts.isString(mainFileRelative)) {
|
|
122498
122518
|
var mainExportFile = ts.toPath(mainFileRelative, packageRootPath, getCanonicalFileName);
|
|
122499
122519
|
if (ts.removeFileExtension(mainExportFile) === ts.removeFileExtension(getCanonicalFileName(moduleFileToTry))) {
|
|
@@ -122501,17 +122521,14 @@ var ts;
|
|
|
122501
122521
|
}
|
|
122502
122522
|
}
|
|
122503
122523
|
}
|
|
122504
|
-
|
|
122505
|
-
|
|
122506
|
-
|
|
122507
|
-
|
|
122508
|
-
|
|
122509
|
-
|
|
122510
|
-
// IFF there is not _also_ a file by the same name
|
|
122511
|
-
if (getCanonicalFileName(fullModulePathWithoutExtension.substring(parts.fileNameIndex)) === "/index" && !tryGetAnyFileFromPath(host, fullModulePathWithoutExtension.substring(0, parts.fileNameIndex))) {
|
|
122512
|
-
return fullModulePathWithoutExtension.substring(0, parts.fileNameIndex);
|
|
122524
|
+
else {
|
|
122525
|
+
// No package.json exists; an index.js will still resolve as the package name
|
|
122526
|
+
var fileName = getCanonicalFileName(moduleFileToTry.substring(parts.packageRootIndex + 1));
|
|
122527
|
+
if (fileName === "index.d.ts" || fileName === "index.js" || fileName === "index.ts" || fileName === "index.tsx") {
|
|
122528
|
+
return { moduleFileToTry: moduleFileToTry, packageRootPath: packageRootPath };
|
|
122529
|
+
}
|
|
122513
122530
|
}
|
|
122514
|
-
return
|
|
122531
|
+
return { moduleFileToTry: moduleFileToTry };
|
|
122515
122532
|
}
|
|
122516
122533
|
}
|
|
122517
122534
|
function tryGetAnyFileFromPath(host, path) {
|
|
@@ -122533,7 +122550,7 @@ var ts;
|
|
|
122533
122550
|
return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath;
|
|
122534
122551
|
});
|
|
122535
122552
|
}
|
|
122536
|
-
function removeExtensionAndIndexPostFix(fileName, ending, options) {
|
|
122553
|
+
function removeExtensionAndIndexPostFix(fileName, ending, options, host) {
|
|
122537
122554
|
if (ts.fileExtensionIsOneOf(fileName, [".json" /* Json */, ".mjs" /* Mjs */, ".cjs" /* Cjs */]))
|
|
122538
122555
|
return fileName;
|
|
122539
122556
|
var noExtension = ts.removeFileExtension(fileName);
|
|
@@ -122541,7 +122558,13 @@ var ts;
|
|
|
122541
122558
|
return noExtension + getJSExtensionForFile(fileName, options);
|
|
122542
122559
|
switch (ending) {
|
|
122543
122560
|
case 0 /* Minimal */:
|
|
122544
|
-
|
|
122561
|
+
var withoutIndex = ts.removeSuffix(noExtension, "/index");
|
|
122562
|
+
if (host && withoutIndex !== noExtension && tryGetAnyFileFromPath(host, withoutIndex)) {
|
|
122563
|
+
// Can't remove index if there's a file by the same name as the directory.
|
|
122564
|
+
// Probably more callers should pass `host` so we can determine this?
|
|
122565
|
+
return noExtension;
|
|
122566
|
+
}
|
|
122567
|
+
return withoutIndex;
|
|
122545
122568
|
case 1 /* Index */:
|
|
122546
122569
|
return noExtension;
|
|
122547
122570
|
case 2 /* JsExtension */:
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -85,11 +85,11 @@ var ts;
|
|
|
85
85
|
(function (ts) {
|
|
86
86
|
// WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values.
|
|
87
87
|
// If changing the text in this section, be sure to test `configurePrerelease` too.
|
|
88
|
-
ts.versionMajorMinor = "4.
|
|
88
|
+
ts.versionMajorMinor = "4.8";
|
|
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.20220507";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -8989,6 +8989,7 @@ var ts;
|
|
|
8989
8989
|
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
8990
|
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
8991
|
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
|
+
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'."),
|
|
8992
8993
|
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."),
|
|
8993
8994
|
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."),
|
|
8994
8995
|
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}'."),
|
|
@@ -17995,6 +17996,10 @@ var ts;
|
|
|
17995
17996
|
return indentStrings[1].length;
|
|
17996
17997
|
}
|
|
17997
17998
|
ts.getIndentSize = getIndentSize;
|
|
17999
|
+
function isNightly() {
|
|
18000
|
+
return ts.stringContains(ts.version, "-dev") || ts.stringContains(ts.version, "-insiders");
|
|
18001
|
+
}
|
|
18002
|
+
ts.isNightly = isNightly;
|
|
17998
18003
|
function createTextWriter(newLine) {
|
|
17999
18004
|
var output;
|
|
18000
18005
|
var indent;
|
|
@@ -32842,6 +32847,7 @@ var ts;
|
|
|
32842
32847
|
var startPos = scanner.getStartPos();
|
|
32843
32848
|
var result = parseListElement(kind, parseElement);
|
|
32844
32849
|
if (!result) {
|
|
32850
|
+
parsingContext = saveParsingContext;
|
|
32845
32851
|
return undefined;
|
|
32846
32852
|
}
|
|
32847
32853
|
list.push(result);
|
|
@@ -84984,6 +84990,9 @@ var ts;
|
|
|
84984
84990
|
var validForTypeAssertions = ts.isExclusivelyTypeOnlyImportOrExport(declaration);
|
|
84985
84991
|
var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
|
|
84986
84992
|
if (validForTypeAssertions && override) {
|
|
84993
|
+
if (!ts.isNightly()) {
|
|
84994
|
+
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);
|
|
84995
|
+
}
|
|
84987
84996
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
84988
84997
|
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
84989
84998
|
}
|
|
@@ -108382,34 +108391,44 @@ var ts;
|
|
|
108382
108391
|
if (!decl.importClause) {
|
|
108383
108392
|
// import "mod" - possibly needed for side effects? (global interface patches, module augmentations, etc)
|
|
108384
108393
|
return factory.updateImportDeclaration(decl,
|
|
108385
|
-
/*decorators*/ undefined, decl.modifiers, decl.importClause, rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108394
|
+
/*decorators*/ undefined, decl.modifiers, decl.importClause, rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
108386
108395
|
}
|
|
108387
108396
|
// The `importClause` visibility corresponds to the default's visibility.
|
|
108388
108397
|
var visibleDefaultBinding = decl.importClause && decl.importClause.name && resolver.isDeclarationVisible(decl.importClause) ? decl.importClause.name : undefined;
|
|
108389
108398
|
if (!decl.importClause.namedBindings) {
|
|
108390
108399
|
// No named bindings (either namespace or list), meaning the import is just default or should be elided
|
|
108391
108400
|
return visibleDefaultBinding && factory.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding,
|
|
108392
|
-
/*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108401
|
+
/*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
108393
108402
|
}
|
|
108394
108403
|
if (decl.importClause.namedBindings.kind === 268 /* NamespaceImport */) {
|
|
108395
108404
|
// Namespace import (optionally with visible default)
|
|
108396
108405
|
var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined;
|
|
108397
|
-
return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108406
|
+
return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)) : undefined;
|
|
108398
108407
|
}
|
|
108399
108408
|
// Named imports (optionally with visible default)
|
|
108400
108409
|
var bindingList = ts.mapDefined(decl.importClause.namedBindings.elements, function (b) { return resolver.isDeclarationVisible(b) ? b : undefined; });
|
|
108401
108410
|
if ((bindingList && bindingList.length) || visibleDefaultBinding) {
|
|
108402
108411
|
return factory.updateImportDeclaration(decl,
|
|
108403
|
-
/*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, bindingList && bindingList.length ? factory.updateNamedImports(decl.importClause.namedBindings, bindingList) : undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108412
|
+
/*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, bindingList && bindingList.length ? factory.updateNamedImports(decl.importClause.namedBindings, bindingList) : undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
108404
108413
|
}
|
|
108405
108414
|
// Augmentation of export depends on import
|
|
108406
108415
|
if (resolver.isImportRequiredByAugmentation(decl)) {
|
|
108407
108416
|
return factory.updateImportDeclaration(decl,
|
|
108408
108417
|
/*decorators*/ undefined, decl.modifiers,
|
|
108409
|
-
/*importClause*/ undefined, rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108418
|
+
/*importClause*/ undefined, rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
108410
108419
|
}
|
|
108411
108420
|
// Nothing visible
|
|
108412
108421
|
}
|
|
108422
|
+
function getResolutionModeOverrideForClauseInNightly(assertClause) {
|
|
108423
|
+
var mode = ts.getResolutionModeOverrideForClause(assertClause);
|
|
108424
|
+
if (mode !== undefined) {
|
|
108425
|
+
if (!ts.isNightly()) {
|
|
108426
|
+
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));
|
|
108427
|
+
}
|
|
108428
|
+
return assertClause;
|
|
108429
|
+
}
|
|
108430
|
+
return undefined;
|
|
108431
|
+
}
|
|
108413
108432
|
function transformAndReplaceLatePaintedStatements(statements) {
|
|
108414
108433
|
// This is a `while` loop because `handleSymbolAccessibilityError` can see additional import aliases marked as visible during
|
|
108415
108434
|
// error handling which must now be included in the output and themselves checked for errors.
|
|
@@ -121717,14 +121736,14 @@ var ts;
|
|
|
121717
121736
|
if (options === void 0) { options = {}; }
|
|
121718
121737
|
var info = getInfo(importingSourceFile.path, host);
|
|
121719
121738
|
var modulePaths = getAllModulePaths(importingSourceFile.path, nodeModulesFileName, host, preferences, options);
|
|
121720
|
-
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ true, options.overrideImportMode); });
|
|
121739
|
+
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, preferences, /*packageNameOnly*/ true, options.overrideImportMode); });
|
|
121721
121740
|
}
|
|
121722
121741
|
moduleSpecifiers_1.getNodeModulesPackageName = getNodeModulesPackageName;
|
|
121723
121742
|
function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host, preferences, userPreferences, options) {
|
|
121724
121743
|
if (options === void 0) { options = {}; }
|
|
121725
121744
|
var info = getInfo(importingSourceFileName, host);
|
|
121726
121745
|
var modulePaths = getAllModulePaths(importingSourceFileName, toFileName, host, userPreferences, options);
|
|
121727
|
-
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ undefined, options.overrideImportMode); }) ||
|
|
121746
|
+
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, userPreferences, /*packageNameOnly*/ undefined, options.overrideImportMode); }) ||
|
|
121728
121747
|
getLocalModuleSpecifier(toFileName, info, compilerOptions, host, preferences);
|
|
121729
121748
|
}
|
|
121730
121749
|
function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences, options) {
|
|
@@ -121800,7 +121819,7 @@ var ts;
|
|
|
121800
121819
|
var relativeSpecifiers;
|
|
121801
121820
|
for (var _i = 0, modulePaths_1 = modulePaths; _i < modulePaths_1.length; _i++) {
|
|
121802
121821
|
var modulePath = modulePaths_1[_i];
|
|
121803
|
-
var specifier = tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ undefined, options.overrideImportMode);
|
|
121822
|
+
var specifier = tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, userPreferences, /*packageNameOnly*/ undefined, options.overrideImportMode);
|
|
121804
121823
|
nodeModulesSpecifiers = ts.append(nodeModulesSpecifiers, specifier);
|
|
121805
121824
|
if (specifier && modulePath.isRedirect) {
|
|
121806
121825
|
// If we got a specifier for a redirect, it was a bare package specifier (e.g. "@foo/bar",
|
|
@@ -122193,7 +122212,7 @@ var ts;
|
|
|
122193
122212
|
? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions)
|
|
122194
122213
|
: ts.removeFileExtension(relativePath);
|
|
122195
122214
|
}
|
|
122196
|
-
function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, packageNameOnly, overrideMode) {
|
|
122215
|
+
function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
|
|
122197
122216
|
var path = _a.path, isRedirect = _a.isRedirect;
|
|
122198
122217
|
var getCanonicalFileName = _b.getCanonicalFileName, sourceDirectory = _b.sourceDirectory;
|
|
122199
122218
|
if (!host.fileExists || !host.readFile) {
|
|
@@ -122207,8 +122226,9 @@ var ts;
|
|
|
122207
122226
|
var moduleSpecifier = path;
|
|
122208
122227
|
var isPackageRootPath = false;
|
|
122209
122228
|
if (!packageNameOnly) {
|
|
122229
|
+
var preferences = getPreferences(host, userPreferences, options, importingSourceFile);
|
|
122210
122230
|
var packageRootIndex = parts.packageRootIndex;
|
|
122211
|
-
var
|
|
122231
|
+
var moduleFileName = void 0;
|
|
122212
122232
|
while (true) {
|
|
122213
122233
|
// If the module could be imported by a directory name, use that directory's name
|
|
122214
122234
|
var _c = tryDirectoryWithPackageJson(packageRootIndex), moduleFileToTry = _c.moduleFileToTry, packageRootPath = _c.packageRootPath, blockedByExports = _c.blockedByExports, verbatimFromExports = _c.verbatimFromExports;
|
|
@@ -122225,12 +122245,12 @@ var ts;
|
|
|
122225
122245
|
isPackageRootPath = true;
|
|
122226
122246
|
break;
|
|
122227
122247
|
}
|
|
122228
|
-
if (!
|
|
122229
|
-
|
|
122248
|
+
if (!moduleFileName)
|
|
122249
|
+
moduleFileName = moduleFileToTry;
|
|
122230
122250
|
// try with next level of directory
|
|
122231
122251
|
packageRootIndex = path.indexOf(ts.directorySeparator, packageRootIndex + 1);
|
|
122232
122252
|
if (packageRootIndex === -1) {
|
|
122233
|
-
moduleSpecifier =
|
|
122253
|
+
moduleSpecifier = removeExtensionAndIndexPostFix(moduleFileName, preferences.ending, options, host);
|
|
122234
122254
|
break;
|
|
122235
122255
|
}
|
|
122236
122256
|
}
|
|
@@ -122288,7 +122308,7 @@ var ts;
|
|
|
122288
122308
|
}
|
|
122289
122309
|
}
|
|
122290
122310
|
// If the file is the main module, it can be imported by the package name
|
|
122291
|
-
var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main;
|
|
122311
|
+
var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main || "index.js";
|
|
122292
122312
|
if (ts.isString(mainFileRelative)) {
|
|
122293
122313
|
var mainExportFile = ts.toPath(mainFileRelative, packageRootPath, getCanonicalFileName);
|
|
122294
122314
|
if (ts.removeFileExtension(mainExportFile) === ts.removeFileExtension(getCanonicalFileName(moduleFileToTry))) {
|
|
@@ -122296,17 +122316,14 @@ var ts;
|
|
|
122296
122316
|
}
|
|
122297
122317
|
}
|
|
122298
122318
|
}
|
|
122299
|
-
|
|
122300
|
-
|
|
122301
|
-
|
|
122302
|
-
|
|
122303
|
-
|
|
122304
|
-
|
|
122305
|
-
// IFF there is not _also_ a file by the same name
|
|
122306
|
-
if (getCanonicalFileName(fullModulePathWithoutExtension.substring(parts.fileNameIndex)) === "/index" && !tryGetAnyFileFromPath(host, fullModulePathWithoutExtension.substring(0, parts.fileNameIndex))) {
|
|
122307
|
-
return fullModulePathWithoutExtension.substring(0, parts.fileNameIndex);
|
|
122319
|
+
else {
|
|
122320
|
+
// No package.json exists; an index.js will still resolve as the package name
|
|
122321
|
+
var fileName = getCanonicalFileName(moduleFileToTry.substring(parts.packageRootIndex + 1));
|
|
122322
|
+
if (fileName === "index.d.ts" || fileName === "index.js" || fileName === "index.ts" || fileName === "index.tsx") {
|
|
122323
|
+
return { moduleFileToTry: moduleFileToTry, packageRootPath: packageRootPath };
|
|
122324
|
+
}
|
|
122308
122325
|
}
|
|
122309
|
-
return
|
|
122326
|
+
return { moduleFileToTry: moduleFileToTry };
|
|
122310
122327
|
}
|
|
122311
122328
|
}
|
|
122312
122329
|
function tryGetAnyFileFromPath(host, path) {
|
|
@@ -122328,7 +122345,7 @@ var ts;
|
|
|
122328
122345
|
return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath;
|
|
122329
122346
|
});
|
|
122330
122347
|
}
|
|
122331
|
-
function removeExtensionAndIndexPostFix(fileName, ending, options) {
|
|
122348
|
+
function removeExtensionAndIndexPostFix(fileName, ending, options, host) {
|
|
122332
122349
|
if (ts.fileExtensionIsOneOf(fileName, [".json" /* Json */, ".mjs" /* Mjs */, ".cjs" /* Cjs */]))
|
|
122333
122350
|
return fileName;
|
|
122334
122351
|
var noExtension = ts.removeFileExtension(fileName);
|
|
@@ -122336,7 +122353,13 @@ var ts;
|
|
|
122336
122353
|
return noExtension + getJSExtensionForFile(fileName, options);
|
|
122337
122354
|
switch (ending) {
|
|
122338
122355
|
case 0 /* Minimal */:
|
|
122339
|
-
|
|
122356
|
+
var withoutIndex = ts.removeSuffix(noExtension, "/index");
|
|
122357
|
+
if (host && withoutIndex !== noExtension && tryGetAnyFileFromPath(host, withoutIndex)) {
|
|
122358
|
+
// Can't remove index if there's a file by the same name as the directory.
|
|
122359
|
+
// Probably more callers should pass `host` so we can determine this?
|
|
122360
|
+
return noExtension;
|
|
122361
|
+
}
|
|
122362
|
+
return withoutIndex;
|
|
122340
122363
|
case 1 /* Index */:
|
|
122341
122364
|
return noExtension;
|
|
122342
122365
|
case 2 /* JsExtension */:
|
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.
|
|
5
|
+
"version": "4.8.0-dev.20220507",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|