@typescript-deploys/pr-build 5.2.0-pr-54781-9 → 5.2.0-pr-52493-8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +87 -71
- package/lib/tsserver.js +152 -80
- package/lib/tsserverlibrary.d.ts +1 -1
- package/lib/tsserverlibrary.js +150 -80
- package/lib/typescript.d.ts +1 -1
- package/lib/typescript.js +148 -80
- package/lib/typingsInstaller.js +2 -3
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.2";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20230627`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -6212,7 +6212,6 @@ var Diagnostics = {
|
|
|
6212
6212
|
This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0: diag(2343, 1 /* Error */, "This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_ve_2343", "This syntax requires an imported helper named '{1}' which does not exist in '{0}'. Consider upgrading your version of '{0}'."),
|
|
6213
6213
|
Type_0_does_not_satisfy_the_constraint_1: diag(2344, 1 /* Error */, "Type_0_does_not_satisfy_the_constraint_1_2344", "Type '{0}' does not satisfy the constraint '{1}'."),
|
|
6214
6214
|
Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: diag(2345, 1 /* Error */, "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345", "Argument of type '{0}' is not assignable to parameter of type '{1}'."),
|
|
6215
|
-
Call_target_does_not_contain_any_signatures: diag(2346, 1 /* Error */, "Call_target_does_not_contain_any_signatures_2346", "Call target does not contain any signatures."),
|
|
6216
6215
|
Untyped_function_calls_may_not_accept_type_arguments: diag(2347, 1 /* Error */, "Untyped_function_calls_may_not_accept_type_arguments_2347", "Untyped function calls may not accept type arguments."),
|
|
6217
6216
|
Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: diag(2348, 1 /* Error */, "Value_of_type_0_is_not_callable_Did_you_mean_to_include_new_2348", "Value of type '{0}' is not callable. Did you mean to include 'new'?"),
|
|
6218
6217
|
This_expression_is_not_callable: diag(2349, 1 /* Error */, "This_expression_is_not_callable_2349", "This expression is not callable."),
|
|
@@ -6822,7 +6821,6 @@ var Diagnostics = {
|
|
|
6822
6821
|
Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0: diag(5081, 1 /* Error */, "Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0_5081", "Cannot find a tsconfig.json file at the current directory: {0}."),
|
|
6823
6822
|
_0_could_be_instantiated_with_an_arbitrary_type_which_could_be_unrelated_to_1: diag(5082, 1 /* Error */, "_0_could_be_instantiated_with_an_arbitrary_type_which_could_be_unrelated_to_1_5082", "'{0}' could be instantiated with an arbitrary type which could be unrelated to '{1}'."),
|
|
6824
6823
|
Cannot_read_file_0: diag(5083, 1 /* Error */, "Cannot_read_file_0_5083", "Cannot read file '{0}'."),
|
|
6825
|
-
Tuple_members_must_all_have_names_or_all_not_have_names: diag(5084, 1 /* Error */, "Tuple_members_must_all_have_names_or_all_not_have_names_5084", "Tuple members must all have names or all not have names."),
|
|
6826
6824
|
A_tuple_member_cannot_be_both_optional_and_rest: diag(5085, 1 /* Error */, "A_tuple_member_cannot_be_both_optional_and_rest_5085", "A tuple member cannot be both optional and rest."),
|
|
6827
6825
|
A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type: diag(5086, 1 /* Error */, "A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_c_5086", "A labeled tuple element is declared as optional with a question mark after the name and before the colon, rather than after the type."),
|
|
6828
6826
|
A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type: diag(5087, 1 /* Error */, "A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type_5087", "A labeled tuple element is declared as rest with a '...' before the name, rather than before the type."),
|
|
@@ -7748,6 +7746,7 @@ var Diagnostics = {
|
|
|
7748
7746
|
Inline_variable: diag(95184, 3 /* Message */, "Inline_variable_95184", "Inline variable"),
|
|
7749
7747
|
Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
|
|
7750
7748
|
Variables_with_multiple_declarations_cannot_be_inlined: diag(95186, 3 /* Message */, "Variables_with_multiple_declarations_cannot_be_inlined_95186", "Variables with multiple declarations cannot be inlined."),
|
|
7749
|
+
Add_missing_comma_for_object_member_completion_0: diag(95187, 3 /* Message */, "Add_missing_comma_for_object_member_completion_0_95187", "Add missing comma for object member completion '{0}'."),
|
|
7751
7750
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
7752
7751
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
7753
7752
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -13288,8 +13287,8 @@ function isInExpressionContext(node) {
|
|
|
13288
13287
|
return forStatement.initializer === node && forStatement.initializer.kind !== 261 /* VariableDeclarationList */ || forStatement.condition === node || forStatement.incrementor === node;
|
|
13289
13288
|
case 249 /* ForInStatement */:
|
|
13290
13289
|
case 250 /* ForOfStatement */:
|
|
13291
|
-
const
|
|
13292
|
-
return
|
|
13290
|
+
const forInOrOfStatement = parent;
|
|
13291
|
+
return forInOrOfStatement.initializer === node && forInOrOfStatement.initializer.kind !== 261 /* VariableDeclarationList */ || forInOrOfStatement.expression === node;
|
|
13293
13292
|
case 216 /* TypeAssertionExpression */:
|
|
13294
13293
|
case 234 /* AsExpression */:
|
|
13295
13294
|
return node === parent.expression;
|
|
@@ -13950,20 +13949,23 @@ function getTypeParameterFromJsDoc(node) {
|
|
|
13950
13949
|
const { typeParameters } = node.parent.parent.parent;
|
|
13951
13950
|
return typeParameters && find(typeParameters, (p) => p.name.escapedText === name);
|
|
13952
13951
|
}
|
|
13953
|
-
function
|
|
13952
|
+
function getAssignmentTarget(node) {
|
|
13954
13953
|
let parent = node.parent;
|
|
13955
13954
|
while (true) {
|
|
13956
13955
|
switch (parent.kind) {
|
|
13957
13956
|
case 226 /* BinaryExpression */:
|
|
13958
|
-
const
|
|
13959
|
-
|
|
13957
|
+
const binaryExpression = parent;
|
|
13958
|
+
const binaryOperator = binaryExpression.operatorToken.kind;
|
|
13959
|
+
return isAssignmentOperator(binaryOperator) && binaryExpression.left === node ? binaryExpression : void 0;
|
|
13960
13960
|
case 224 /* PrefixUnaryExpression */:
|
|
13961
13961
|
case 225 /* PostfixUnaryExpression */:
|
|
13962
|
-
const
|
|
13963
|
-
|
|
13962
|
+
const unaryExpression = parent;
|
|
13963
|
+
const unaryOperator = unaryExpression.operator;
|
|
13964
|
+
return unaryOperator === 46 /* PlusPlusToken */ || unaryOperator === 47 /* MinusMinusToken */ ? unaryExpression : void 0;
|
|
13964
13965
|
case 249 /* ForInStatement */:
|
|
13965
13966
|
case 250 /* ForOfStatement */:
|
|
13966
|
-
|
|
13967
|
+
const forInOrOfStatement = parent;
|
|
13968
|
+
return forInOrOfStatement.initializer === node ? forInOrOfStatement : void 0;
|
|
13967
13969
|
case 217 /* ParenthesizedExpression */:
|
|
13968
13970
|
case 209 /* ArrayLiteralExpression */:
|
|
13969
13971
|
case 230 /* SpreadElement */:
|
|
@@ -13975,24 +13977,53 @@ function getAssignmentTargetKind(node) {
|
|
|
13975
13977
|
break;
|
|
13976
13978
|
case 304 /* ShorthandPropertyAssignment */:
|
|
13977
13979
|
if (parent.name !== node) {
|
|
13978
|
-
return 0
|
|
13980
|
+
return void 0;
|
|
13979
13981
|
}
|
|
13980
13982
|
node = parent.parent;
|
|
13981
13983
|
break;
|
|
13982
13984
|
case 303 /* PropertyAssignment */:
|
|
13983
13985
|
if (parent.name === node) {
|
|
13984
|
-
return 0
|
|
13986
|
+
return void 0;
|
|
13985
13987
|
}
|
|
13986
13988
|
node = parent.parent;
|
|
13987
13989
|
break;
|
|
13988
13990
|
default:
|
|
13989
|
-
return 0
|
|
13991
|
+
return void 0;
|
|
13990
13992
|
}
|
|
13991
13993
|
parent = node.parent;
|
|
13992
13994
|
}
|
|
13993
13995
|
}
|
|
13996
|
+
function getAssignmentTargetKind(node) {
|
|
13997
|
+
const target = getAssignmentTarget(node);
|
|
13998
|
+
if (!target) {
|
|
13999
|
+
return 0 /* None */;
|
|
14000
|
+
}
|
|
14001
|
+
switch (target.kind) {
|
|
14002
|
+
case 226 /* BinaryExpression */:
|
|
14003
|
+
const binaryOperator = target.operatorToken.kind;
|
|
14004
|
+
return binaryOperator === 64 /* EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* Definite */ : 2 /* Compound */;
|
|
14005
|
+
case 224 /* PrefixUnaryExpression */:
|
|
14006
|
+
case 225 /* PostfixUnaryExpression */:
|
|
14007
|
+
return 2 /* Compound */;
|
|
14008
|
+
case 249 /* ForInStatement */:
|
|
14009
|
+
case 250 /* ForOfStatement */:
|
|
14010
|
+
return 1 /* Definite */;
|
|
14011
|
+
}
|
|
14012
|
+
}
|
|
13994
14013
|
function isAssignmentTarget(node) {
|
|
13995
|
-
return
|
|
14014
|
+
return !!getAssignmentTarget(node);
|
|
14015
|
+
}
|
|
14016
|
+
function isCompoundLikeAssignment(assignment) {
|
|
14017
|
+
const right = skipParentheses(assignment.right);
|
|
14018
|
+
return right.kind === 226 /* BinaryExpression */ && isShiftOperatorOrHigher(right.operatorToken.kind);
|
|
14019
|
+
}
|
|
14020
|
+
function isInCompoundLikeAssignment(node) {
|
|
14021
|
+
const target = getAssignmentTarget(node);
|
|
14022
|
+
return !!target && isAssignmentExpression(
|
|
14023
|
+
target,
|
|
14024
|
+
/*excludeCompoundAssignment*/
|
|
14025
|
+
true
|
|
14026
|
+
) && isCompoundLikeAssignment(target);
|
|
13996
14027
|
}
|
|
13997
14028
|
function isNodeWithPossibleHoistedDeclaration(node) {
|
|
13998
14029
|
switch (node.kind) {
|
|
@@ -47964,19 +47995,18 @@ function createTypeChecker(host) {
|
|
|
47964
47995
|
const arity = getTypeReferenceArity(type2);
|
|
47965
47996
|
const tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context);
|
|
47966
47997
|
if (tupleConstituentNodes) {
|
|
47967
|
-
|
|
47968
|
-
|
|
47969
|
-
|
|
47998
|
+
const { labeledElementDeclarations } = type2.target;
|
|
47999
|
+
for (let i = 0; i < tupleConstituentNodes.length; i++) {
|
|
48000
|
+
const flags = type2.target.elementFlags[i];
|
|
48001
|
+
const labeledElementDeclaration = labeledElementDeclarations == null ? void 0 : labeledElementDeclarations[i];
|
|
48002
|
+
if (labeledElementDeclaration) {
|
|
47970
48003
|
tupleConstituentNodes[i] = factory.createNamedTupleMember(
|
|
47971
48004
|
flags & 12 /* Variable */ ? factory.createToken(26 /* DotDotDotToken */) : void 0,
|
|
47972
|
-
factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(
|
|
48005
|
+
factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(labeledElementDeclaration))),
|
|
47973
48006
|
flags & 2 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
|
47974
48007
|
flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]
|
|
47975
48008
|
);
|
|
47976
|
-
}
|
|
47977
|
-
} else {
|
|
47978
|
-
for (let i = 0; i < Math.min(arity, tupleConstituentNodes.length); i++) {
|
|
47979
|
-
const flags = type2.target.elementFlags[i];
|
|
48009
|
+
} else {
|
|
47980
48010
|
tupleConstituentNodes[i] = flags & 12 /* Variable */ ? factory.createRestTypeNode(flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]) : flags & 2 /* Optional */ ? factory.createOptionalTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i];
|
|
47981
48011
|
}
|
|
47982
48012
|
}
|
|
@@ -53088,17 +53118,18 @@ function createTypeChecker(host) {
|
|
|
53088
53118
|
function getExpandedParameters(sig, skipUnionExpanding) {
|
|
53089
53119
|
if (signatureHasRestParameter(sig)) {
|
|
53090
53120
|
const restIndex = sig.parameters.length - 1;
|
|
53121
|
+
const restName = sig.parameters[restIndex].escapedName;
|
|
53091
53122
|
const restType = getTypeOfSymbol(sig.parameters[restIndex]);
|
|
53092
53123
|
if (isTupleType(restType)) {
|
|
53093
|
-
return [expandSignatureParametersWithTupleMembers(restType, restIndex)];
|
|
53124
|
+
return [expandSignatureParametersWithTupleMembers(restType, restIndex, restName)];
|
|
53094
53125
|
} else if (!skipUnionExpanding && restType.flags & 1048576 /* Union */ && every(restType.types, isTupleType)) {
|
|
53095
|
-
return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex));
|
|
53126
|
+
return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restName));
|
|
53096
53127
|
}
|
|
53097
53128
|
}
|
|
53098
53129
|
return [sig.parameters];
|
|
53099
|
-
function expandSignatureParametersWithTupleMembers(restType, restIndex) {
|
|
53100
|
-
const elementTypes =
|
|
53101
|
-
const associatedNames = getUniqAssociatedNamesFromTupleType(restType);
|
|
53130
|
+
function expandSignatureParametersWithTupleMembers(restType, restIndex, restName) {
|
|
53131
|
+
const elementTypes = getTypeArguments(restType);
|
|
53132
|
+
const associatedNames = getUniqAssociatedNamesFromTupleType(restType, restName);
|
|
53102
53133
|
const restParams = map(elementTypes, (t, i) => {
|
|
53103
53134
|
const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
|
|
53104
53135
|
const flags = restType.target.elementFlags[i];
|
|
@@ -53109,10 +53140,10 @@ function createTypeChecker(host) {
|
|
|
53109
53140
|
});
|
|
53110
53141
|
return concatenate(sig.parameters.slice(0, restIndex), restParams);
|
|
53111
53142
|
}
|
|
53112
|
-
function getUniqAssociatedNamesFromTupleType(type) {
|
|
53143
|
+
function getUniqAssociatedNamesFromTupleType(type, restName) {
|
|
53113
53144
|
const associatedNamesMap = /* @__PURE__ */ new Map();
|
|
53114
|
-
return map(type.target.labeledElementDeclarations, (labeledElement) => {
|
|
53115
|
-
const name = getTupleElementLabel(labeledElement);
|
|
53145
|
+
return map(type.target.labeledElementDeclarations, (labeledElement, i) => {
|
|
53146
|
+
const name = getTupleElementLabel(labeledElement, i, restName);
|
|
53116
53147
|
const prevCounter = associatedNamesMap.get(name);
|
|
53117
53148
|
if (prevCounter === void 0) {
|
|
53118
53149
|
associatedNamesMap.set(name, 1);
|
|
@@ -56046,13 +56077,10 @@ function createTypeChecker(host) {
|
|
|
56046
56077
|
return readonly ? globalReadonlyArrayType : globalArrayType;
|
|
56047
56078
|
}
|
|
56048
56079
|
const elementFlags = map(node.elements, getTupleElementFlags);
|
|
56049
|
-
|
|
56050
|
-
|
|
56051
|
-
|
|
56052
|
-
|
|
56053
|
-
/*associatedNames*/
|
|
56054
|
-
missingName ? void 0 : node.elements
|
|
56055
|
-
);
|
|
56080
|
+
return getTupleTargetType(elementFlags, readonly, map(node.elements, memberIfLabeledElementDeclaration));
|
|
56081
|
+
}
|
|
56082
|
+
function memberIfLabeledElementDeclaration(member) {
|
|
56083
|
+
return isNamedTupleMember(member) || isParameter(member) ? member : void 0;
|
|
56056
56084
|
}
|
|
56057
56085
|
function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) {
|
|
56058
56086
|
return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 188 /* ArrayType */ ? mayResolveTypeAlias(node.elementType) : node.kind === 189 /* TupleType */ ? some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || some(node.typeArguments, mayResolveTypeAlias));
|
|
@@ -56127,7 +56155,7 @@ function createTypeChecker(host) {
|
|
|
56127
56155
|
function isReadonlyTypeOperator(node) {
|
|
56128
56156
|
return isTypeOperatorNode(node) && node.operator === 148 /* ReadonlyKeyword */;
|
|
56129
56157
|
}
|
|
56130
|
-
function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations) {
|
|
56158
|
+
function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations = []) {
|
|
56131
56159
|
const tupleTarget = getTupleTargetType(elementFlags || map(elementTypes, (_) => 1 /* Required */), readonly, namedMemberDeclarations);
|
|
56132
56160
|
return tupleTarget === emptyGenericType ? emptyObjectType : elementTypes.length ? createNormalizedTypeReference(tupleTarget, elementTypes) : tupleTarget;
|
|
56133
56161
|
}
|
|
@@ -56135,7 +56163,8 @@ function createTypeChecker(host) {
|
|
|
56135
56163
|
if (elementFlags.length === 1 && elementFlags[0] & 4 /* Rest */) {
|
|
56136
56164
|
return readonly ? globalReadonlyArrayType : globalArrayType;
|
|
56137
56165
|
}
|
|
56138
|
-
const
|
|
56166
|
+
const memberIds = mapDefined(namedMemberDeclarations, (node) => node ? getNodeId(node) : void 0);
|
|
56167
|
+
const key = map(elementFlags, (f) => f & 1 /* Required */ ? "#" : f & 2 /* Optional */ ? "?" : f & 4 /* Rest */ ? "." : "*").join() + (readonly ? "R" : "") + (memberIds.length ? "," + memberIds.join(",") : "");
|
|
56139
56168
|
let type = tupleTypes.get(key);
|
|
56140
56169
|
if (!type) {
|
|
56141
56170
|
tupleTypes.set(key, type = createTupleTargetType(elementFlags, readonly, namedMemberDeclarations));
|
|
@@ -56217,7 +56246,7 @@ function createTypeChecker(host) {
|
|
|
56217
56246
|
}
|
|
56218
56247
|
const expandedTypes = [];
|
|
56219
56248
|
const expandedFlags = [];
|
|
56220
|
-
|
|
56249
|
+
const expandedDeclarations = [];
|
|
56221
56250
|
let lastRequiredIndex = -1;
|
|
56222
56251
|
let firstRestIndex = -1;
|
|
56223
56252
|
let lastOptionalOrRestIndex = -1;
|
|
@@ -56255,7 +56284,7 @@ function createTypeChecker(host) {
|
|
|
56255
56284
|
));
|
|
56256
56285
|
expandedTypes.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
56257
56286
|
expandedFlags.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
56258
|
-
expandedDeclarations
|
|
56287
|
+
expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
|
|
56259
56288
|
}
|
|
56260
56289
|
const tupleTarget = getTupleTargetType(expandedFlags, target.readonly, expandedDeclarations);
|
|
56261
56290
|
return tupleTarget === emptyGenericType ? emptyObjectType : expandedFlags.length ? createTypeReference(tupleTarget, expandedTypes) : tupleTarget;
|
|
@@ -56275,11 +56304,7 @@ function createTypeChecker(host) {
|
|
|
56275
56304
|
true
|
|
56276
56305
|
) : type);
|
|
56277
56306
|
expandedFlags.push(flags);
|
|
56278
|
-
|
|
56279
|
-
expandedDeclarations.push(declaration);
|
|
56280
|
-
} else {
|
|
56281
|
-
expandedDeclarations = void 0;
|
|
56282
|
-
}
|
|
56307
|
+
expandedDeclarations.push(declaration);
|
|
56283
56308
|
}
|
|
56284
56309
|
}
|
|
56285
56310
|
function sliceTupleType(type, index, endSkipCount = 0) {
|
|
@@ -65178,10 +65203,11 @@ function createTypeChecker(host) {
|
|
|
65178
65203
|
const assignedType = getWidenedLiteralType(getInitialOrAssignedType(flow));
|
|
65179
65204
|
return isTypeAssignableTo(assignedType, declaredType) ? assignedType : anyArrayType;
|
|
65180
65205
|
}
|
|
65181
|
-
|
|
65182
|
-
|
|
65206
|
+
const t = isInCompoundLikeAssignment(node) ? getBaseTypeOfLiteralType(declaredType) : declaredType;
|
|
65207
|
+
if (t.flags & 1048576 /* Union */) {
|
|
65208
|
+
return getAssignmentReducedType(t, getInitialOrAssignedType(flow));
|
|
65183
65209
|
}
|
|
65184
|
-
return
|
|
65210
|
+
return t;
|
|
65185
65211
|
}
|
|
65186
65212
|
if (containsMatchingReference(reference, node)) {
|
|
65187
65213
|
if (!isReachableFlowNode(flow)) {
|
|
@@ -66310,7 +66336,7 @@ function createTypeChecker(host) {
|
|
|
66310
66336
|
const isAlias = localOrExportSymbol.flags & 2097152 /* Alias */;
|
|
66311
66337
|
if (localOrExportSymbol.flags & 3 /* Variable */) {
|
|
66312
66338
|
if (assignmentKind === 1 /* Definite */) {
|
|
66313
|
-
return type;
|
|
66339
|
+
return isInCompoundLikeAssignment(node) ? getBaseTypeOfLiteralType(type) : type;
|
|
66314
66340
|
}
|
|
66315
66341
|
} else if (isAlias) {
|
|
66316
66342
|
declaration = getDeclarationOfAliasSymbol(symbol);
|
|
@@ -66637,17 +66663,14 @@ function createTypeChecker(host) {
|
|
|
66637
66663
|
}
|
|
66638
66664
|
}
|
|
66639
66665
|
function getTypeForThisExpressionFromJSDoc(node) {
|
|
66640
|
-
const jsdocType = getJSDocType(node);
|
|
66641
|
-
if (jsdocType && jsdocType.kind === 324 /* JSDocFunctionType */) {
|
|
66642
|
-
const jsDocFunctionType = jsdocType;
|
|
66643
|
-
if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && jsDocFunctionType.parameters[0].name.escapedText === "this" /* This */) {
|
|
66644
|
-
return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type);
|
|
66645
|
-
}
|
|
66646
|
-
}
|
|
66647
66666
|
const thisTag = getJSDocThisTag(node);
|
|
66648
66667
|
if (thisTag && thisTag.typeExpression) {
|
|
66649
66668
|
return getTypeFromTypeNode(thisTag.typeExpression);
|
|
66650
66669
|
}
|
|
66670
|
+
const signature = getSignatureOfTypeTag(node);
|
|
66671
|
+
if (signature) {
|
|
66672
|
+
return getThisTypeOfSignature(signature);
|
|
66673
|
+
}
|
|
66651
66674
|
}
|
|
66652
66675
|
function isInConstructorArgumentInitializer(node, constructorDecl) {
|
|
66653
66676
|
return !!findAncestor(node, (n) => isFunctionLikeDeclaration(n) ? "quit" : n.kind === 169 /* Parameter */ && n.parent === constructorDecl);
|
|
@@ -70549,12 +70572,7 @@ function createTypeChecker(host) {
|
|
|
70549
70572
|
}
|
|
70550
70573
|
const candidates = candidatesOutArray || [];
|
|
70551
70574
|
reorderCandidates(signatures, candidates, callChainFlags);
|
|
70552
|
-
|
|
70553
|
-
if (reportErrors2) {
|
|
70554
|
-
diagnostics.add(getDiagnosticForCallNode(node, Diagnostics.Call_target_does_not_contain_any_signatures));
|
|
70555
|
-
}
|
|
70556
|
-
return resolveErrorCall(node);
|
|
70557
|
-
}
|
|
70575
|
+
Debug.assert(candidates.length, "Revert #54442 and add a testcase with whatever triggered this");
|
|
70558
70576
|
const args = getEffectiveCallArguments(node);
|
|
70559
70577
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
70560
70578
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
@@ -72006,7 +72024,10 @@ function createTypeChecker(host) {
|
|
|
72006
72024
|
}
|
|
72007
72025
|
return type;
|
|
72008
72026
|
}
|
|
72009
|
-
function getTupleElementLabel(d) {
|
|
72027
|
+
function getTupleElementLabel(d, index, restParameterName = "arg") {
|
|
72028
|
+
if (!d) {
|
|
72029
|
+
return `${restParameterName}_${index}`;
|
|
72030
|
+
}
|
|
72010
72031
|
Debug.assert(isIdentifier(d.name));
|
|
72011
72032
|
return d.name.escapedText;
|
|
72012
72033
|
}
|
|
@@ -72020,7 +72041,7 @@ function createTypeChecker(host) {
|
|
|
72020
72041
|
if (isTupleType(restType)) {
|
|
72021
72042
|
const associatedNames = restType.target.labeledElementDeclarations;
|
|
72022
72043
|
const index = pos - paramCount;
|
|
72023
|
-
return associatedNames
|
|
72044
|
+
return getTupleElementLabel(associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
|
|
72024
72045
|
}
|
|
72025
72046
|
return restParameter.escapedName;
|
|
72026
72047
|
}
|
|
@@ -75375,12 +75396,7 @@ function createTypeChecker(host) {
|
|
|
75375
75396
|
const elementTypes = node.elements;
|
|
75376
75397
|
let seenOptionalElement = false;
|
|
75377
75398
|
let seenRestElement = false;
|
|
75378
|
-
const hasNamedElement = some(elementTypes, isNamedTupleMember);
|
|
75379
75399
|
for (const e of elementTypes) {
|
|
75380
|
-
if (e.kind !== 202 /* NamedTupleMember */ && hasNamedElement) {
|
|
75381
|
-
grammarErrorOnNode(e, Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names);
|
|
75382
|
-
break;
|
|
75383
|
-
}
|
|
75384
75400
|
const flags = getTupleElementFlags(e);
|
|
75385
75401
|
if (flags & 8 /* Variadic */) {
|
|
75386
75402
|
const type = getTypeFromTypeNode(e.type);
|