typescript 4.5.0-dev.20211022 → 4.5.0-dev.20211026
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 +45 -20
- package/lib/tsserver.js +72 -38
- package/lib/tsserverlibrary.d.ts +0 -1
- package/lib/tsserverlibrary.js +72 -38
- package/lib/typescript.d.ts +0 -1
- package/lib/typescript.js +72 -38
- package/lib/typescriptServices.d.ts +0 -1
- package/lib/typescriptServices.js +72 -38
- package/lib/typingsInstaller.js +45 -20
- package/lib/zh-cn/diagnosticMessages.generated.json +1 -0
- package/lib/zh-tw/diagnosticMessages.generated.json +1 -0
- package/package.json +1 -1
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20211026";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -8335,6 +8335,7 @@ var ts;
|
|
|
8335
8335
|
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."),
|
|
8336
8336
|
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."),
|
|
8337
8337
|
_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."),
|
|
8338
|
+
_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."),
|
|
8338
8339
|
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'"),
|
|
8339
8340
|
Imported_via_0_from_file_1: diag(1393, ts.DiagnosticCategory.Message, "Imported_via_0_from_file_1_1393", "Imported via {0} from file '{1}'"),
|
|
8340
8341
|
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}'"),
|
|
@@ -32127,7 +32128,10 @@ var ts;
|
|
|
32127
32128
|
case 12 /* ObjectLiteralMembers */: return parseErrorAtCurrentToken(ts.Diagnostics.Property_assignment_expected);
|
|
32128
32129
|
case 15 /* ArrayLiteralMembers */: return parseErrorAtCurrentToken(ts.Diagnostics.Expression_or_comma_expected);
|
|
32129
32130
|
case 17 /* JSDocParameters */: return parseErrorAtCurrentToken(ts.Diagnostics.Parameter_declaration_expected);
|
|
32130
|
-
case 16 /* Parameters */:
|
|
32131
|
+
case 16 /* Parameters */:
|
|
32132
|
+
return ts.isKeyword(token())
|
|
32133
|
+
? parseErrorAtCurrentToken(ts.Diagnostics._0_is_not_allowed_as_a_parameter_name, ts.tokenToString(token()))
|
|
32134
|
+
: parseErrorAtCurrentToken(ts.Diagnostics.Parameter_declaration_expected);
|
|
32131
32135
|
case 19 /* TypeParameters */: return parseErrorAtCurrentToken(ts.Diagnostics.Type_parameter_declaration_expected);
|
|
32132
32136
|
case 20 /* TypeArguments */: return parseErrorAtCurrentToken(ts.Diagnostics.Type_argument_expected);
|
|
32133
32137
|
case 21 /* TupleElementTypes */: return parseErrorAtCurrentToken(ts.Diagnostics.Type_expected);
|
|
@@ -45887,6 +45891,7 @@ var ts;
|
|
|
45887
45891
|
case 168 /* MethodDeclaration */:
|
|
45888
45892
|
case 171 /* GetAccessor */:
|
|
45889
45893
|
case 172 /* SetAccessor */:
|
|
45894
|
+
case 169 /* ClassStaticBlockDeclaration */:
|
|
45890
45895
|
// this.foo assignment in a JavaScript class
|
|
45891
45896
|
// Bind this property to the containing class
|
|
45892
45897
|
var containingClass = thisContainer.parent;
|
|
@@ -49597,21 +49602,28 @@ var ts;
|
|
|
49597
49602
|
var namespaceName = getFullyQualifiedName(namespace);
|
|
49598
49603
|
var declarationName = ts.declarationNameToString(right);
|
|
49599
49604
|
var suggestionForNonexistentModule = getSuggestedSymbolForNonexistentModule(right, namespace);
|
|
49600
|
-
var exportedTypeSymbol = getMergedSymbol(getSymbol(getExportsOfSymbol(namespace), right.escapedText, 788968 /* Type */));
|
|
49601
|
-
var containingQualifiedName = ts.isQualifiedName(name) && getContainingQualifiedNameNode(name);
|
|
49602
|
-
var canSuggestTypeof = containingQualifiedName && !ts.isTypeOfExpression(containingQualifiedName.parent) && tryGetQualifiedNameAsValue(containingQualifiedName);
|
|
49603
49605
|
if (suggestionForNonexistentModule) {
|
|
49604
49606
|
error(right, ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, namespaceName, declarationName, symbolToString(suggestionForNonexistentModule));
|
|
49607
|
+
return undefined;
|
|
49605
49608
|
}
|
|
49606
|
-
|
|
49609
|
+
var containingQualifiedName = ts.isQualifiedName(name) && getContainingQualifiedNameNode(name);
|
|
49610
|
+
var canSuggestTypeof = globalObjectType // <-- can't pull on types if global types aren't initialized yet
|
|
49611
|
+
&& (meaning & 788968 /* Type */)
|
|
49612
|
+
&& containingQualifiedName
|
|
49613
|
+
&& !ts.isTypeOfExpression(containingQualifiedName.parent)
|
|
49614
|
+
&& tryGetQualifiedNameAsValue(containingQualifiedName);
|
|
49615
|
+
if (canSuggestTypeof) {
|
|
49607
49616
|
error(containingQualifiedName, ts.Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0, ts.entityNameToString(containingQualifiedName));
|
|
49617
|
+
return undefined;
|
|
49608
49618
|
}
|
|
49609
|
-
|
|
49610
|
-
|
|
49611
|
-
|
|
49612
|
-
|
|
49613
|
-
|
|
49619
|
+
if (meaning & 1920 /* Namespace */ && ts.isQualifiedName(name.parent)) {
|
|
49620
|
+
var exportedTypeSymbol = getMergedSymbol(getSymbol(getExportsOfSymbol(namespace), right.escapedText, 788968 /* Type */));
|
|
49621
|
+
if (exportedTypeSymbol) {
|
|
49622
|
+
error(name.parent.right, ts.Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1, symbolToString(exportedTypeSymbol), ts.unescapeLeadingUnderscores(name.parent.right.escapedText));
|
|
49623
|
+
return undefined;
|
|
49624
|
+
}
|
|
49614
49625
|
}
|
|
49626
|
+
error(right, ts.Diagnostics.Namespace_0_has_no_exported_member_1, namespaceName, declarationName);
|
|
49615
49627
|
}
|
|
49616
49628
|
return undefined;
|
|
49617
49629
|
}
|
|
@@ -49947,8 +49959,8 @@ var ts;
|
|
|
49947
49959
|
if (exportEquals !== moduleSymbol) {
|
|
49948
49960
|
var type = getTypeOfSymbol(exportEquals);
|
|
49949
49961
|
if (shouldTreatPropertiesOfExternalModuleAsExports(type)) {
|
|
49950
|
-
|
|
49951
|
-
cb(symbol,
|
|
49962
|
+
forEachPropertyOfType(type, function (symbol, escapedName) {
|
|
49963
|
+
cb(symbol, escapedName);
|
|
49952
49964
|
});
|
|
49953
49965
|
}
|
|
49954
49966
|
}
|
|
@@ -50280,12 +50292,15 @@ var ts;
|
|
|
50280
50292
|
function getNamedMembers(members) {
|
|
50281
50293
|
var result;
|
|
50282
50294
|
members.forEach(function (symbol, id) {
|
|
50283
|
-
if (
|
|
50295
|
+
if (isNamedMember(symbol, id)) {
|
|
50284
50296
|
(result || (result = [])).push(symbol);
|
|
50285
50297
|
}
|
|
50286
50298
|
});
|
|
50287
50299
|
return result || ts.emptyArray;
|
|
50288
50300
|
}
|
|
50301
|
+
function isNamedMember(member, escapedName) {
|
|
50302
|
+
return !isReservedMemberName(escapedName) && symbolIsValue(member);
|
|
50303
|
+
}
|
|
50289
50304
|
function getNamedOrIndexSignatureMembers(members) {
|
|
50290
50305
|
var result = getNamedMembers(members);
|
|
50291
50306
|
var index = getIndexSymbolFromSymbolTable(members);
|
|
@@ -57118,6 +57133,16 @@ var ts;
|
|
|
57118
57133
|
getPropertiesOfUnionOrIntersectionType(type) :
|
|
57119
57134
|
getPropertiesOfObjectType(type);
|
|
57120
57135
|
}
|
|
57136
|
+
function forEachPropertyOfType(type, action) {
|
|
57137
|
+
type = getReducedApparentType(type);
|
|
57138
|
+
if (type.flags & 3670016 /* StructuredType */) {
|
|
57139
|
+
resolveStructuredTypeMembers(type).members.forEach(function (symbol, escapedName) {
|
|
57140
|
+
if (isNamedMember(symbol, escapedName)) {
|
|
57141
|
+
action(symbol, escapedName);
|
|
57142
|
+
}
|
|
57143
|
+
});
|
|
57144
|
+
}
|
|
57145
|
+
}
|
|
57121
57146
|
function isTypeInvalidDueToUnionDiscriminant(contextualType, obj) {
|
|
57122
57147
|
var list = obj.properties;
|
|
57123
57148
|
return list.some(function (property) {
|
|
@@ -60901,13 +60926,14 @@ var ts;
|
|
|
60901
60926
|
}
|
|
60902
60927
|
return result;
|
|
60903
60928
|
}
|
|
60929
|
+
function isDistributionDependent(root) {
|
|
60930
|
+
return root.isDistributive && (isTypeParameterPossiblyReferenced(root.checkType, root.node.trueType) ||
|
|
60931
|
+
isTypeParameterPossiblyReferenced(root.checkType, root.node.falseType));
|
|
60932
|
+
}
|
|
60904
60933
|
function getTypeFromConditionalTypeNode(node) {
|
|
60905
60934
|
var links = getNodeLinks(node);
|
|
60906
60935
|
if (!links.resolvedType) {
|
|
60907
60936
|
var checkType = getTypeFromTypeNode(node.checkType);
|
|
60908
|
-
var isDistributive = !!(checkType.flags & 262144 /* TypeParameter */);
|
|
60909
|
-
var isDistributionDependent = isDistributive && (isTypeParameterPossiblyReferenced(checkType, node.trueType) ||
|
|
60910
|
-
isTypeParameterPossiblyReferenced(checkType, node.falseType));
|
|
60911
60937
|
var aliasSymbol = getAliasSymbolForTypeNode(node);
|
|
60912
60938
|
var aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
|
|
60913
60939
|
var allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true);
|
|
@@ -60916,8 +60942,7 @@ var ts;
|
|
|
60916
60942
|
node: node,
|
|
60917
60943
|
checkType: checkType,
|
|
60918
60944
|
extendsType: getTypeFromTypeNode(node.extendsType),
|
|
60919
|
-
isDistributive:
|
|
60920
|
-
isDistributionDependent: isDistributionDependent,
|
|
60945
|
+
isDistributive: !!(checkType.flags & 262144 /* TypeParameter */),
|
|
60921
60946
|
inferTypeParameters: getInferTypeParameters(node),
|
|
60922
60947
|
outerTypeParameters: outerTypeParameters,
|
|
60923
60948
|
instantiations: undefined,
|
|
@@ -64064,7 +64089,7 @@ var ts;
|
|
|
64064
64089
|
// We check for a relationship to a conditional type target only when the conditional type has no
|
|
64065
64090
|
// 'infer' positions and is not distributive or is distributive but doesn't reference the check type
|
|
64066
64091
|
// parameter in either of the result types.
|
|
64067
|
-
if (!c.root.inferTypeParameters && !c.root
|
|
64092
|
+
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
|
|
64068
64093
|
// Check if the conditional is always true or always false but still deferred for distribution purposes.
|
|
64069
64094
|
var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
|
|
64070
64095
|
var skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
|
|
@@ -126146,10 +126171,14 @@ var ts;
|
|
|
126146
126171
|
}
|
|
126147
126172
|
var isDefault = exportKind === 1 /* Default */;
|
|
126148
126173
|
var namedSymbol = isDefault && ts.getLocalSymbolForExportDefault(symbol) || symbol;
|
|
126149
|
-
// A
|
|
126150
|
-
//
|
|
126151
|
-
//
|
|
126152
|
-
|
|
126174
|
+
// 1. A named export must be imported by its key in `moduleSymbol.exports` or `moduleSymbol.members`.
|
|
126175
|
+
// 2. A re-export merged with an export from a module augmentation can result in `symbol`
|
|
126176
|
+
// being an external module symbol; the name it is re-exported by will be `symbolTableKey`
|
|
126177
|
+
// (which comes from the keys of `moduleSymbol.exports`.)
|
|
126178
|
+
// 3. Otherwise, we have a default/namespace import that can be imported by any name, and
|
|
126179
|
+
// `symbolTableKey` will be something undesirable like `export=` or `default`, so we try to
|
|
126180
|
+
// get a better name.
|
|
126181
|
+
var importedName = exportKind === 0 /* Named */ || ts.isExternalModuleSymbol(namedSymbol)
|
|
126153
126182
|
? ts.unescapeLeadingUnderscores(symbolTableKey)
|
|
126154
126183
|
: ts.getNameForExportedSymbol(namedSymbol, scriptTarget);
|
|
126155
126184
|
var moduleName = ts.stripQuotes(moduleSymbol.name);
|
|
@@ -126380,7 +126409,7 @@ var ts;
|
|
|
126380
126409
|
cache.add(importingFile.path, defaultInfo.symbol, defaultInfo.exportKind === 1 /* Default */ ? "default" /* Default */ : "export=" /* ExportEquals */, moduleSymbol, moduleFile, defaultInfo.exportKind, isFromPackageJson, scriptTarget, checker);
|
|
126381
126410
|
}
|
|
126382
126411
|
checker.forEachExportAndPropertyOfModule(moduleSymbol, function (exported, key) {
|
|
126383
|
-
if (exported !== (defaultInfo === null || defaultInfo === void 0 ? void 0 : defaultInfo.symbol) && isImportableSymbol(exported, checker) && ts.addToSeen(seenExports,
|
|
126412
|
+
if (exported !== (defaultInfo === null || defaultInfo === void 0 ? void 0 : defaultInfo.symbol) && isImportableSymbol(exported, checker) && ts.addToSeen(seenExports, key)) {
|
|
126384
126413
|
cache.add(importingFile.path, exported, key, moduleSymbol, moduleFile, 0 /* Named */, isFromPackageJson, scriptTarget, checker);
|
|
126385
126414
|
}
|
|
126386
126415
|
});
|
|
@@ -129235,8 +129264,8 @@ var ts;
|
|
|
129235
129264
|
}
|
|
129236
129265
|
var checker = origin.isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker();
|
|
129237
129266
|
var moduleSymbol = origin.moduleSymbol;
|
|
129238
|
-
var
|
|
129239
|
-
var _b = ts.codefix.getImportCompletionAction(
|
|
129267
|
+
var targetSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker));
|
|
129268
|
+
var _b = ts.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions)), host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences), moduleSpecifier = _b.moduleSpecifier, codeAction = _b.codeAction;
|
|
129240
129269
|
ts.Debug.assert(!(data === null || data === void 0 ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier);
|
|
129241
129270
|
return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] };
|
|
129242
129271
|
}
|
|
@@ -130131,8 +130160,9 @@ var ts;
|
|
|
130131
130160
|
function isNewIdentifierDefinitionLocation() {
|
|
130132
130161
|
if (contextToken) {
|
|
130133
130162
|
var containingNodeKind = contextToken.parent.kind;
|
|
130163
|
+
var tokenKind = keywordForNode(contextToken);
|
|
130134
130164
|
// Previous token may have been a keyword that was converted to an identifier.
|
|
130135
|
-
switch (
|
|
130165
|
+
switch (tokenKind) {
|
|
130136
130166
|
case 27 /* CommaToken */:
|
|
130137
130167
|
return containingNodeKind === 207 /* CallExpression */ // func( a, |
|
|
130138
130168
|
|| containingNodeKind === 170 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
|
|
@@ -130167,10 +130197,14 @@ var ts;
|
|
|
130167
130197
|
return containingNodeKind === 222 /* TemplateExpression */; // `aa ${|
|
|
130168
130198
|
case 16 /* TemplateMiddle */:
|
|
130169
130199
|
return containingNodeKind === 232 /* TemplateSpan */; // `aa ${10} dd ${|
|
|
130170
|
-
case
|
|
130171
|
-
|
|
130172
|
-
|
|
130173
|
-
|
|
130200
|
+
case 131 /* AsyncKeyword */:
|
|
130201
|
+
return containingNodeKind === 168 /* MethodDeclaration */ // const obj = { async c|()
|
|
130202
|
+
|| containingNodeKind === 295 /* ShorthandPropertyAssignment */; // const obj = { async c|
|
|
130203
|
+
case 41 /* AsteriskToken */:
|
|
130204
|
+
return containingNodeKind === 168 /* MethodDeclaration */; // const obj = { * c|
|
|
130205
|
+
}
|
|
130206
|
+
if (isClassMemberCompletionKeyword(tokenKind)) {
|
|
130207
|
+
return true;
|
|
130174
130208
|
}
|
|
130175
130209
|
}
|
|
130176
130210
|
return false;
|
|
@@ -148475,11 +148509,11 @@ var ts;
|
|
|
148475
148509
|
AddAsTypeOnly[AddAsTypeOnly["Required"] = 2] = "Required";
|
|
148476
148510
|
AddAsTypeOnly[AddAsTypeOnly["NotAllowed"] = 4] = "NotAllowed";
|
|
148477
148511
|
})(AddAsTypeOnly || (AddAsTypeOnly = {}));
|
|
148478
|
-
function getImportCompletionAction(
|
|
148512
|
+
function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, host, program, formatContext, position, preferences) {
|
|
148479
148513
|
var compilerOptions = program.getCompilerOptions();
|
|
148480
148514
|
var exportInfos = ts.pathIsBareSpecifier(ts.stripQuotes(moduleSymbol.name))
|
|
148481
|
-
? [getSymbolExportInfoForSymbol(
|
|
148482
|
-
: getAllReExportingModules(sourceFile,
|
|
148515
|
+
? [getSymbolExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)]
|
|
148516
|
+
: getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, host, program, preferences, /*useAutoImportProvider*/ true);
|
|
148483
148517
|
var useRequire = shouldUseRequire(sourceFile, program);
|
|
148484
148518
|
var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(ts.getTokenAtPosition(sourceFile, position));
|
|
148485
148519
|
var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
|
|
@@ -148517,7 +148551,7 @@ var ts;
|
|
|
148517
148551
|
}
|
|
148518
148552
|
}
|
|
148519
148553
|
}
|
|
148520
|
-
function getAllReExportingModules(importingFile,
|
|
148554
|
+
function getAllReExportingModules(importingFile, targetSymbol, exportingModuleSymbol, symbolName, host, program, preferences, useAutoImportProvider) {
|
|
148521
148555
|
var result = [];
|
|
148522
148556
|
var compilerOptions = program.getCompilerOptions();
|
|
148523
148557
|
var getModuleSpecifierResolutionHost = ts.memoizeOne(function (isFromPackageJson) {
|
|
@@ -148530,12 +148564,12 @@ var ts;
|
|
|
148530
148564
|
return;
|
|
148531
148565
|
}
|
|
148532
148566
|
var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
|
|
148533
|
-
if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions)) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) ===
|
|
148567
|
+
if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions)) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
|
|
148534
148568
|
result.push({ symbol: defaultInfo.symbol, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: defaultInfo.exportKind, targetFlags: ts.skipAlias(defaultInfo.symbol, checker).flags, isFromPackageJson: isFromPackageJson });
|
|
148535
148569
|
}
|
|
148536
148570
|
for (var _i = 0, _a = checker.getExportsAndPropertiesOfModule(moduleSymbol); _i < _a.length; _i++) {
|
|
148537
148571
|
var exported = _a[_i];
|
|
148538
|
-
if (exported.name === symbolName && ts.skipAlias(exported, checker) ===
|
|
148572
|
+
if (exported.name === symbolName && checker.getMergedSymbol(ts.skipAlias(exported, checker)) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
|
|
148539
148573
|
result.push({ symbol: exported, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: 0 /* Named */, targetFlags: ts.skipAlias(exported, checker).flags, isFromPackageJson: isFromPackageJson });
|
|
148540
148574
|
}
|
|
148541
148575
|
}
|
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.20211026";
|
|
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}'"),
|
|
@@ -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;
|
|
@@ -49392,21 +49397,28 @@ var ts;
|
|
|
49392
49397
|
var namespaceName = getFullyQualifiedName(namespace);
|
|
49393
49398
|
var declarationName = ts.declarationNameToString(right);
|
|
49394
49399
|
var suggestionForNonexistentModule = getSuggestedSymbolForNonexistentModule(right, namespace);
|
|
49395
|
-
var exportedTypeSymbol = getMergedSymbol(getSymbol(getExportsOfSymbol(namespace), right.escapedText, 788968 /* Type */));
|
|
49396
|
-
var containingQualifiedName = ts.isQualifiedName(name) && getContainingQualifiedNameNode(name);
|
|
49397
|
-
var canSuggestTypeof = containingQualifiedName && !ts.isTypeOfExpression(containingQualifiedName.parent) && tryGetQualifiedNameAsValue(containingQualifiedName);
|
|
49398
49400
|
if (suggestionForNonexistentModule) {
|
|
49399
49401
|
error(right, ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, namespaceName, declarationName, symbolToString(suggestionForNonexistentModule));
|
|
49402
|
+
return undefined;
|
|
49400
49403
|
}
|
|
49401
|
-
|
|
49404
|
+
var containingQualifiedName = ts.isQualifiedName(name) && getContainingQualifiedNameNode(name);
|
|
49405
|
+
var canSuggestTypeof = globalObjectType // <-- can't pull on types if global types aren't initialized yet
|
|
49406
|
+
&& (meaning & 788968 /* Type */)
|
|
49407
|
+
&& containingQualifiedName
|
|
49408
|
+
&& !ts.isTypeOfExpression(containingQualifiedName.parent)
|
|
49409
|
+
&& tryGetQualifiedNameAsValue(containingQualifiedName);
|
|
49410
|
+
if (canSuggestTypeof) {
|
|
49402
49411
|
error(containingQualifiedName, ts.Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0, ts.entityNameToString(containingQualifiedName));
|
|
49412
|
+
return undefined;
|
|
49403
49413
|
}
|
|
49404
|
-
|
|
49405
|
-
|
|
49406
|
-
|
|
49407
|
-
|
|
49408
|
-
|
|
49414
|
+
if (meaning & 1920 /* Namespace */ && ts.isQualifiedName(name.parent)) {
|
|
49415
|
+
var exportedTypeSymbol = getMergedSymbol(getSymbol(getExportsOfSymbol(namespace), right.escapedText, 788968 /* Type */));
|
|
49416
|
+
if (exportedTypeSymbol) {
|
|
49417
|
+
error(name.parent.right, ts.Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1, symbolToString(exportedTypeSymbol), ts.unescapeLeadingUnderscores(name.parent.right.escapedText));
|
|
49418
|
+
return undefined;
|
|
49419
|
+
}
|
|
49409
49420
|
}
|
|
49421
|
+
error(right, ts.Diagnostics.Namespace_0_has_no_exported_member_1, namespaceName, declarationName);
|
|
49410
49422
|
}
|
|
49411
49423
|
return undefined;
|
|
49412
49424
|
}
|
|
@@ -49742,8 +49754,8 @@ var ts;
|
|
|
49742
49754
|
if (exportEquals !== moduleSymbol) {
|
|
49743
49755
|
var type = getTypeOfSymbol(exportEquals);
|
|
49744
49756
|
if (shouldTreatPropertiesOfExternalModuleAsExports(type)) {
|
|
49745
|
-
|
|
49746
|
-
cb(symbol,
|
|
49757
|
+
forEachPropertyOfType(type, function (symbol, escapedName) {
|
|
49758
|
+
cb(symbol, escapedName);
|
|
49747
49759
|
});
|
|
49748
49760
|
}
|
|
49749
49761
|
}
|
|
@@ -50075,12 +50087,15 @@ var ts;
|
|
|
50075
50087
|
function getNamedMembers(members) {
|
|
50076
50088
|
var result;
|
|
50077
50089
|
members.forEach(function (symbol, id) {
|
|
50078
|
-
if (
|
|
50090
|
+
if (isNamedMember(symbol, id)) {
|
|
50079
50091
|
(result || (result = [])).push(symbol);
|
|
50080
50092
|
}
|
|
50081
50093
|
});
|
|
50082
50094
|
return result || ts.emptyArray;
|
|
50083
50095
|
}
|
|
50096
|
+
function isNamedMember(member, escapedName) {
|
|
50097
|
+
return !isReservedMemberName(escapedName) && symbolIsValue(member);
|
|
50098
|
+
}
|
|
50084
50099
|
function getNamedOrIndexSignatureMembers(members) {
|
|
50085
50100
|
var result = getNamedMembers(members);
|
|
50086
50101
|
var index = getIndexSymbolFromSymbolTable(members);
|
|
@@ -56913,6 +56928,16 @@ var ts;
|
|
|
56913
56928
|
getPropertiesOfUnionOrIntersectionType(type) :
|
|
56914
56929
|
getPropertiesOfObjectType(type);
|
|
56915
56930
|
}
|
|
56931
|
+
function forEachPropertyOfType(type, action) {
|
|
56932
|
+
type = getReducedApparentType(type);
|
|
56933
|
+
if (type.flags & 3670016 /* StructuredType */) {
|
|
56934
|
+
resolveStructuredTypeMembers(type).members.forEach(function (symbol, escapedName) {
|
|
56935
|
+
if (isNamedMember(symbol, escapedName)) {
|
|
56936
|
+
action(symbol, escapedName);
|
|
56937
|
+
}
|
|
56938
|
+
});
|
|
56939
|
+
}
|
|
56940
|
+
}
|
|
56916
56941
|
function isTypeInvalidDueToUnionDiscriminant(contextualType, obj) {
|
|
56917
56942
|
var list = obj.properties;
|
|
56918
56943
|
return list.some(function (property) {
|
|
@@ -60696,13 +60721,14 @@ var ts;
|
|
|
60696
60721
|
}
|
|
60697
60722
|
return result;
|
|
60698
60723
|
}
|
|
60724
|
+
function isDistributionDependent(root) {
|
|
60725
|
+
return root.isDistributive && (isTypeParameterPossiblyReferenced(root.checkType, root.node.trueType) ||
|
|
60726
|
+
isTypeParameterPossiblyReferenced(root.checkType, root.node.falseType));
|
|
60727
|
+
}
|
|
60699
60728
|
function getTypeFromConditionalTypeNode(node) {
|
|
60700
60729
|
var links = getNodeLinks(node);
|
|
60701
60730
|
if (!links.resolvedType) {
|
|
60702
60731
|
var checkType = getTypeFromTypeNode(node.checkType);
|
|
60703
|
-
var isDistributive = !!(checkType.flags & 262144 /* TypeParameter */);
|
|
60704
|
-
var isDistributionDependent = isDistributive && (isTypeParameterPossiblyReferenced(checkType, node.trueType) ||
|
|
60705
|
-
isTypeParameterPossiblyReferenced(checkType, node.falseType));
|
|
60706
60732
|
var aliasSymbol = getAliasSymbolForTypeNode(node);
|
|
60707
60733
|
var aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
|
|
60708
60734
|
var allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true);
|
|
@@ -60711,8 +60737,7 @@ var ts;
|
|
|
60711
60737
|
node: node,
|
|
60712
60738
|
checkType: checkType,
|
|
60713
60739
|
extendsType: getTypeFromTypeNode(node.extendsType),
|
|
60714
|
-
isDistributive:
|
|
60715
|
-
isDistributionDependent: isDistributionDependent,
|
|
60740
|
+
isDistributive: !!(checkType.flags & 262144 /* TypeParameter */),
|
|
60716
60741
|
inferTypeParameters: getInferTypeParameters(node),
|
|
60717
60742
|
outerTypeParameters: outerTypeParameters,
|
|
60718
60743
|
instantiations: undefined,
|
|
@@ -63859,7 +63884,7 @@ var ts;
|
|
|
63859
63884
|
// We check for a relationship to a conditional type target only when the conditional type has no
|
|
63860
63885
|
// 'infer' positions and is not distributive or is distributive but doesn't reference the check type
|
|
63861
63886
|
// parameter in either of the result types.
|
|
63862
|
-
if (!c.root.inferTypeParameters && !c.root
|
|
63887
|
+
if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
|
|
63863
63888
|
// Check if the conditional is always true or always false but still deferred for distribution purposes.
|
|
63864
63889
|
var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
|
|
63865
63890
|
var skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
|
|
@@ -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.20211026",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|