typescript 4.5.0-dev.20211020 → 4.5.0-dev.20211024
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/es/diagnosticMessages.generated.json +1 -0
- package/lib/fr/diagnosticMessages.generated.json +1 -0
- package/lib/it/diagnosticMessages.generated.json +1 -0
- package/lib/lib.es5.d.ts +2 -2
- package/lib/pl/diagnosticMessages.generated.json +1 -0
- package/lib/pt-br/diagnosticMessages.generated.json +1 -0
- package/lib/ru/diagnosticMessages.generated.json +2 -0
- package/lib/tr/diagnosticMessages.generated.json +1 -0
- package/lib/tsc.js +50 -44
- package/lib/tsserver.js +113 -76
- package/lib/tsserverlibrary.js +113 -76
- package/lib/typescript.js +113 -76
- package/lib/typescriptServices.js +113 -76
- package/lib/typingsInstaller.js +56 -50
- 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.20211024";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -8130,6 +8130,7 @@ var ts;
|
|
|
8130
8130
|
Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type: diag(1387, ts.DiagnosticCategory.Error, "Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1387", "Function type notation must be parenthesized when used in an intersection type."),
|
|
8131
8131
|
Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type: diag(1388, ts.DiagnosticCategory.Error, "Constructor_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1388", "Constructor type notation must be parenthesized when used in an intersection type."),
|
|
8132
8132
|
_0_is_not_allowed_as_a_variable_declaration_name: diag(1389, ts.DiagnosticCategory.Error, "_0_is_not_allowed_as_a_variable_declaration_name_1389", "'{0}' is not allowed as a variable declaration name."),
|
|
8133
|
+
_0_is_not_allowed_as_a_parameter_name: diag(1390, ts.DiagnosticCategory.Error, "_0_is_not_allowed_as_a_parameter_name_1390", "'{0}' is not allowed as a parameter name."),
|
|
8133
8134
|
An_import_alias_cannot_use_import_type: diag(1392, ts.DiagnosticCategory.Error, "An_import_alias_cannot_use_import_type_1392", "An import alias cannot use 'import type'"),
|
|
8134
8135
|
Imported_via_0_from_file_1: diag(1393, ts.DiagnosticCategory.Message, "Imported_via_0_from_file_1_1393", "Imported via {0} from file '{1}'"),
|
|
8135
8136
|
Imported_via_0_from_file_1_with_packageId_2: diag(1394, ts.DiagnosticCategory.Message, "Imported_via_0_from_file_1_with_packageId_2_1394", "Imported via {0} from file '{1}' with packageId '{2}'"),
|
|
@@ -19982,7 +19983,7 @@ var ts;
|
|
|
19982
19983
|
includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"),
|
|
19983
19984
|
includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"),
|
|
19984
19985
|
excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"),
|
|
19985
|
-
basePaths: getBasePaths(
|
|
19986
|
+
basePaths: getBasePaths(absolutePath, includes, useCaseSensitiveFileNames)
|
|
19986
19987
|
};
|
|
19987
19988
|
}
|
|
19988
19989
|
ts.getFileMatcherPatterns = getFileMatcherPatterns;
|
|
@@ -20004,20 +20005,20 @@ var ts;
|
|
|
20004
20005
|
var visited = new ts.Map();
|
|
20005
20006
|
var toCanonical = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
|
|
20006
20007
|
for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) {
|
|
20007
|
-
var
|
|
20008
|
-
if (directoryExists(
|
|
20009
|
-
visitDirectory(
|
|
20008
|
+
var absoluteBasePath = _a[_i];
|
|
20009
|
+
if (directoryExists(absoluteBasePath)) {
|
|
20010
|
+
visitDirectory(absoluteBasePath, depth);
|
|
20010
20011
|
}
|
|
20011
20012
|
}
|
|
20012
20013
|
return ts.flatten(results);
|
|
20013
|
-
function visitDirectory(
|
|
20014
|
+
function visitDirectory(absolutePath, depth) {
|
|
20014
20015
|
var canonicalPath = toCanonical(realpath(absolutePath));
|
|
20015
20016
|
if (visited.has(canonicalPath))
|
|
20016
20017
|
return;
|
|
20017
20018
|
visited.set(canonicalPath, true);
|
|
20018
|
-
var _a = getFileSystemEntries(
|
|
20019
|
+
var _a = getFileSystemEntries(absolutePath), files = _a.files, directories = _a.directories;
|
|
20019
20020
|
var _loop_1 = function (current) {
|
|
20020
|
-
var name = ts.combinePaths(
|
|
20021
|
+
var name = ts.combinePaths(absolutePath, current);
|
|
20021
20022
|
var absoluteName = ts.combinePaths(absolutePath, current);
|
|
20022
20023
|
if (extensions && !ts.fileExtensionIsOneOf(name, extensions))
|
|
20023
20024
|
return "continue";
|
|
@@ -20045,11 +20046,10 @@ var ts;
|
|
|
20045
20046
|
}
|
|
20046
20047
|
for (var _c = 0, _d = ts.sort(directories, ts.compareStringsCaseSensitive); _c < _d.length; _c++) {
|
|
20047
20048
|
var current = _d[_c];
|
|
20048
|
-
var name = ts.combinePaths(path, current);
|
|
20049
20049
|
var absoluteName = ts.combinePaths(absolutePath, current);
|
|
20050
20050
|
if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) &&
|
|
20051
20051
|
(!excludeRegex || !excludeRegex.test(absoluteName))) {
|
|
20052
|
-
visitDirectory(
|
|
20052
|
+
visitDirectory(absoluteName, depth);
|
|
20053
20053
|
}
|
|
20054
20054
|
}
|
|
20055
20055
|
}
|
|
@@ -20057,10 +20057,11 @@ var ts;
|
|
|
20057
20057
|
ts.matchFiles = matchFiles;
|
|
20058
20058
|
/**
|
|
20059
20059
|
* Computes the unique non-wildcard base paths amongst the provided include patterns.
|
|
20060
|
+
* @returns Absolute directory paths
|
|
20060
20061
|
*/
|
|
20061
|
-
function getBasePaths(
|
|
20062
|
+
function getBasePaths(absoluteTsconfigPath, includes, useCaseSensitiveFileNames) {
|
|
20062
20063
|
// Storage for our results in the form of literal paths (e.g. the paths as written by the user).
|
|
20063
|
-
var basePaths = [
|
|
20064
|
+
var basePaths = [absoluteTsconfigPath];
|
|
20064
20065
|
if (includes) {
|
|
20065
20066
|
// Storage for literal base paths amongst the include patterns.
|
|
20066
20067
|
var includeBasePaths = [];
|
|
@@ -20068,14 +20069,14 @@ var ts;
|
|
|
20068
20069
|
var include = includes_1[_i];
|
|
20069
20070
|
// We also need to check the relative paths by converting them to absolute and normalizing
|
|
20070
20071
|
// in case they escape the base path (e.g "..\somedirectory")
|
|
20071
|
-
var
|
|
20072
|
+
var absoluteIncludePath = ts.isRootedDiskPath(include) ? include : ts.normalizePath(ts.combinePaths(absoluteTsconfigPath, include));
|
|
20072
20073
|
// Append the literal and canonical candidate base paths.
|
|
20073
|
-
includeBasePaths.push(getIncludeBasePath(
|
|
20074
|
+
includeBasePaths.push(getIncludeBasePath(absoluteIncludePath));
|
|
20074
20075
|
}
|
|
20075
20076
|
// Sort the offsets array using either the literal or canonical path representations.
|
|
20076
20077
|
includeBasePaths.sort(ts.getStringComparer(!useCaseSensitiveFileNames));
|
|
20077
20078
|
var _loop_2 = function (includeBasePath) {
|
|
20078
|
-
if (ts.every(basePaths, function (basePath) { return !ts.containsPath(basePath, includeBasePath,
|
|
20079
|
+
if (ts.every(basePaths, function (basePath) { return !ts.containsPath(basePath, includeBasePath, absoluteTsconfigPath, !useCaseSensitiveFileNames); })) {
|
|
20079
20080
|
basePaths.push(includeBasePath);
|
|
20080
20081
|
}
|
|
20081
20082
|
};
|
|
@@ -31922,7 +31923,10 @@ var ts;
|
|
|
31922
31923
|
case 12 /* ObjectLiteralMembers */: return parseErrorAtCurrentToken(ts.Diagnostics.Property_assignment_expected);
|
|
31923
31924
|
case 15 /* ArrayLiteralMembers */: return parseErrorAtCurrentToken(ts.Diagnostics.Expression_or_comma_expected);
|
|
31924
31925
|
case 17 /* JSDocParameters */: return parseErrorAtCurrentToken(ts.Diagnostics.Parameter_declaration_expected);
|
|
31925
|
-
case 16 /* Parameters */:
|
|
31926
|
+
case 16 /* Parameters */:
|
|
31927
|
+
return ts.isKeyword(token())
|
|
31928
|
+
? parseErrorAtCurrentToken(ts.Diagnostics._0_is_not_allowed_as_a_parameter_name, ts.tokenToString(token()))
|
|
31929
|
+
: parseErrorAtCurrentToken(ts.Diagnostics.Parameter_declaration_expected);
|
|
31926
31930
|
case 19 /* TypeParameters */: return parseErrorAtCurrentToken(ts.Diagnostics.Type_parameter_declaration_expected);
|
|
31927
31931
|
case 20 /* TypeArguments */: return parseErrorAtCurrentToken(ts.Diagnostics.Type_argument_expected);
|
|
31928
31932
|
case 21 /* TupleElementTypes */: return parseErrorAtCurrentToken(ts.Diagnostics.Type_expected);
|
|
@@ -45682,6 +45686,7 @@ var ts;
|
|
|
45682
45686
|
case 168 /* MethodDeclaration */:
|
|
45683
45687
|
case 171 /* GetAccessor */:
|
|
45684
45688
|
case 172 /* SetAccessor */:
|
|
45689
|
+
case 169 /* ClassStaticBlockDeclaration */:
|
|
45685
45690
|
// this.foo assignment in a JavaScript class
|
|
45686
45691
|
// Bind this property to the containing class
|
|
45687
45692
|
var containingClass = thisContainer.parent;
|
|
@@ -49742,8 +49747,8 @@ var ts;
|
|
|
49742
49747
|
if (exportEquals !== moduleSymbol) {
|
|
49743
49748
|
var type = getTypeOfSymbol(exportEquals);
|
|
49744
49749
|
if (shouldTreatPropertiesOfExternalModuleAsExports(type)) {
|
|
49745
|
-
|
|
49746
|
-
cb(symbol,
|
|
49750
|
+
forEachPropertyOfType(type, function (symbol, escapedName) {
|
|
49751
|
+
cb(symbol, escapedName);
|
|
49747
49752
|
});
|
|
49748
49753
|
}
|
|
49749
49754
|
}
|
|
@@ -50075,12 +50080,15 @@ var ts;
|
|
|
50075
50080
|
function getNamedMembers(members) {
|
|
50076
50081
|
var result;
|
|
50077
50082
|
members.forEach(function (symbol, id) {
|
|
50078
|
-
if (
|
|
50083
|
+
if (isNamedMember(symbol, id)) {
|
|
50079
50084
|
(result || (result = [])).push(symbol);
|
|
50080
50085
|
}
|
|
50081
50086
|
});
|
|
50082
50087
|
return result || ts.emptyArray;
|
|
50083
50088
|
}
|
|
50089
|
+
function isNamedMember(member, escapedName) {
|
|
50090
|
+
return !isReservedMemberName(escapedName) && symbolIsValue(member);
|
|
50091
|
+
}
|
|
50084
50092
|
function getNamedOrIndexSignatureMembers(members) {
|
|
50085
50093
|
var result = getNamedMembers(members);
|
|
50086
50094
|
var index = getIndexSymbolFromSymbolTable(members);
|
|
@@ -56913,6 +56921,16 @@ var ts;
|
|
|
56913
56921
|
getPropertiesOfUnionOrIntersectionType(type) :
|
|
56914
56922
|
getPropertiesOfObjectType(type);
|
|
56915
56923
|
}
|
|
56924
|
+
function forEachPropertyOfType(type, action) {
|
|
56925
|
+
type = getReducedApparentType(type);
|
|
56926
|
+
if (type.flags & 3670016 /* StructuredType */) {
|
|
56927
|
+
resolveStructuredTypeMembers(type).members.forEach(function (symbol, escapedName) {
|
|
56928
|
+
if (isNamedMember(symbol, escapedName)) {
|
|
56929
|
+
action(symbol, escapedName);
|
|
56930
|
+
}
|
|
56931
|
+
});
|
|
56932
|
+
}
|
|
56933
|
+
}
|
|
56916
56934
|
function isTypeInvalidDueToUnionDiscriminant(contextualType, obj) {
|
|
56917
56935
|
var list = obj.properties;
|
|
56918
56936
|
return list.some(function (property) {
|
|
@@ -60388,12 +60406,6 @@ var ts;
|
|
|
60388
60406
|
}
|
|
60389
60407
|
return type[cache] = type;
|
|
60390
60408
|
}
|
|
60391
|
-
function isConditionalTypeAlwaysTrueDisregardingInferTypes(type) {
|
|
60392
|
-
var extendsInferParamMapper = type.root.inferTypeParameters && createTypeMapper(type.root.inferTypeParameters, ts.map(type.root.inferTypeParameters, function () { return wildcardType; }));
|
|
60393
|
-
var checkType = type.checkType;
|
|
60394
|
-
var extendsType = type.extendsType;
|
|
60395
|
-
return isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(instantiateType(extendsType, extendsInferParamMapper)));
|
|
60396
|
-
}
|
|
60397
60409
|
function getSimplifiedConditionalType(type, writing) {
|
|
60398
60410
|
var checkType = type.checkType;
|
|
60399
60411
|
var extendsType = type.extendsType;
|
|
@@ -60702,6 +60714,10 @@ var ts;
|
|
|
60702
60714
|
}
|
|
60703
60715
|
return result;
|
|
60704
60716
|
}
|
|
60717
|
+
function isDistributionDependent(root) {
|
|
60718
|
+
return root.isDistributive && (isTypeParameterPossiblyReferenced(root.checkType, root.node.trueType) ||
|
|
60719
|
+
isTypeParameterPossiblyReferenced(root.checkType, root.node.falseType));
|
|
60720
|
+
}
|
|
60705
60721
|
function getTypeFromConditionalTypeNode(node) {
|
|
60706
60722
|
var links = getNodeLinks(node);
|
|
60707
60723
|
if (!links.resolvedType) {
|
|
@@ -63858,31 +63874,21 @@ var ts;
|
|
|
63858
63874
|
return 3 /* Maybe */;
|
|
63859
63875
|
}
|
|
63860
63876
|
var c = target;
|
|
63861
|
-
//
|
|
63862
|
-
|
|
63863
|
-
|
|
63864
|
-
|
|
63865
|
-
|
|
63866
|
-
|
|
63867
|
-
|
|
63868
|
-
|
|
63869
|
-
|
|
63870
|
-
|
|
63871
|
-
|
|
63872
|
-
|
|
63873
|
-
|
|
63874
|
-
|
|
63875
|
-
|
|
63876
|
-
var expanding = isDeeplyNestedType(target, targetStack, targetDepth);
|
|
63877
|
-
var localResult = expanding ? 3 /* Maybe */ : undefined;
|
|
63878
|
-
if (skipTrue || expanding || (localResult = isRelatedTo(source, distributionMapper ? instantiateType(getTypeFromTypeNode(c.root.node.trueType), distributionMapper) : getTrueTypeFromConditionalType(c), 2 /* Target */, /*reportErrors*/ false))) {
|
|
63879
|
-
if (!skipFalse && !expanding) {
|
|
63880
|
-
localResult = (localResult || 3 /* Maybe */) & isRelatedTo(source, distributionMapper ? instantiateType(getTypeFromTypeNode(c.root.node.falseType), distributionMapper) : getFalseTypeFromConditionalType(c), 2 /* Target */, /*reportErrors*/ false);
|
|
63881
|
-
}
|
|
63882
|
-
}
|
|
63883
|
-
if (localResult) {
|
|
63884
|
-
resetErrorInfo(saveErrorInfo);
|
|
63885
|
-
return localResult;
|
|
63877
|
+
// We check for a relationship to a conditional type target only when the conditional type has no
|
|
63878
|
+
// 'infer' positions and is not distributive or is distributive but doesn't reference the check type
|
|
63879
|
+
// parameter in either of the result types.
|
|
63880
|
+
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
|
|
63881
|
+
// Check if the conditional is always true or always false but still deferred for distribution purposes.
|
|
63882
|
+
var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
|
|
63883
|
+
var skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
|
|
63884
|
+
// TODO: Find a nice way to include potential conditional type breakdowns in error output, if they seem good (they usually don't)
|
|
63885
|
+
if (result = skipTrue ? -1 /* True */ : isRelatedTo(source, getTrueTypeFromConditionalType(c), 2 /* Target */, /*reportErrors*/ false)) {
|
|
63886
|
+
result &= skipFalse ? -1 /* True */ : isRelatedTo(source, getFalseTypeFromConditionalType(c), 2 /* Target */, /*reportErrors*/ false);
|
|
63887
|
+
if (result) {
|
|
63888
|
+
resetErrorInfo(saveErrorInfo);
|
|
63889
|
+
return result;
|
|
63890
|
+
}
|
|
63891
|
+
}
|
|
63886
63892
|
}
|
|
63887
63893
|
}
|
|
63888
63894
|
else if (target.flags & 134217728 /* TemplateLiteral */) {
|
|
@@ -1661,6 +1661,7 @@
|
|
|
1661
1661
|
"_0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property_2610": "\"{0}\" 在类 \"{1}\" 中定义为访问器,但这里在 \"{2}\" 中重写为实例属性。",
|
|
1662
1662
|
"_0_is_deprecated_6385": "“{0}”已弃用。",
|
|
1663
1663
|
"_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "“{0}”不是关键字“{1}”的有效元属性。是否是指“{2}”?",
|
|
1664
|
+
"_0_is_not_allowed_as_a_parameter_name_1390": "不允许将 '{0}' 作为参数名。",
|
|
1664
1665
|
"_0_is_not_allowed_as_a_variable_declaration_name_1389": "“{0}”不得用作变量声明名称。",
|
|
1665
1666
|
"_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "“{0}”在其自身的基表达式中得到直接或间接引用。",
|
|
1666
1667
|
"_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "“{0}”在其自身的类型批注中得到直接或间接引用。",
|
|
@@ -1661,6 +1661,7 @@
|
|
|
1661
1661
|
"_0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property_2610": "'{0}' 在類別 '{1}' 中定義為存取子,但在此處的 '{2}' 中卻覆寫為執行個體屬性。",
|
|
1662
1662
|
"_0_is_deprecated_6385": "'{0}' 已淘汰。",
|
|
1663
1663
|
"_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "'{0}' 對關鍵字 '{1}' 而言不是有效的中繼屬性。您是指 '{2}' 嗎?",
|
|
1664
|
+
"_0_is_not_allowed_as_a_parameter_name_1390": "不允許 '{0}' 做為參數名稱。",
|
|
1664
1665
|
"_0_is_not_allowed_as_a_variable_declaration_name_1389": "'{0}' 不能是變數宣告名稱。",
|
|
1665
1666
|
"_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "'{0}' 在其本身的基底運算式中直接或間接受到參考。",
|
|
1666
1667
|
"_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "'{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.20211024",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|