typescript 4.6.0-dev.20220206 → 4.6.0-dev.20220210
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 -2
- package/lib/de/diagnosticMessages.generated.json +1 -2
- package/lib/es/diagnosticMessages.generated.json +1 -2
- package/lib/fr/diagnosticMessages.generated.json +1 -2
- package/lib/it/diagnosticMessages.generated.json +1 -2
- package/lib/ja/diagnosticMessages.generated.json +1 -2
- package/lib/ko/diagnosticMessages.generated.json +1 -2
- package/lib/pl/diagnosticMessages.generated.json +1 -2
- package/lib/pt-br/diagnosticMessages.generated.json +1 -2
- package/lib/ru/diagnosticMessages.generated.json +1 -2
- package/lib/tr/diagnosticMessages.generated.json +1 -2
- package/lib/tsc.js +119 -54
- package/lib/tsserver.js +169 -64
- package/lib/tsserverlibrary.js +169 -64
- package/lib/typescript.js +166 -62
- package/lib/typescriptServices.js +166 -62
- package/lib/typingsInstaller.js +135 -56
- package/lib/zh-cn/diagnosticMessages.generated.json +1 -2
- package/lib/zh-tw/diagnosticMessages.generated.json +1 -2
- package/package.json +1 -1
package/lib/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220210";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -8045,10 +8045,10 @@ var ts;
|
|
|
8045
8045
|
A_type_predicate_cannot_reference_a_rest_parameter: diag(1229, ts.DiagnosticCategory.Error, "A_type_predicate_cannot_reference_a_rest_parameter_1229", "A type predicate cannot reference a rest parameter."),
|
|
8046
8046
|
A_type_predicate_cannot_reference_element_0_in_a_binding_pattern: diag(1230, ts.DiagnosticCategory.Error, "A_type_predicate_cannot_reference_element_0_in_a_binding_pattern_1230", "A type predicate cannot reference element '{0}' in a binding pattern."),
|
|
8047
8047
|
An_export_assignment_must_be_at_the_top_level_of_a_file_or_module_declaration: diag(1231, ts.DiagnosticCategory.Error, "An_export_assignment_must_be_at_the_top_level_of_a_file_or_module_declaration_1231", "An export assignment must be at the top level of a file or module declaration."),
|
|
8048
|
-
|
|
8049
|
-
|
|
8048
|
+
An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module: diag(1232, ts.DiagnosticCategory.Error, "An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module_1232", "An import declaration can only be used at the top level of a namespace or module."),
|
|
8049
|
+
An_export_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module: diag(1233, ts.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module_1233", "An export declaration can only be used at the top level of a namespace or module."),
|
|
8050
8050
|
An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: diag(1234, ts.DiagnosticCategory.Error, "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234", "An ambient module declaration is only allowed at the top level in a file."),
|
|
8051
|
-
|
|
8051
|
+
A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module: diag(1235, ts.DiagnosticCategory.Error, "A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module_1235", "A namespace declaration is only allowed at the top level of a namespace or module."),
|
|
8052
8052
|
The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: diag(1236, ts.DiagnosticCategory.Error, "The_return_type_of_a_property_decorator_function_must_be_either_void_or_any_1236", "The return type of a property decorator function must be either 'void' or 'any'."),
|
|
8053
8053
|
The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: diag(1237, ts.DiagnosticCategory.Error, "The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any_1237", "The return type of a parameter decorator function must be either 'void' or 'any'."),
|
|
8054
8054
|
Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: diag(1238, ts.DiagnosticCategory.Error, "Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression_1238", "Unable to resolve signature of class decorator when called as an expression."),
|
|
@@ -8216,6 +8216,8 @@ var ts;
|
|
|
8216
8216
|
The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output: diag(1470, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470", "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."),
|
|
8217
8217
|
Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead."),
|
|
8218
8218
|
catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
|
|
8219
|
+
An_import_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1473, ts.DiagnosticCategory.Error, "An_import_declaration_can_only_be_used_at_the_top_level_of_a_module_1473", "An import declaration can only be used at the top level of a module."),
|
|
8220
|
+
An_export_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1474, ts.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_at_the_top_level_of_a_module_1474", "An export declaration can only be used at the top level of a module."),
|
|
8219
8221
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
8220
8222
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
8221
8223
|
Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
|
|
@@ -13897,6 +13899,10 @@ var ts;
|
|
|
13897
13899
|
return undefined;
|
|
13898
13900
|
}
|
|
13899
13901
|
ts.getDeclarationOfKind = getDeclarationOfKind;
|
|
13902
|
+
function getDeclarationsOfKind(symbol, kind) {
|
|
13903
|
+
return ts.filter(symbol.declarations || ts.emptyArray, function (d) { return d.kind === kind; });
|
|
13904
|
+
}
|
|
13905
|
+
ts.getDeclarationsOfKind = getDeclarationsOfKind;
|
|
13900
13906
|
function createSymbolTable(symbols) {
|
|
13901
13907
|
var result = new ts.Map();
|
|
13902
13908
|
if (symbols) {
|
|
@@ -14132,6 +14138,10 @@ var ts;
|
|
|
14132
14138
|
return getSourceFileOfNode(module.valueDeclaration || getNonAugmentationDeclaration(module));
|
|
14133
14139
|
}
|
|
14134
14140
|
ts.getSourceFileOfModule = getSourceFileOfModule;
|
|
14141
|
+
function isPlainJsFile(file, checkJs) {
|
|
14142
|
+
return !!file && (file.scriptKind === 1 /* JS */ || file.scriptKind === 2 /* JSX */) && !file.checkJsDirective && checkJs === undefined;
|
|
14143
|
+
}
|
|
14144
|
+
ts.isPlainJsFile = isPlainJsFile;
|
|
14135
14145
|
function isStatementWithLocals(node) {
|
|
14136
14146
|
switch (node.kind) {
|
|
14137
14147
|
case 234 /* Block */:
|
|
@@ -46909,6 +46919,9 @@ var ts;
|
|
|
46909
46919
|
CheckMode[CheckMode["SkipContextSensitive"] = 4] = "SkipContextSensitive";
|
|
46910
46920
|
CheckMode[CheckMode["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
|
|
46911
46921
|
CheckMode[CheckMode["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
|
|
46922
|
+
CheckMode[CheckMode["RestBindingElement"] = 32] = "RestBindingElement";
|
|
46923
|
+
// e.g. in `const { a, ...rest } = foo`, when checking the type of `foo` to determine the type of `rest`,
|
|
46924
|
+
// we need to preserve generic types instead of substituting them for constraints
|
|
46912
46925
|
})(CheckMode || (CheckMode = {}));
|
|
46913
46926
|
var SignatureCheckMode;
|
|
46914
46927
|
(function (SignatureCheckMode) {
|
|
@@ -47961,13 +47974,13 @@ var ts;
|
|
|
47961
47974
|
else { // error
|
|
47962
47975
|
var isEitherEnum = !!(target.flags & 384 /* Enum */ || source.flags & 384 /* Enum */);
|
|
47963
47976
|
var isEitherBlockScoped_1 = !!(target.flags & 2 /* BlockScopedVariable */ || source.flags & 2 /* BlockScopedVariable */);
|
|
47964
|
-
var message = isEitherEnum
|
|
47965
|
-
? ts.Diagnostics.
|
|
47966
|
-
: isEitherBlockScoped_1
|
|
47967
|
-
? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0
|
|
47977
|
+
var message = isEitherEnum ? ts.Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations
|
|
47978
|
+
: isEitherBlockScoped_1 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0
|
|
47968
47979
|
: ts.Diagnostics.Duplicate_identifier_0;
|
|
47969
47980
|
var sourceSymbolFile = source.declarations && ts.getSourceFileOfNode(source.declarations[0]);
|
|
47970
47981
|
var targetSymbolFile = target.declarations && ts.getSourceFileOfNode(target.declarations[0]);
|
|
47982
|
+
var isSourcePlainJs = ts.isPlainJsFile(sourceSymbolFile, compilerOptions.checkJs);
|
|
47983
|
+
var isTargetPlainJs = ts.isPlainJsFile(targetSymbolFile, compilerOptions.checkJs);
|
|
47971
47984
|
var symbolName_1 = symbolToString(source);
|
|
47972
47985
|
// Collect top-level duplicate identifier errors into one mapping, so we can then merge their diagnostics if there are a bunch
|
|
47973
47986
|
if (sourceSymbolFile && targetSymbolFile && amalgamatedDuplicates && !isEitherEnum && sourceSymbolFile !== targetSymbolFile) {
|
|
@@ -47979,12 +47992,16 @@ var ts;
|
|
|
47979
47992
|
var conflictingSymbolInfo = ts.getOrUpdate(filesDuplicates.conflictingSymbols, symbolName_1, function () {
|
|
47980
47993
|
return ({ isBlockScoped: isEitherBlockScoped_1, firstFileLocations: [], secondFileLocations: [] });
|
|
47981
47994
|
});
|
|
47982
|
-
|
|
47983
|
-
|
|
47995
|
+
if (!isSourcePlainJs)
|
|
47996
|
+
addDuplicateLocations(conflictingSymbolInfo.firstFileLocations, source);
|
|
47997
|
+
if (!isTargetPlainJs)
|
|
47998
|
+
addDuplicateLocations(conflictingSymbolInfo.secondFileLocations, target);
|
|
47984
47999
|
}
|
|
47985
48000
|
else {
|
|
47986
|
-
|
|
47987
|
-
|
|
48001
|
+
if (!isSourcePlainJs)
|
|
48002
|
+
addDuplicateDeclarationErrorsForSymbols(source, message, symbolName_1, target);
|
|
48003
|
+
if (!isTargetPlainJs)
|
|
48004
|
+
addDuplicateDeclarationErrorsForSymbols(target, message, symbolName_1, source);
|
|
47988
48005
|
}
|
|
47989
48006
|
}
|
|
47990
48007
|
return target;
|
|
@@ -48441,6 +48458,8 @@ var ts;
|
|
|
48441
48458
|
// type parameters are visible in parameter list, return type and type parameter list
|
|
48442
48459
|
? lastLocation === location.type ||
|
|
48443
48460
|
lastLocation.kind === 163 /* Parameter */ ||
|
|
48461
|
+
lastLocation.kind === 338 /* JSDocParameterTag */ ||
|
|
48462
|
+
lastLocation.kind === 339 /* JSDocReturnTag */ ||
|
|
48444
48463
|
lastLocation.kind === 162 /* TypeParameter */
|
|
48445
48464
|
// local types not visible outside the function body
|
|
48446
48465
|
: false;
|
|
@@ -48700,9 +48719,9 @@ var ts;
|
|
|
48700
48719
|
lastSelfReferenceLocation = location;
|
|
48701
48720
|
}
|
|
48702
48721
|
lastLocation = location;
|
|
48703
|
-
location = ts.isJSDocTemplateTag(location) ?
|
|
48704
|
-
ts.
|
|
48705
|
-
|
|
48722
|
+
location = ts.isJSDocTemplateTag(location) ? ts.getEffectiveContainerForJSDocTemplateTag(location) || location.parent :
|
|
48723
|
+
ts.isJSDocParameterTag(location) || ts.isJSDocReturnTag(location) ? ts.getHostSignatureFromJSDoc(location) || location.parent :
|
|
48724
|
+
location.parent;
|
|
48706
48725
|
}
|
|
48707
48726
|
// We just climbed up parents looking for the name, meaning that we started in a descendant node of `lastLocation`.
|
|
48708
48727
|
// If `result === lastSelfReferenceLocation.symbol`, that means that we are somewhere inside `lastSelfReferenceLocation` looking up a name, and resolving to `lastLocation` itself.
|
|
@@ -49836,16 +49855,20 @@ var ts;
|
|
|
49836
49855
|
return;
|
|
49837
49856
|
}
|
|
49838
49857
|
var host = ts.getJSDocHost(node);
|
|
49839
|
-
if (host &&
|
|
49840
|
-
|
|
49841
|
-
ts.isBinaryExpression(host.expression) &&
|
|
49842
|
-
ts.getAssignmentDeclarationKind(host.expression) === 3 /* PrototypeProperty */) {
|
|
49843
|
-
// X.prototype.m = /** @param {K} p */ function () { } <-- look for K on X's declaration
|
|
49858
|
+
if (host && ts.isExpressionStatement(host) && ts.isPrototypePropertyAssignment(host.expression)) {
|
|
49859
|
+
// /** @param {K} p */ X.prototype.m = function () { } <-- look for K on X's declaration
|
|
49844
49860
|
var symbol = getSymbolOfNode(host.expression.left);
|
|
49845
49861
|
if (symbol) {
|
|
49846
49862
|
return getDeclarationOfJSPrototypeContainer(symbol);
|
|
49847
49863
|
}
|
|
49848
49864
|
}
|
|
49865
|
+
if (host && ts.isFunctionExpression(host) && ts.isPrototypePropertyAssignment(host.parent) && ts.isExpressionStatement(host.parent.parent)) {
|
|
49866
|
+
// X.prototype.m = /** @param {K} p */ function () { } <-- look for K on X's declaration
|
|
49867
|
+
var symbol = getSymbolOfNode(host.parent.left);
|
|
49868
|
+
if (symbol) {
|
|
49869
|
+
return getDeclarationOfJSPrototypeContainer(symbol);
|
|
49870
|
+
}
|
|
49871
|
+
}
|
|
49849
49872
|
if (host && (ts.isObjectLiteralMethod(host) || ts.isPropertyAssignment(host)) &&
|
|
49850
49873
|
ts.isBinaryExpression(host.parent.parent) &&
|
|
49851
49874
|
ts.getAssignmentDeclarationKind(host.parent.parent) === 6 /* Prototype */) {
|
|
@@ -54332,9 +54355,12 @@ var ts;
|
|
|
54332
54355
|
}
|
|
54333
54356
|
// Return the type of a binding element parent. We check SymbolLinks first to see if a type has been
|
|
54334
54357
|
// assigned by contextual typing.
|
|
54335
|
-
function getTypeForBindingElementParent(node) {
|
|
54358
|
+
function getTypeForBindingElementParent(node, checkMode) {
|
|
54359
|
+
if (checkMode !== 0 /* Normal */) {
|
|
54360
|
+
return getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false, checkMode);
|
|
54361
|
+
}
|
|
54336
54362
|
var symbol = getSymbolOfNode(node);
|
|
54337
|
-
return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false);
|
|
54363
|
+
return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false, checkMode);
|
|
54338
54364
|
}
|
|
54339
54365
|
function getRestType(source, properties, symbol) {
|
|
54340
54366
|
source = filterType(source, function (t) { return !(t.flags & 98304 /* Nullable */); });
|
|
@@ -54452,7 +54478,8 @@ var ts;
|
|
|
54452
54478
|
}
|
|
54453
54479
|
/** Return the inferred type for a binding element */
|
|
54454
54480
|
function getTypeForBindingElement(declaration) {
|
|
54455
|
-
var
|
|
54481
|
+
var checkMode = declaration.dotDotDotToken ? 32 /* RestBindingElement */ : 0 /* Normal */;
|
|
54482
|
+
var parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
|
|
54456
54483
|
return parentType && getBindingElementTypeFromParentType(declaration, parentType);
|
|
54457
54484
|
}
|
|
54458
54485
|
function getBindingElementTypeFromParentType(declaration, parentType) {
|
|
@@ -54524,9 +54551,9 @@ var ts;
|
|
|
54524
54551
|
if (ts.getEffectiveTypeAnnotationNode(ts.walkUpBindingElementsAndPatterns(declaration))) {
|
|
54525
54552
|
// In strict null checking mode, if a default value of a non-undefined type is specified, remove
|
|
54526
54553
|
// undefined from the final type.
|
|
54527
|
-
return strictNullChecks && !(getFalsyFlags(checkDeclarationInitializer(declaration)) & 32768 /* Undefined */) ? getNonUndefinedType(type) : type;
|
|
54554
|
+
return strictNullChecks && !(getFalsyFlags(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 32768 /* Undefined */) ? getNonUndefinedType(type) : type;
|
|
54528
54555
|
}
|
|
54529
|
-
return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration)], 2 /* Subtype */));
|
|
54556
|
+
return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
|
|
54530
54557
|
}
|
|
54531
54558
|
function getTypeForDeclarationFromJSDocComment(declaration) {
|
|
54532
54559
|
var jsdocType = ts.getJSDocType(declaration);
|
|
@@ -54549,11 +54576,11 @@ var ts;
|
|
|
54549
54576
|
return strictNullChecks && isOptional ? getOptionalType(type, isProperty) : type;
|
|
54550
54577
|
}
|
|
54551
54578
|
// Return the inferred type for a variable, parameter, or property declaration
|
|
54552
|
-
function getTypeForVariableLikeDeclaration(declaration, includeOptionality) {
|
|
54579
|
+
function getTypeForVariableLikeDeclaration(declaration, includeOptionality, checkMode) {
|
|
54553
54580
|
// A variable declared in a for..in statement is of type string, or of type keyof T when the
|
|
54554
54581
|
// right hand expression is of a type parameter type.
|
|
54555
54582
|
if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 242 /* ForInStatement */) {
|
|
54556
|
-
var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression)));
|
|
54583
|
+
var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression, /*checkMode*/ checkMode)));
|
|
54557
54584
|
return indexType.flags & (262144 /* TypeParameter */ | 4194304 /* Index */) ? getExtractStringType(indexType) : stringType;
|
|
54558
54585
|
}
|
|
54559
54586
|
if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 243 /* ForOfStatement */) {
|
|
@@ -54630,7 +54657,7 @@ var ts;
|
|
|
54630
54657
|
return containerObjectType;
|
|
54631
54658
|
}
|
|
54632
54659
|
}
|
|
54633
|
-
var type = widenTypeInferredFromInitializer(declaration, checkDeclarationInitializer(declaration));
|
|
54660
|
+
var type = widenTypeInferredFromInitializer(declaration, checkDeclarationInitializer(declaration, checkMode));
|
|
54634
54661
|
return addOptionality(type, isProperty, isOptional);
|
|
54635
54662
|
}
|
|
54636
54663
|
if (ts.isPropertyDeclaration(declaration) && (noImplicitAny || ts.isInJSFile(declaration))) {
|
|
@@ -55002,7 +55029,7 @@ var ts;
|
|
|
55002
55029
|
// contextual type or, if the element itself is a binding pattern, with the type implied by that binding
|
|
55003
55030
|
// pattern.
|
|
55004
55031
|
var contextualType = ts.isBindingPattern(element.name) ? getTypeFromBindingPattern(element.name, /*includePatternInType*/ true, /*reportErrors*/ false) : unknownType;
|
|
55005
|
-
return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, contextualType)));
|
|
55032
|
+
return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, 0 /* Normal */, contextualType)));
|
|
55006
55033
|
}
|
|
55007
55034
|
if (ts.isBindingPattern(element.name)) {
|
|
55008
55035
|
return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors);
|
|
@@ -55091,7 +55118,7 @@ var ts;
|
|
|
55091
55118
|
// binding pattern [x, s = ""]. Because the contextual type is a tuple type, the resulting type of [1, "one"] is the
|
|
55092
55119
|
// tuple type [number, string]. Thus, the type inferred for 'x' is number and the type inferred for 's' is string.
|
|
55093
55120
|
function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) {
|
|
55094
|
-
return widenTypeForVariableLikeDeclaration(getTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ true), declaration, reportErrors);
|
|
55121
|
+
return widenTypeForVariableLikeDeclaration(getTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ true, 0 /* Normal */), declaration, reportErrors);
|
|
55095
55122
|
}
|
|
55096
55123
|
function isGlobalSymbolConstructor(node) {
|
|
55097
55124
|
var symbol = getSymbolOfNode(node);
|
|
@@ -55320,10 +55347,12 @@ var ts;
|
|
|
55320
55347
|
if (writing === void 0) { writing = false; }
|
|
55321
55348
|
var getter = ts.getDeclarationOfKind(symbol, 171 /* GetAccessor */);
|
|
55322
55349
|
var setter = ts.getDeclarationOfKind(symbol, 172 /* SetAccessor */);
|
|
55323
|
-
var setterType = getAnnotatedAccessorType(setter);
|
|
55324
55350
|
// For write operations, prioritize type annotations on the setter
|
|
55325
|
-
if (writing
|
|
55326
|
-
|
|
55351
|
+
if (writing) {
|
|
55352
|
+
var setterType_1 = getAnnotatedAccessorType(setter);
|
|
55353
|
+
if (setterType_1) {
|
|
55354
|
+
return instantiateTypeIfNeeded(setterType_1, symbol);
|
|
55355
|
+
}
|
|
55327
55356
|
}
|
|
55328
55357
|
// Else defer to the getter type
|
|
55329
55358
|
if (getter && ts.isInJSFile(getter)) {
|
|
@@ -55338,6 +55367,7 @@ var ts;
|
|
|
55338
55367
|
return instantiateTypeIfNeeded(getterType, symbol);
|
|
55339
55368
|
}
|
|
55340
55369
|
// If the user didn't specify a return type, try to use the set-accessor's parameter type.
|
|
55370
|
+
var setterType = getAnnotatedAccessorType(setter);
|
|
55341
55371
|
if (setterType) {
|
|
55342
55372
|
return setterType;
|
|
55343
55373
|
}
|
|
@@ -55486,6 +55516,39 @@ var ts;
|
|
|
55486
55516
|
}
|
|
55487
55517
|
return links.type;
|
|
55488
55518
|
}
|
|
55519
|
+
function getWriteTypeOfSymbolWithDeferredType(symbol) {
|
|
55520
|
+
var links = getSymbolLinks(symbol);
|
|
55521
|
+
if (!links.writeType && links.deferralWriteConstituents) {
|
|
55522
|
+
ts.Debug.assertIsDefined(links.deferralParent);
|
|
55523
|
+
ts.Debug.assertIsDefined(links.deferralConstituents);
|
|
55524
|
+
links.writeType = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralWriteConstituents) : getIntersectionType(links.deferralWriteConstituents);
|
|
55525
|
+
}
|
|
55526
|
+
return links.writeType;
|
|
55527
|
+
}
|
|
55528
|
+
/**
|
|
55529
|
+
* Distinct write types come only from set accessors, but union and intersection
|
|
55530
|
+
* properties deriving from set accessors will either pre-compute or defer the
|
|
55531
|
+
* union or intersection of the writeTypes of their constituents. To account for
|
|
55532
|
+
* this, we will assume that any deferred type or transient symbol may have a
|
|
55533
|
+
* `writeType` (or a deferred write type ready to be computed) that should be
|
|
55534
|
+
* used before looking for set accessor declarations.
|
|
55535
|
+
*/
|
|
55536
|
+
function getWriteTypeOfSymbol(symbol) {
|
|
55537
|
+
var checkFlags = ts.getCheckFlags(symbol);
|
|
55538
|
+
if (checkFlags & 65536 /* DeferredType */) {
|
|
55539
|
+
var writeType = getWriteTypeOfSymbolWithDeferredType(symbol);
|
|
55540
|
+
if (writeType) {
|
|
55541
|
+
return writeType;
|
|
55542
|
+
}
|
|
55543
|
+
}
|
|
55544
|
+
if (symbol.flags & 33554432 /* Transient */) {
|
|
55545
|
+
var writeType = symbol.writeType;
|
|
55546
|
+
if (writeType) {
|
|
55547
|
+
return writeType;
|
|
55548
|
+
}
|
|
55549
|
+
}
|
|
55550
|
+
return getSetAccessorTypeOfSymbol(symbol);
|
|
55551
|
+
}
|
|
55489
55552
|
function getSetAccessorTypeOfSymbol(symbol) {
|
|
55490
55553
|
if (symbol.flags & 98304 /* Accessor */) {
|
|
55491
55554
|
var type = getTypeOfSetAccessor(symbol);
|
|
@@ -57856,6 +57919,7 @@ var ts;
|
|
|
57856
57919
|
var firstType;
|
|
57857
57920
|
var nameType;
|
|
57858
57921
|
var propTypes = [];
|
|
57922
|
+
var writeTypes;
|
|
57859
57923
|
var firstValueDeclaration;
|
|
57860
57924
|
var hasNonUniformValueDeclaration = false;
|
|
57861
57925
|
for (var _d = 0, props_1 = props; _d < props_1.length; _d++) {
|
|
@@ -57872,6 +57936,10 @@ var ts;
|
|
|
57872
57936
|
firstType = type;
|
|
57873
57937
|
nameType = getSymbolLinks(prop).nameType;
|
|
57874
57938
|
}
|
|
57939
|
+
var writeType = getWriteTypeOfSymbol(prop);
|
|
57940
|
+
if (writeTypes || writeType !== type) {
|
|
57941
|
+
writeTypes = ts.append(!writeTypes ? propTypes.slice() : writeTypes, writeType);
|
|
57942
|
+
}
|
|
57875
57943
|
else if (type !== firstType) {
|
|
57876
57944
|
checkFlags |= 64 /* HasNonUniformType */;
|
|
57877
57945
|
}
|
|
@@ -57900,9 +57968,13 @@ var ts;
|
|
|
57900
57968
|
result.checkFlags |= 65536 /* DeferredType */;
|
|
57901
57969
|
result.deferralParent = containingType;
|
|
57902
57970
|
result.deferralConstituents = propTypes;
|
|
57971
|
+
result.deferralWriteConstituents = writeTypes;
|
|
57903
57972
|
}
|
|
57904
57973
|
else {
|
|
57905
57974
|
result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes);
|
|
57975
|
+
if (writeTypes) {
|
|
57976
|
+
result.writeType = isUnion ? getUnionType(writeTypes) : getIntersectionType(writeTypes);
|
|
57977
|
+
}
|
|
57906
57978
|
}
|
|
57907
57979
|
return result;
|
|
57908
57980
|
}
|
|
@@ -59044,7 +59116,7 @@ var ts;
|
|
|
59044
59116
|
}
|
|
59045
59117
|
function getImpliedConstraint(type, checkNode, extendsNode) {
|
|
59046
59118
|
return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(type, checkNode.elements[0], extendsNode.elements[0]) :
|
|
59047
|
-
getActualTypeVariable(getTypeFromTypeNode(checkNode)) === type ? getTypeFromTypeNode(extendsNode) :
|
|
59119
|
+
getActualTypeVariable(getTypeFromTypeNode(checkNode)) === getActualTypeVariable(type) ? getTypeFromTypeNode(extendsNode) :
|
|
59048
59120
|
undefined;
|
|
59049
59121
|
}
|
|
59050
59122
|
function getConditionalFlowTypeOfType(type, node) {
|
|
@@ -69853,12 +69925,16 @@ var ts;
|
|
|
69853
69925
|
function isGenericTypeWithoutNullableConstraint(type) {
|
|
69854
69926
|
return !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
|
|
69855
69927
|
}
|
|
69856
|
-
function
|
|
69928
|
+
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
69857
69929
|
// Computing the contextual type for a child of a JSX element involves resolving the type of the
|
|
69858
69930
|
// element's tag name, so we exclude that here to avoid circularities.
|
|
69931
|
+
// If check mode has `CheckMode.RestBindingElement`, we skip binding pattern contextual types,
|
|
69932
|
+
// as we want the type of a rest element to be generic when possible.
|
|
69859
69933
|
var contextualType = (ts.isIdentifier(node) || ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) &&
|
|
69860
69934
|
!((ts.isJsxOpeningElement(node.parent) || ts.isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) &&
|
|
69861
|
-
|
|
69935
|
+
(checkMode && checkMode & 32 /* RestBindingElement */ ?
|
|
69936
|
+
getContextualType(node, 8 /* SkipBindingPatterns */)
|
|
69937
|
+
: getContextualType(node));
|
|
69862
69938
|
return contextualType && !isGenericType(contextualType);
|
|
69863
69939
|
}
|
|
69864
69940
|
function getNarrowableTypeForReference(type, reference, checkMode) {
|
|
@@ -69871,7 +69947,7 @@ var ts;
|
|
|
69871
69947
|
// 'string | undefined' to give control flow analysis the opportunity to narrow to type 'string'.
|
|
69872
69948
|
var substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) &&
|
|
69873
69949
|
someType(type, isGenericTypeWithUnionConstraint) &&
|
|
69874
|
-
(isConstraintPosition(type, reference) ||
|
|
69950
|
+
(isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
|
|
69875
69951
|
return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ && !isMappedTypeGenericIndexedAccess(t) ? getBaseConstraintOrType(t) : t; }) : type;
|
|
69876
69952
|
}
|
|
69877
69953
|
function isExportOrExportExpression(location) {
|
|
@@ -69939,7 +70015,7 @@ var ts;
|
|
|
69939
70015
|
var links = getNodeLinks(location);
|
|
69940
70016
|
if (!(links.flags & 268435456 /* InCheckIdentifier */)) {
|
|
69941
70017
|
links.flags |= 268435456 /* InCheckIdentifier */;
|
|
69942
|
-
var parentType = getTypeForBindingElementParent(parent);
|
|
70018
|
+
var parentType = getTypeForBindingElementParent(parent, 0 /* Normal */);
|
|
69943
70019
|
links.flags &= ~268435456 /* InCheckIdentifier */;
|
|
69944
70020
|
if (parentType && parentType.flags & 1048576 /* Union */ && !(parent.kind === 163 /* Parameter */ && isSymbolAssigned(symbol))) {
|
|
69945
70021
|
var pattern = declaration.parent;
|
|
@@ -70792,7 +70868,7 @@ var ts;
|
|
|
70792
70868
|
var parent = declaration.parent.parent;
|
|
70793
70869
|
var name = declaration.propertyName || declaration.name;
|
|
70794
70870
|
var parentType = getContextualTypeForVariableLikeDeclaration(parent) ||
|
|
70795
|
-
parent.kind !== 202 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent);
|
|
70871
|
+
parent.kind !== 202 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 32 /* RestBindingElement */ : 0 /* Normal */);
|
|
70796
70872
|
if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name))
|
|
70797
70873
|
return undefined;
|
|
70798
70874
|
if (parent.name.kind === 201 /* ArrayBindingPattern */) {
|
|
@@ -73033,7 +73109,7 @@ var ts;
|
|
|
73033
73109
|
error(right, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, ts.idText(right));
|
|
73034
73110
|
return errorType;
|
|
73035
73111
|
}
|
|
73036
|
-
propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : writing ?
|
|
73112
|
+
propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : writing ? getWriteTypeOfSymbol(prop) : getTypeOfSymbol(prop);
|
|
73037
73113
|
}
|
|
73038
73114
|
return getFlowTypeOfAccessExpression(node, prop, propType, right, checkMode);
|
|
73039
73115
|
}
|
|
@@ -75958,7 +76034,7 @@ var ts;
|
|
|
75958
76034
|
var links = getSymbolLinks(parameter);
|
|
75959
76035
|
if (!links.type) {
|
|
75960
76036
|
var declaration = parameter.valueDeclaration;
|
|
75961
|
-
links.type = type || getWidenedTypeForVariableLikeDeclaration(declaration, /*
|
|
76037
|
+
links.type = type || getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true);
|
|
75962
76038
|
if (declaration.name.kind !== 79 /* Identifier */) {
|
|
75963
76039
|
// if inference didn't come up with anything but unknown, fall back to the binding pattern if present.
|
|
75964
76040
|
if (links.type === unknownType) {
|
|
@@ -77689,11 +77765,11 @@ var ts;
|
|
|
77689
77765
|
}
|
|
77690
77766
|
}
|
|
77691
77767
|
function checkExpressionCached(node, checkMode) {
|
|
77768
|
+
if (checkMode && checkMode !== 0 /* Normal */) {
|
|
77769
|
+
return checkExpression(node, checkMode);
|
|
77770
|
+
}
|
|
77692
77771
|
var links = getNodeLinks(node);
|
|
77693
77772
|
if (!links.resolvedType) {
|
|
77694
|
-
if (checkMode && checkMode !== 0 /* Normal */) {
|
|
77695
|
-
return checkExpression(node, checkMode);
|
|
77696
|
-
}
|
|
77697
77773
|
// When computing a type that we're going to cache, we need to ignore any ongoing control flow
|
|
77698
77774
|
// analysis because variables may have transient types in indeterminable states. Moving flowLoopStart
|
|
77699
77775
|
// to the top of the stack ensures all transient types are computed from a known point.
|
|
@@ -77713,10 +77789,12 @@ var ts;
|
|
|
77713
77789
|
node.kind === 228 /* AsExpression */ ||
|
|
77714
77790
|
ts.isJSDocTypeAssertion(node);
|
|
77715
77791
|
}
|
|
77716
|
-
function checkDeclarationInitializer(declaration, contextualType) {
|
|
77792
|
+
function checkDeclarationInitializer(declaration, checkMode, contextualType) {
|
|
77717
77793
|
var initializer = ts.getEffectiveInitializer(declaration);
|
|
77718
77794
|
var type = getQuickTypeOfExpression(initializer) ||
|
|
77719
|
-
(contextualType ?
|
|
77795
|
+
(contextualType ?
|
|
77796
|
+
checkExpressionWithContextualType(initializer, contextualType, /*inferenceContext*/ undefined, checkMode || 0 /* Normal */)
|
|
77797
|
+
: checkExpressionCached(initializer, checkMode));
|
|
77720
77798
|
return ts.isParameter(declaration) && declaration.name.kind === 201 /* ArrayBindingPattern */ &&
|
|
77721
77799
|
isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ?
|
|
77722
77800
|
padTupleType(type, declaration.name) : type;
|
|
@@ -80653,7 +80731,8 @@ var ts;
|
|
|
80653
80731
|
}
|
|
80654
80732
|
// check private/protected variable access
|
|
80655
80733
|
var parent = node.parent.parent;
|
|
80656
|
-
var
|
|
80734
|
+
var parentCheckMode = node.dotDotDotToken ? 32 /* RestBindingElement */ : 0 /* Normal */;
|
|
80735
|
+
var parentType = getTypeForBindingElementParent(parent, parentCheckMode);
|
|
80657
80736
|
var name = node.propertyName || node.name;
|
|
80658
80737
|
if (parentType && !ts.isBindingPattern(name)) {
|
|
80659
80738
|
var exprType = getLiteralTypeFromPropertyName(name);
|
|
@@ -81892,7 +81971,7 @@ var ts;
|
|
|
81892
81971
|
var declaration = catchClause.variableDeclaration;
|
|
81893
81972
|
var typeNode = ts.getEffectiveTypeAnnotationNode(ts.getRootDeclaration(declaration));
|
|
81894
81973
|
if (typeNode) {
|
|
81895
|
-
var type = getTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ false);
|
|
81974
|
+
var type = getTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ false, 0 /* Normal */);
|
|
81896
81975
|
if (type && !(type.flags & 3 /* AnyOrUnknown */)) {
|
|
81897
81976
|
grammarErrorOnFirstToken(typeNode, ts.Diagnostics.Catch_clause_variable_type_annotation_must_be_any_or_unknown_if_specified);
|
|
81898
81977
|
}
|
|
@@ -82998,7 +83077,7 @@ var ts;
|
|
|
82998
83077
|
var isAmbientExternalModule = ts.isAmbientModule(node);
|
|
82999
83078
|
var contextErrorMessage = isAmbientExternalModule
|
|
83000
83079
|
? ts.Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file
|
|
83001
|
-
: ts.Diagnostics.
|
|
83080
|
+
: ts.Diagnostics.A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module;
|
|
83002
83081
|
if (checkGrammarModuleElementContext(node, contextErrorMessage)) {
|
|
83003
83082
|
// If we hit a module declaration in an illegal context, just bail out to avoid cascading errors.
|
|
83004
83083
|
return;
|
|
@@ -83314,7 +83393,7 @@ var ts;
|
|
|
83314
83393
|
}
|
|
83315
83394
|
}
|
|
83316
83395
|
function checkImportDeclaration(node) {
|
|
83317
|
-
if (checkGrammarModuleElementContext(node, ts.Diagnostics.
|
|
83396
|
+
if (checkGrammarModuleElementContext(node, ts.isInJSFile(node) ? ts.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module : ts.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)) {
|
|
83318
83397
|
// If we hit an import declaration in an illegal context, just bail out to avoid cascading errors.
|
|
83319
83398
|
return;
|
|
83320
83399
|
}
|
|
@@ -83347,7 +83426,7 @@ var ts;
|
|
|
83347
83426
|
checkAssertClause(node);
|
|
83348
83427
|
}
|
|
83349
83428
|
function checkImportEqualsDeclaration(node) {
|
|
83350
|
-
if (checkGrammarModuleElementContext(node, ts.Diagnostics.
|
|
83429
|
+
if (checkGrammarModuleElementContext(node, ts.isInJSFile(node) ? ts.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module : ts.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)) {
|
|
83351
83430
|
// If we hit an import declaration in an illegal context, just bail out to avoid cascading errors.
|
|
83352
83431
|
return;
|
|
83353
83432
|
}
|
|
@@ -83384,7 +83463,7 @@ var ts;
|
|
|
83384
83463
|
}
|
|
83385
83464
|
}
|
|
83386
83465
|
function checkExportDeclaration(node) {
|
|
83387
|
-
if (checkGrammarModuleElementContext(node, ts.Diagnostics.
|
|
83466
|
+
if (checkGrammarModuleElementContext(node, ts.isInJSFile(node) ? ts.Diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_module : ts.Diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)) {
|
|
83388
83467
|
// If we hit an export in an illegal context, just bail out to avoid cascading errors.
|
|
83389
83468
|
return;
|
|
83390
83469
|
}
|
|
@@ -84618,7 +84697,7 @@ var ts;
|
|
|
84618
84697
|
return errorType;
|
|
84619
84698
|
}
|
|
84620
84699
|
if (ts.isBindingPattern(node)) {
|
|
84621
|
-
return getTypeForVariableLikeDeclaration(node.parent, /*includeOptionality*/ true) || errorType;
|
|
84700
|
+
return getTypeForVariableLikeDeclaration(node.parent, /*includeOptionality*/ true, 0 /* Normal */) || errorType;
|
|
84622
84701
|
}
|
|
84623
84702
|
if (isInRightSideOfImportOrExportAssignment(node)) {
|
|
84624
84703
|
var symbol = getSymbolAtLocation(node);
|
|
@@ -114365,9 +114444,9 @@ var ts;
|
|
|
114365
114444
|
ts.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code,
|
|
114366
114445
|
ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter.code,
|
|
114367
114446
|
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code,
|
|
114368
|
-
ts.Diagnostics.
|
|
114447
|
+
ts.Diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_module.code,
|
|
114369
114448
|
ts.Diagnostics.An_export_declaration_cannot_have_modifiers.code,
|
|
114370
|
-
ts.Diagnostics.
|
|
114449
|
+
ts.Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module.code,
|
|
114371
114450
|
ts.Diagnostics.An_import_declaration_cannot_have_modifiers.code,
|
|
114372
114451
|
ts.Diagnostics.An_object_member_cannot_be_declared_optional.code,
|
|
114373
114452
|
ts.Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element.code,
|
|
@@ -115435,7 +115514,7 @@ var ts;
|
|
|
115435
115514
|
ts.Debug.assert(!!sourceFile.bindDiagnostics);
|
|
115436
115515
|
var isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
|
|
115437
115516
|
var isCheckJs = isJs && ts.isCheckJsEnabledForFile(sourceFile, options);
|
|
115438
|
-
var isPlainJs =
|
|
115517
|
+
var isPlainJs = ts.isPlainJsFile(sourceFile, options.checkJs);
|
|
115439
115518
|
var isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false;
|
|
115440
115519
|
// By default, only type-check .ts, .tsx, Deferred, plain JS, checked JS and External
|
|
115441
115520
|
// - plain JS: .js files with no // ts-check and checkJs: undefined
|
|
@@ -130328,7 +130407,8 @@ var ts;
|
|
|
130328
130407
|
case 103 /* NewKeyword */:
|
|
130329
130408
|
return checker.getContextualType(parent);
|
|
130330
130409
|
case 82 /* CaseKeyword */:
|
|
130331
|
-
|
|
130410
|
+
var caseClause = ts.tryCast(parent, ts.isCaseClause);
|
|
130411
|
+
return caseClause ? ts.getSwitchedType(caseClause, checker) : undefined;
|
|
130332
130412
|
case 18 /* OpenBraceToken */:
|
|
130333
130413
|
return ts.isJsxExpression(parent) && !ts.isJsxElement(parent.parent) && !ts.isJsxFragment(parent.parent) ? checker.getContextualTypeForJsxAttribute(parent.parent) : undefined;
|
|
130334
130414
|
default:
|
|
@@ -132973,7 +133053,24 @@ var ts;
|
|
|
132973
133053
|
function acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, acquiring, scriptKind) {
|
|
132974
133054
|
scriptKind = ts.ensureScriptKind(fileName, scriptKind);
|
|
132975
133055
|
var scriptTarget = scriptKind === 6 /* JSON */ ? 100 /* JSON */ : ts.getEmitScriptTarget(compilationSettings);
|
|
133056
|
+
var oldBucketCount = buckets.size;
|
|
132976
133057
|
var bucket = ts.getOrUpdate(buckets, key, function () { return new ts.Map(); });
|
|
133058
|
+
if (ts.tracing) {
|
|
133059
|
+
if (buckets.size > oldBucketCount) {
|
|
133060
|
+
// It is interesting, but not definitively problematic if a build requires multiple document registry buckets -
|
|
133061
|
+
// perhaps they are for two projects that don't have any overlap.
|
|
133062
|
+
// Bonus: these events can help us interpret the more interesting event below.
|
|
133063
|
+
ts.tracing.instant("session" /* Session */, "createdDocumentRegistryBucket", { configFilePath: compilationSettings.configFilePath, key: key });
|
|
133064
|
+
}
|
|
133065
|
+
// It is fairly suspicious to have one path in two buckets - you'd expect dependencies to have similar configurations.
|
|
133066
|
+
// If this occurs unexpectedly, the fix is likely to synchronize the project settings.
|
|
133067
|
+
// Skip .d.ts files to reduce noise (should also cover most of node_modules).
|
|
133068
|
+
var otherBucketKey = !ts.fileExtensionIs(path, ".d.ts" /* Dts */) &&
|
|
133069
|
+
ts.forEachEntry(buckets, function (bucket, bucketKey) { return bucketKey !== key && bucket.has(path) && bucketKey; });
|
|
133070
|
+
if (otherBucketKey) {
|
|
133071
|
+
ts.tracing.instant("session" /* Session */, "documentRegistryBucketOverlap", { path: path, key1: otherBucketKey, key2: key });
|
|
133072
|
+
}
|
|
133073
|
+
}
|
|
132977
133074
|
var bucketEntry = bucket.get(path);
|
|
132978
133075
|
var entry = bucketEntry && getDocumentRegistryEntry(bucketEntry, scriptKind);
|
|
132979
133076
|
if (!entry && externalCache) {
|
|
@@ -145109,6 +145206,8 @@ var ts;
|
|
|
145109
145206
|
case 179 /* ConstructorType */:
|
|
145110
145207
|
case 174 /* ConstructSignature */:
|
|
145111
145208
|
return getList(node.typeParameters) || getList(node.parameters);
|
|
145209
|
+
case 171 /* GetAccessor */:
|
|
145210
|
+
return getList(node.parameters);
|
|
145112
145211
|
case 256 /* ClassDeclaration */:
|
|
145113
145212
|
case 225 /* ClassExpression */:
|
|
145114
145213
|
case 257 /* InterfaceDeclaration */:
|
|
@@ -152545,6 +152644,9 @@ var ts;
|
|
|
152545
152644
|
case 172 /* SetAccessor */:
|
|
152546
152645
|
// Setter must have a parameter
|
|
152547
152646
|
return false;
|
|
152647
|
+
case 171 /* GetAccessor */:
|
|
152648
|
+
// Getter cannot have parameters
|
|
152649
|
+
return true;
|
|
152548
152650
|
default:
|
|
152549
152651
|
return ts.Debug.failBadSyntaxKind(parent);
|
|
152550
152652
|
}
|
|
@@ -155155,10 +155257,12 @@ var ts;
|
|
|
155155
155257
|
});
|
|
155156
155258
|
function getInfo(sourceFile, pos) {
|
|
155157
155259
|
var token = ts.getTokenAtPosition(sourceFile, pos);
|
|
155158
|
-
var indexSignature = ts.
|
|
155159
|
-
if (
|
|
155260
|
+
var indexSignature = ts.tryCast(token.parent.parent, ts.isIndexSignatureDeclaration);
|
|
155261
|
+
if (!indexSignature)
|
|
155262
|
+
return undefined;
|
|
155263
|
+
var container = ts.isInterfaceDeclaration(indexSignature.parent) ? indexSignature.parent : ts.tryCast(indexSignature.parent.parent, ts.isTypeAliasDeclaration);
|
|
155264
|
+
if (!container)
|
|
155160
155265
|
return undefined;
|
|
155161
|
-
var container = ts.isInterfaceDeclaration(indexSignature.parent) ? indexSignature.parent : ts.cast(indexSignature.parent.parent, ts.isTypeAliasDeclaration);
|
|
155162
155266
|
return { indexSignature: indexSignature, container: container };
|
|
155163
155267
|
}
|
|
155164
155268
|
function createTypeAliasFromInterface(declaration, type) {
|
|
@@ -156749,8 +156853,8 @@ var ts;
|
|
|
156749
156853
|
// but a super *method call* simply implies a 'this' reference
|
|
156750
156854
|
if (node.parent.kind === 207 /* CallExpression */) {
|
|
156751
156855
|
// Super constructor call
|
|
156752
|
-
var containingClass_1 = ts.getContainingClass(node);
|
|
156753
|
-
if (containingClass_1.pos < span.start || containingClass_1.end >= (span.start + span.length)) {
|
|
156856
|
+
var containingClass_1 = ts.getContainingClass(node);
|
|
156857
|
+
if (containingClass_1 === undefined || containingClass_1.pos < span.start || containingClass_1.end >= (span.start + span.length)) {
|
|
156754
156858
|
(errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractSuper));
|
|
156755
156859
|
return true;
|
|
156756
156860
|
}
|
|
@@ -171569,9 +171673,10 @@ var ts;
|
|
|
171569
171673
|
var info = infos && ts.firstOrUndefined(infos);
|
|
171570
171674
|
return info && !info.isLocal ? { fileName: info.fileName, pos: info.textSpan.start } : undefined;
|
|
171571
171675
|
}
|
|
171572
|
-
function combineProjectOutputForReferences(projects, defaultProject, initialLocation) {
|
|
171676
|
+
function combineProjectOutputForReferences(projects, defaultProject, initialLocation, logger) {
|
|
171573
171677
|
var outputs = [];
|
|
171574
171678
|
combineProjectOutputWorker(projects, defaultProject, initialLocation, function (project, location, getMappedLocation) {
|
|
171679
|
+
logger.info("Finding references to " + location.fileName + " position " + location.pos + " in project " + project.getProjectName());
|
|
171575
171680
|
var _loop_8 = function (outputReferencedSymbol) {
|
|
171576
171681
|
var mappedDefinitionFile = getMappedLocation(project, documentSpanLocation(outputReferencedSymbol.definition));
|
|
171577
171682
|
var definition = mappedDefinitionFile === undefined ?
|
|
@@ -172929,7 +173034,7 @@ var ts;
|
|
|
172929
173034
|
var file = server.toNormalizedPath(args.file);
|
|
172930
173035
|
var projects = this.getProjects(args);
|
|
172931
173036
|
var position = this.getPositionInFile(args, file);
|
|
172932
|
-
var references = combineProjectOutputForReferences(projects, this.getDefaultProject(args), { fileName: args.file, pos: position });
|
|
173037
|
+
var references = combineProjectOutputForReferences(projects, this.getDefaultProject(args), { fileName: args.file, pos: position }, this.logger);
|
|
172933
173038
|
if (!simplifiedResult)
|
|
172934
173039
|
return references;
|
|
172935
173040
|
var defaultProject = this.getDefaultProject(args);
|