typescript 4.5.0-dev.20211005 → 4.5.0-dev.20211009
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/cs/diagnosticMessages.generated.json +1 -0
- package/lib/de/diagnosticMessages.generated.json +1 -0
- package/lib/es/diagnosticMessages.generated.json +1 -0
- package/lib/fr/diagnosticMessages.generated.json +1 -0
- package/lib/it/diagnosticMessages.generated.json +1 -0
- package/lib/ja/diagnosticMessages.generated.json +1 -0
- package/lib/ko/diagnosticMessages.generated.json +1 -0
- package/lib/pl/diagnosticMessages.generated.json +1 -0
- package/lib/pt-br/diagnosticMessages.generated.json +1 -0
- package/lib/ru/diagnosticMessages.generated.json +1 -0
- package/lib/tr/diagnosticMessages.generated.json +1 -0
- package/lib/tsc.js +41 -16
- package/lib/tsserver.js +250 -132
- package/lib/tsserverlibrary.d.ts +15 -10
- package/lib/tsserverlibrary.js +250 -132
- package/lib/typescript.d.ts +15 -10
- package/lib/typescript.js +250 -132
- package/lib/typescriptServices.d.ts +15 -10
- package/lib/typescriptServices.js +250 -132
- package/lib/typingsInstaller.js +41 -17
- package/lib/zh-cn/diagnosticMessages.generated.json +1 -0
- package/lib/zh-tw/diagnosticMessages.generated.json +1 -0
- 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 = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20211009";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -8663,6 +8663,7 @@ var ts;
|
|
|
8663
8663
|
Type_0_is_not_assignable_to_type_1_Did_you_mean_2: diag(2820, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_Did_you_mean_2_2820", "Type '{0}' is not assignable to type '{1}'. Did you mean '{2}'?"),
|
|
8664
8664
|
Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext: diag(2821, ts.DiagnosticCategory.Error, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_2821", "Import assertions are only supported when the '--module' option is set to 'esnext'."),
|
|
8665
8665
|
Import_assertions_cannot_be_used_with_type_only_imports_or_exports: diag(2822, ts.DiagnosticCategory.Error, "Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822", "Import assertions cannot be used with type-only imports or exports."),
|
|
8666
|
+
Cannot_find_namespace_0_Did_you_mean_1: diag(2833, ts.DiagnosticCategory.Error, "Cannot_find_namespace_0_Did_you_mean_1_2833", "Cannot find namespace '{0}'. Did you mean '{1}'?"),
|
|
8666
8667
|
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}'."),
|
|
8667
8668
|
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}'."),
|
|
8668
8669
|
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}'."),
|
|
@@ -20102,10 +20103,14 @@ var ts;
|
|
|
20102
20103
|
var ext = fileName.substr(fileName.lastIndexOf("."));
|
|
20103
20104
|
switch (ext.toLowerCase()) {
|
|
20104
20105
|
case ".js" /* Js */:
|
|
20106
|
+
case ".cjs" /* Cjs */:
|
|
20107
|
+
case ".mjs" /* Mjs */:
|
|
20105
20108
|
return 1 /* JS */;
|
|
20106
20109
|
case ".jsx" /* Jsx */:
|
|
20107
20110
|
return 2 /* JSX */;
|
|
20108
20111
|
case ".ts" /* Ts */:
|
|
20112
|
+
case ".cts" /* Cts */:
|
|
20113
|
+
case ".mts" /* Mts */:
|
|
20109
20114
|
return 3 /* TS */;
|
|
20110
20115
|
case ".tsx" /* Tsx */:
|
|
20111
20116
|
return 4 /* TSX */;
|
|
@@ -38680,6 +38685,8 @@ var ts;
|
|
|
38680
38685
|
type: new ts.Map(ts.getEntries({
|
|
38681
38686
|
node: ts.ModuleResolutionKind.NodeJs,
|
|
38682
38687
|
classic: ts.ModuleResolutionKind.Classic,
|
|
38688
|
+
node12: ts.ModuleResolutionKind.Node12,
|
|
38689
|
+
nodenext: ts.ModuleResolutionKind.NodeNext,
|
|
38683
38690
|
})),
|
|
38684
38691
|
affectsModuleResolution: true,
|
|
38685
38692
|
paramType: ts.Diagnostics.STRATEGY,
|
|
@@ -42482,11 +42489,15 @@ var ts;
|
|
|
42482
42489
|
if (!scope || !scope.packageJsonContent.exports) {
|
|
42483
42490
|
return undefined;
|
|
42484
42491
|
}
|
|
42492
|
+
if (typeof scope.packageJsonContent.name !== "string") {
|
|
42493
|
+
return undefined;
|
|
42494
|
+
}
|
|
42485
42495
|
var parts = ts.getPathComponents(moduleName); // unrooted paths should have `""` as their 0th entry
|
|
42486
|
-
|
|
42496
|
+
var nameParts = ts.getPathComponents(scope.packageJsonContent.name);
|
|
42497
|
+
if (!ts.every(nameParts, function (p, i) { return parts[i] === p; })) {
|
|
42487
42498
|
return undefined;
|
|
42488
42499
|
}
|
|
42489
|
-
var trailingParts = parts.slice(
|
|
42500
|
+
var trailingParts = parts.slice(nameParts.length);
|
|
42490
42501
|
return loadModuleFromExports(scope, extensions, !ts.length(trailingParts) ? "." : "." + ts.directorySeparator + trailingParts.join(ts.directorySeparator), state, cache, redirectedReference);
|
|
42491
42502
|
}
|
|
42492
42503
|
function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) {
|
|
@@ -47964,11 +47975,11 @@ var ts;
|
|
|
47964
47975
|
*
|
|
47965
47976
|
* @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters.
|
|
47966
47977
|
*/
|
|
47967
|
-
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals
|
|
47978
|
+
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals) {
|
|
47968
47979
|
if (excludeGlobals === void 0) { excludeGlobals = false; }
|
|
47969
|
-
return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSymbol
|
|
47980
|
+
return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSymbol);
|
|
47970
47981
|
}
|
|
47971
|
-
function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, lookup
|
|
47982
|
+
function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, lookup) {
|
|
47972
47983
|
var _a, _b, _c;
|
|
47973
47984
|
var originalLocation = location; // needed for did-you-mean error reporting, which gathers candidates starting from the original location
|
|
47974
47985
|
var result;
|
|
@@ -48295,7 +48306,7 @@ var ts;
|
|
|
48295
48306
|
!checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) &&
|
|
48296
48307
|
!checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
|
|
48297
48308
|
var suggestion = void 0;
|
|
48298
|
-
if (
|
|
48309
|
+
if (suggestionCount < maximumSuggestionCount) {
|
|
48299
48310
|
suggestion = getSuggestedSymbolForNonexistentSymbol(originalLocation, name, meaning);
|
|
48300
48311
|
var isGlobalScopeAugmentationDeclaration = (suggestion === null || suggestion === void 0 ? void 0 : suggestion.valueDeclaration) && ts.isAmbientModule(suggestion.valueDeclaration) && ts.isGlobalScopeAugmentation(suggestion.valueDeclaration);
|
|
48301
48312
|
if (isGlobalScopeAugmentationDeclaration) {
|
|
@@ -48304,7 +48315,9 @@ var ts;
|
|
|
48304
48315
|
if (suggestion) {
|
|
48305
48316
|
var suggestionName = symbolToString(suggestion);
|
|
48306
48317
|
var isUncheckedJS = isUncheckedJSSuggestion(originalLocation, suggestion, /*excludeClasses*/ false);
|
|
48307
|
-
var message =
|
|
48318
|
+
var message = meaning === 1920 /* Namespace */ || nameArg && typeof nameArg !== "string" && ts.nodeIsSynthesized(nameArg) ? ts.Diagnostics.Cannot_find_namespace_0_Did_you_mean_1
|
|
48319
|
+
: isUncheckedJS ? ts.Diagnostics.Could_not_find_name_0_Did_you_mean_1
|
|
48320
|
+
: ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1;
|
|
48308
48321
|
var diagnostic = createError(errorLocation, message, diagnosticName(nameArg), suggestionName);
|
|
48309
48322
|
addErrorOrSuggestion(!isUncheckedJS, diagnostic);
|
|
48310
48323
|
if (suggestion.valueDeclaration) {
|
|
@@ -49298,7 +49311,7 @@ var ts;
|
|
|
49298
49311
|
if (name.kind === 79 /* Identifier */) {
|
|
49299
49312
|
var message = meaning === namespaceMeaning || ts.nodeIsSynthesized(name) ? ts.Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(ts.getFirstIdentifier(name));
|
|
49300
49313
|
var symbolFromJSPrototype = ts.isInJSFile(name) && !ts.nodeIsSynthesized(name) ? resolveEntityNameFromAssignmentDeclaration(name, meaning) : undefined;
|
|
49301
|
-
symbol = getMergedSymbol(resolveName(location || name, name.escapedText, meaning, ignoreErrors || symbolFromJSPrototype ? undefined : message, name, /*isUse*/ true));
|
|
49314
|
+
symbol = getMergedSymbol(resolveName(location || name, name.escapedText, meaning, ignoreErrors || symbolFromJSPrototype ? undefined : message, name, /*isUse*/ true, false));
|
|
49302
49315
|
if (!symbol) {
|
|
49303
49316
|
return getMergedSymbol(symbolFromJSPrototype);
|
|
49304
49317
|
}
|
|
@@ -67076,8 +67089,7 @@ var ts;
|
|
|
67076
67089
|
if (!links.resolvedSymbol) {
|
|
67077
67090
|
links.resolvedSymbol = !ts.nodeIsMissing(node) &&
|
|
67078
67091
|
resolveName(node, node.escapedText, 111551 /* Value */ | 1048576 /* ExportValue */, getCannotFindNameDiagnosticForName(node), node, !ts.isWriteOnlyAccess(node),
|
|
67079
|
-
/*excludeGlobals*/ false
|
|
67080
|
-
/*issueSuggestions*/ true) || unknownSymbol;
|
|
67092
|
+
/*excludeGlobals*/ false) || unknownSymbol;
|
|
67081
67093
|
}
|
|
67082
67094
|
return links.resolvedSymbol;
|
|
67083
67095
|
}
|
|
@@ -72568,7 +72580,7 @@ var ts;
|
|
|
72568
72580
|
if (relatedInfo) {
|
|
72569
72581
|
ts.addRelatedInfo(resultDiagnostic, relatedInfo);
|
|
72570
72582
|
}
|
|
72571
|
-
addErrorOrSuggestion(!isUncheckedJS, resultDiagnostic);
|
|
72583
|
+
addErrorOrSuggestion(!isUncheckedJS || errorInfo.code !== ts.Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code, resultDiagnostic);
|
|
72572
72584
|
}
|
|
72573
72585
|
function containerSeemsToBeEmptyDomElement(containingType) {
|
|
72574
72586
|
return (compilerOptions.lib && !compilerOptions.lib.includes("dom")) &&
|
|
@@ -72641,7 +72653,19 @@ var ts;
|
|
|
72641
72653
|
// Sometimes the symbol is found when location is a return type of a function: `typeof x` and `x` is declared in the body of the function
|
|
72642
72654
|
// So the table *contains* `x` but `x` isn't actually in scope.
|
|
72643
72655
|
// However, resolveNameHelper will continue and call this callback again, so we'll eventually get a correct suggestion.
|
|
72644
|
-
|
|
72656
|
+
if (symbol)
|
|
72657
|
+
return symbol;
|
|
72658
|
+
var candidates;
|
|
72659
|
+
if (symbols === globals) {
|
|
72660
|
+
var primitives = ts.mapDefined(["string", "number", "boolean", "object", "bigint", "symbol"], function (s) { return symbols.has((s.charAt(0).toUpperCase() + s.slice(1)))
|
|
72661
|
+
? createSymbol(524288 /* TypeAlias */, s)
|
|
72662
|
+
: undefined; });
|
|
72663
|
+
candidates = primitives.concat(ts.arrayFrom(symbols.values()));
|
|
72664
|
+
}
|
|
72665
|
+
else {
|
|
72666
|
+
candidates = ts.arrayFrom(symbols.values());
|
|
72667
|
+
}
|
|
72668
|
+
return getSpellingSuggestionForName(ts.unescapeLeadingUnderscores(name), candidates, meaning);
|
|
72645
72669
|
});
|
|
72646
72670
|
return result;
|
|
72647
72671
|
}
|
|
@@ -121083,11 +121107,11 @@ var ts;
|
|
|
121083
121107
|
(_b = state.typeReferenceDirectiveResolutionCache) === null || _b === void 0 ? void 0 : _b.update(config.options);
|
|
121084
121108
|
// Create program
|
|
121085
121109
|
program = host.createProgram(config.fileNames, config.options, compilerHost, getOldProgram(state, projectPath, config), ts.getConfigFileParsingDiagnostics(config), config.projectReferences);
|
|
121086
|
-
state.lastCachedPackageJsonLookups.set(projectPath, state.moduleResolutionCache && ts.map(state.moduleResolutionCache.getPackageJsonInfoCache().entries(), function (_a) {
|
|
121087
|
-
var path = _a[0], data = _a[1];
|
|
121088
|
-
return [state.host.realpath ? toPath(state, state.host.realpath(path)) : path, data];
|
|
121089
|
-
}));
|
|
121090
121110
|
if (state.watch) {
|
|
121111
|
+
state.lastCachedPackageJsonLookups.set(projectPath, state.moduleResolutionCache && ts.map(state.moduleResolutionCache.getPackageJsonInfoCache().entries(), function (_a) {
|
|
121112
|
+
var path = _a[0], data = _a[1];
|
|
121113
|
+
return [state.host.realpath && data ? toPath(state, state.host.realpath(path)) : path, data];
|
|
121114
|
+
}));
|
|
121091
121115
|
state.builderPrograms.set(projectPath, program);
|
|
121092
121116
|
}
|
|
121093
121117
|
step++;
|
|
@@ -322,6 +322,7 @@
|
|
|
322
322
|
"Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2580": "找不到名称 \"{0}\"。是否需要为节点安装类型定义? 请尝试使用 `npm i --save-dev @types/node`。",
|
|
323
323
|
"Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2591": "找不到名称“{0}”。是否需要为节点安装类型定义? 请尝试使用 `npm i --save-dev @types/node`,然后将 “node” 添加到类型字段。",
|
|
324
324
|
"Cannot_find_namespace_0_2503": "找不到命名空间“{0}”。",
|
|
325
|
+
"Cannot_find_namespace_0_Did_you_mean_1_2833": "找不到命名空间“{0}”。你是否指的是“{1}”?",
|
|
325
326
|
"Cannot_find_parameter_0_1225": "找不到参数“{0}”。",
|
|
326
327
|
"Cannot_find_the_common_subdirectory_path_for_the_input_files_5009": "找不到输入文件的公共子目录路径。",
|
|
327
328
|
"Cannot_find_type_definition_file_for_0_2688": "找不到“{0}”的类型定义文件。",
|
|
@@ -322,6 +322,7 @@
|
|
|
322
322
|
"Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2580": "找不到名稱 '{0}'。需要安裝節點的型別定義嗎? 請嘗試 `npm i --save-dev @types/node`。",
|
|
323
323
|
"Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2591": "找不到名稱「{0}」。需要為節點安裝類型定義嗎? 請嘗試 `npm i --save-dev @types/node`,然後將 `node` 新增至 tsconfig 中的類型欄位。",
|
|
324
324
|
"Cannot_find_namespace_0_2503": "找不到命名空間 '{0}'。",
|
|
325
|
+
"Cannot_find_namespace_0_Did_you_mean_1_2833": "找不到命名空間 '{0}'。您是不是指 '{1}'?",
|
|
325
326
|
"Cannot_find_parameter_0_1225": "找不到參數 '{0}'。",
|
|
326
327
|
"Cannot_find_the_common_subdirectory_path_for_the_input_files_5009": "找不到輸入檔的一般子目錄路徑。",
|
|
327
328
|
"Cannot_find_type_definition_file_for_0_2688": "找不到 '{0}' 的類型定義檔案。",
|
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.0-dev.
|
|
5
|
+
"version": "4.5.0-dev.20211009",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|