@typescript-deploys/pr-build 5.4.0-pr-54183-19 → 5.4.0-pr-57008-39
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 +23 -39
- package/lib/tsserver.js +24 -41
- package/lib/typescript.js +24 -41
- package/lib/typingsInstaller.js +1 -1
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -9110,7 +9110,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9110
9110
|
}
|
|
9111
9111
|
const ch = codePointAt(text, pos);
|
|
9112
9112
|
if (pos === 0) {
|
|
9113
|
-
if (
|
|
9113
|
+
if (text.slice(0, 256).includes("\uFFFD")) {
|
|
9114
9114
|
error(Diagnostics.File_appears_to_be_binary);
|
|
9115
9115
|
pos = end;
|
|
9116
9116
|
return token = 8 /* NonTextFileMarkerTrivia */;
|
|
@@ -43851,7 +43851,7 @@ function createTypeChecker(host) {
|
|
|
43851
43851
|
void 0
|
|
43852
43852
|
);
|
|
43853
43853
|
},
|
|
43854
|
-
|
|
43854
|
+
isContextSensitive,
|
|
43855
43855
|
getTypeOfPropertyOfContextualType,
|
|
43856
43856
|
getFullyQualifiedName,
|
|
43857
43857
|
getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
|
|
@@ -48154,7 +48154,7 @@ function createTypeChecker(host) {
|
|
|
48154
48154
|
);
|
|
48155
48155
|
}
|
|
48156
48156
|
function symbolValueDeclarationIsContextSensitive(symbol) {
|
|
48157
|
-
return symbol && !!symbol.valueDeclaration && isExpression(symbol.valueDeclaration) && !
|
|
48157
|
+
return symbol && !!symbol.valueDeclaration && isExpression(symbol.valueDeclaration) && !isContextSensitive(symbol.valueDeclaration);
|
|
48158
48158
|
}
|
|
48159
48159
|
function toNodeBuilderFlags(flags = 0 /* None */) {
|
|
48160
48160
|
return flags & 848330095 /* NodeBuilderFlagsMask */;
|
|
@@ -54769,14 +54769,6 @@ function createTypeChecker(host) {
|
|
|
54769
54769
|
return getCheckFlags(s) & 4096 /* Late */;
|
|
54770
54770
|
}
|
|
54771
54771
|
function forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(type, include, stringsOnly, cb) {
|
|
54772
|
-
if (isTupleType(type)) {
|
|
54773
|
-
forEachType(getUnionType(getElementTypes(type).map((_, i) => getStringLiteralType("" + i))), cb);
|
|
54774
|
-
return;
|
|
54775
|
-
}
|
|
54776
|
-
if (isArrayType(type)) {
|
|
54777
|
-
cb(numberType);
|
|
54778
|
-
return;
|
|
54779
|
-
}
|
|
54780
54772
|
for (const prop of getPropertiesOfType(type)) {
|
|
54781
54773
|
cb(getLiteralTypeFromProperty(prop, include));
|
|
54782
54774
|
}
|
|
@@ -56673,7 +56665,7 @@ function createTypeChecker(host) {
|
|
|
56673
56665
|
if (constraint) {
|
|
56674
56666
|
constraints = append(constraints, constraint);
|
|
56675
56667
|
}
|
|
56676
|
-
} else if (type.flags & 262144 /* TypeParameter */ && parent.kind === 200 /* MappedType */ &&
|
|
56668
|
+
} else if (type.flags & 262144 /* TypeParameter */ && parent.kind === 200 /* MappedType */ && node === parent.type) {
|
|
56677
56669
|
const mappedType = getTypeFromTypeNode(parent);
|
|
56678
56670
|
if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) {
|
|
56679
56671
|
const typeParameter = getHomomorphicTypeVariable(mappedType);
|
|
@@ -59974,47 +59966,39 @@ function createTypeChecker(host) {
|
|
|
59974
59966
|
function instantiateIndexInfo(info, mapper) {
|
|
59975
59967
|
return createIndexInfo(info.keyType, instantiateType(info.type, mapper), info.isReadonly, info.declaration);
|
|
59976
59968
|
}
|
|
59977
|
-
function
|
|
59969
|
+
function isContextSensitive(node) {
|
|
59978
59970
|
Debug.assert(node.kind !== 174 /* MethodDeclaration */ || isObjectLiteralMethod(node));
|
|
59979
59971
|
switch (node.kind) {
|
|
59980
59972
|
case 218 /* FunctionExpression */:
|
|
59981
59973
|
case 219 /* ArrowFunction */:
|
|
59982
59974
|
case 174 /* MethodDeclaration */:
|
|
59983
59975
|
case 262 /* FunctionDeclaration */:
|
|
59984
|
-
|
|
59985
|
-
case 214 /* NewExpression */:
|
|
59986
|
-
return predicate(node);
|
|
59976
|
+
return isContextSensitiveFunctionLikeDeclaration(node);
|
|
59987
59977
|
case 210 /* ObjectLiteralExpression */:
|
|
59988
|
-
return some(node.properties,
|
|
59978
|
+
return some(node.properties, isContextSensitive);
|
|
59989
59979
|
case 209 /* ArrayLiteralExpression */:
|
|
59990
|
-
return some(node.elements,
|
|
59980
|
+
return some(node.elements, isContextSensitive);
|
|
59991
59981
|
case 227 /* ConditionalExpression */:
|
|
59992
|
-
return
|
|
59982
|
+
return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse);
|
|
59993
59983
|
case 226 /* BinaryExpression */:
|
|
59994
|
-
return (node.operatorToken.kind === 57 /* BarBarToken */ || node.operatorToken.kind === 61 /* QuestionQuestionToken */) && (
|
|
59984
|
+
return (node.operatorToken.kind === 57 /* BarBarToken */ || node.operatorToken.kind === 61 /* QuestionQuestionToken */) && (isContextSensitive(node.left) || isContextSensitive(node.right));
|
|
59995
59985
|
case 303 /* PropertyAssignment */:
|
|
59996
|
-
return
|
|
59986
|
+
return isContextSensitive(node.initializer);
|
|
59997
59987
|
case 217 /* ParenthesizedExpression */:
|
|
59998
|
-
return
|
|
59988
|
+
return isContextSensitive(node.expression);
|
|
59999
59989
|
case 292 /* JsxAttributes */:
|
|
60000
|
-
return some(node.properties,
|
|
59990
|
+
return some(node.properties, isContextSensitive) || isJsxOpeningElement(node.parent) && some(node.parent.parent.children, isContextSensitive);
|
|
60001
59991
|
case 291 /* JsxAttribute */: {
|
|
60002
59992
|
const { initializer } = node;
|
|
60003
|
-
return !!initializer &&
|
|
59993
|
+
return !!initializer && isContextSensitive(initializer);
|
|
60004
59994
|
}
|
|
60005
59995
|
case 294 /* JsxExpression */: {
|
|
60006
59996
|
const { expression } = node;
|
|
60007
|
-
return !!expression &&
|
|
59997
|
+
return !!expression && isContextSensitive(expression);
|
|
60008
59998
|
}
|
|
60009
59999
|
}
|
|
60010
60000
|
return false;
|
|
60011
60001
|
}
|
|
60012
|
-
function containsContextSensitive(node) {
|
|
60013
|
-
return containsContextRelatedNode(node, isContextSensitiveFunctionOrObjectLiteralMethod);
|
|
60014
|
-
}
|
|
60015
|
-
function containsContextSensitiveOrCallOrNewExpression(node) {
|
|
60016
|
-
return containsContextRelatedNode(node, (n) => isContextSensitiveFunctionOrObjectLiteralMethod(n) || isCallOrNewExpression(n));
|
|
60017
|
-
}
|
|
60018
60002
|
function isContextSensitiveFunctionLikeDeclaration(node) {
|
|
60019
60003
|
return hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node);
|
|
60020
60004
|
}
|
|
@@ -60023,9 +60007,9 @@ function createTypeChecker(host) {
|
|
|
60023
60007
|
return false;
|
|
60024
60008
|
}
|
|
60025
60009
|
if (node.body.kind !== 241 /* Block */) {
|
|
60026
|
-
return
|
|
60010
|
+
return isContextSensitive(node.body);
|
|
60027
60011
|
}
|
|
60028
|
-
return !!forEachReturnStatement(node.body, (statement) => !!statement.expression &&
|
|
60012
|
+
return !!forEachReturnStatement(node.body, (statement) => !!statement.expression && isContextSensitive(statement.expression));
|
|
60029
60013
|
}
|
|
60030
60014
|
function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
|
|
60031
60015
|
return (isFunctionExpressionOrArrowFunction(func) || isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func);
|
|
@@ -69506,7 +69490,7 @@ function createTypeChecker(host) {
|
|
|
69506
69490
|
hasOmittedExpression
|
|
69507
69491
|
));
|
|
69508
69492
|
elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
|
|
69509
|
-
if (inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) &&
|
|
69493
|
+
if (inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(e)) {
|
|
69510
69494
|
const inferenceContext = getInferenceContext(node);
|
|
69511
69495
|
Debug.assert(inferenceContext);
|
|
69512
69496
|
addIntraExpressionInferenceSite(inferenceContext, e, type);
|
|
@@ -69693,7 +69677,7 @@ function createTypeChecker(host) {
|
|
|
69693
69677
|
prop.links.target = member;
|
|
69694
69678
|
member = prop;
|
|
69695
69679
|
allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
|
|
69696
|
-
if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 303 /* PropertyAssignment */ || memberDecl.kind === 174 /* MethodDeclaration */) &&
|
|
69680
|
+
if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 303 /* PropertyAssignment */ || memberDecl.kind === 174 /* MethodDeclaration */) && isContextSensitive(memberDecl)) {
|
|
69697
69681
|
const inferenceContext = getInferenceContext(node);
|
|
69698
69682
|
Debug.assert(inferenceContext);
|
|
69699
69683
|
const inferenceNode = memberDecl.kind === 303 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
|
|
@@ -69881,7 +69865,7 @@ function createTypeChecker(host) {
|
|
|
69881
69865
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
69882
69866
|
}
|
|
69883
69867
|
}
|
|
69884
|
-
if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) &&
|
|
69868
|
+
if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
|
|
69885
69869
|
const inferenceContext = getInferenceContext(attributes);
|
|
69886
69870
|
Debug.assert(inferenceContext);
|
|
69887
69871
|
const inferenceNode = attributeDecl.initializer.expression;
|
|
@@ -72117,7 +72101,7 @@ function createTypeChecker(host) {
|
|
|
72117
72101
|
Debug.assert(candidates.length, "Revert #54442 and add a testcase with whatever triggered this");
|
|
72118
72102
|
const args = getEffectiveCallArguments(node);
|
|
72119
72103
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
72120
|
-
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args,
|
|
72104
|
+
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
72121
72105
|
let candidatesForArgumentError;
|
|
72122
72106
|
let candidateForArgumentArityError;
|
|
72123
72107
|
let candidateForTypeArgumentError;
|
|
@@ -74496,7 +74480,7 @@ function createTypeChecker(host) {
|
|
|
74496
74480
|
if (isFunctionExpression(node)) {
|
|
74497
74481
|
checkCollisionsForDeclarationName(node, node.name);
|
|
74498
74482
|
}
|
|
74499
|
-
if (checkMode && checkMode & 4 /* SkipContextSensitive */ &&
|
|
74483
|
+
if (checkMode && checkMode & 4 /* SkipContextSensitive */ && isContextSensitive(node)) {
|
|
74500
74484
|
if (!getEffectiveReturnTypeNode(node) && !hasContextSensitiveParameters(node)) {
|
|
74501
74485
|
const contextualSignature = getContextualSignature(node);
|
|
74502
74486
|
if (contextualSignature && couldContainTypeVariables(getReturnTypeOfSignature(contextualSignature))) {
|
|
@@ -74543,7 +74527,7 @@ function createTypeChecker(host) {
|
|
|
74543
74527
|
if (!signature) {
|
|
74544
74528
|
return;
|
|
74545
74529
|
}
|
|
74546
|
-
if (
|
|
74530
|
+
if (isContextSensitive(node)) {
|
|
74547
74531
|
if (contextualSignature) {
|
|
74548
74532
|
const inferenceContext = getInferenceContext(node);
|
|
74549
74533
|
let instantiatedContextualSignature;
|
package/lib/tsserver.js
CHANGED
|
@@ -7021,7 +7021,6 @@ var CharacterCodes = /* @__PURE__ */ ((CharacterCodes2) => {
|
|
|
7021
7021
|
CharacterCodes2[CharacterCodes2["ideographicSpace"] = 12288] = "ideographicSpace";
|
|
7022
7022
|
CharacterCodes2[CharacterCodes2["mathematicalSpace"] = 8287] = "mathematicalSpace";
|
|
7023
7023
|
CharacterCodes2[CharacterCodes2["ogham"] = 5760] = "ogham";
|
|
7024
|
-
CharacterCodes2[CharacterCodes2["replacementCharacter"] = 65533] = "replacementCharacter";
|
|
7025
7024
|
CharacterCodes2[CharacterCodes2["_"] = 95] = "_";
|
|
7026
7025
|
CharacterCodes2[CharacterCodes2["$"] = 36] = "$";
|
|
7027
7026
|
CharacterCodes2[CharacterCodes2["_0"] = 48] = "_0";
|
|
@@ -12700,7 +12699,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12700
12699
|
}
|
|
12701
12700
|
const ch = codePointAt(text, pos);
|
|
12702
12701
|
if (pos === 0) {
|
|
12703
|
-
if (
|
|
12702
|
+
if (text.slice(0, 256).includes("\uFFFD")) {
|
|
12704
12703
|
error2(Diagnostics.File_appears_to_be_binary);
|
|
12705
12704
|
pos = end;
|
|
12706
12705
|
return token = 8 /* NonTextFileMarkerTrivia */;
|
|
@@ -48591,7 +48590,7 @@ function createTypeChecker(host) {
|
|
|
48591
48590
|
void 0
|
|
48592
48591
|
);
|
|
48593
48592
|
},
|
|
48594
|
-
|
|
48593
|
+
isContextSensitive,
|
|
48595
48594
|
getTypeOfPropertyOfContextualType,
|
|
48596
48595
|
getFullyQualifiedName,
|
|
48597
48596
|
getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
|
|
@@ -52894,7 +52893,7 @@ function createTypeChecker(host) {
|
|
|
52894
52893
|
);
|
|
52895
52894
|
}
|
|
52896
52895
|
function symbolValueDeclarationIsContextSensitive(symbol) {
|
|
52897
|
-
return symbol && !!symbol.valueDeclaration && isExpression(symbol.valueDeclaration) && !
|
|
52896
|
+
return symbol && !!symbol.valueDeclaration && isExpression(symbol.valueDeclaration) && !isContextSensitive(symbol.valueDeclaration);
|
|
52898
52897
|
}
|
|
52899
52898
|
function toNodeBuilderFlags(flags = 0 /* None */) {
|
|
52900
52899
|
return flags & 848330095 /* NodeBuilderFlagsMask */;
|
|
@@ -59509,14 +59508,6 @@ function createTypeChecker(host) {
|
|
|
59509
59508
|
return getCheckFlags(s) & 4096 /* Late */;
|
|
59510
59509
|
}
|
|
59511
59510
|
function forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(type, include, stringsOnly, cb) {
|
|
59512
|
-
if (isTupleType(type)) {
|
|
59513
|
-
forEachType(getUnionType(getElementTypes(type).map((_, i) => getStringLiteralType("" + i))), cb);
|
|
59514
|
-
return;
|
|
59515
|
-
}
|
|
59516
|
-
if (isArrayType(type)) {
|
|
59517
|
-
cb(numberType);
|
|
59518
|
-
return;
|
|
59519
|
-
}
|
|
59520
59511
|
for (const prop of getPropertiesOfType(type)) {
|
|
59521
59512
|
cb(getLiteralTypeFromProperty(prop, include));
|
|
59522
59513
|
}
|
|
@@ -61413,7 +61404,7 @@ function createTypeChecker(host) {
|
|
|
61413
61404
|
if (constraint) {
|
|
61414
61405
|
constraints = append(constraints, constraint);
|
|
61415
61406
|
}
|
|
61416
|
-
} else if (type.flags & 262144 /* TypeParameter */ && parent2.kind === 200 /* MappedType */ &&
|
|
61407
|
+
} else if (type.flags & 262144 /* TypeParameter */ && parent2.kind === 200 /* MappedType */ && node === parent2.type) {
|
|
61417
61408
|
const mappedType = getTypeFromTypeNode(parent2);
|
|
61418
61409
|
if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) {
|
|
61419
61410
|
const typeParameter = getHomomorphicTypeVariable(mappedType);
|
|
@@ -64714,47 +64705,39 @@ function createTypeChecker(host) {
|
|
|
64714
64705
|
function instantiateIndexInfo(info, mapper) {
|
|
64715
64706
|
return createIndexInfo(info.keyType, instantiateType(info.type, mapper), info.isReadonly, info.declaration);
|
|
64716
64707
|
}
|
|
64717
|
-
function
|
|
64708
|
+
function isContextSensitive(node) {
|
|
64718
64709
|
Debug.assert(node.kind !== 174 /* MethodDeclaration */ || isObjectLiteralMethod(node));
|
|
64719
64710
|
switch (node.kind) {
|
|
64720
64711
|
case 218 /* FunctionExpression */:
|
|
64721
64712
|
case 219 /* ArrowFunction */:
|
|
64722
64713
|
case 174 /* MethodDeclaration */:
|
|
64723
64714
|
case 262 /* FunctionDeclaration */:
|
|
64724
|
-
|
|
64725
|
-
case 214 /* NewExpression */:
|
|
64726
|
-
return predicate(node);
|
|
64715
|
+
return isContextSensitiveFunctionLikeDeclaration(node);
|
|
64727
64716
|
case 210 /* ObjectLiteralExpression */:
|
|
64728
|
-
return some(node.properties,
|
|
64717
|
+
return some(node.properties, isContextSensitive);
|
|
64729
64718
|
case 209 /* ArrayLiteralExpression */:
|
|
64730
|
-
return some(node.elements,
|
|
64719
|
+
return some(node.elements, isContextSensitive);
|
|
64731
64720
|
case 227 /* ConditionalExpression */:
|
|
64732
|
-
return
|
|
64721
|
+
return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse);
|
|
64733
64722
|
case 226 /* BinaryExpression */:
|
|
64734
|
-
return (node.operatorToken.kind === 57 /* BarBarToken */ || node.operatorToken.kind === 61 /* QuestionQuestionToken */) && (
|
|
64723
|
+
return (node.operatorToken.kind === 57 /* BarBarToken */ || node.operatorToken.kind === 61 /* QuestionQuestionToken */) && (isContextSensitive(node.left) || isContextSensitive(node.right));
|
|
64735
64724
|
case 303 /* PropertyAssignment */:
|
|
64736
|
-
return
|
|
64725
|
+
return isContextSensitive(node.initializer);
|
|
64737
64726
|
case 217 /* ParenthesizedExpression */:
|
|
64738
|
-
return
|
|
64727
|
+
return isContextSensitive(node.expression);
|
|
64739
64728
|
case 292 /* JsxAttributes */:
|
|
64740
|
-
return some(node.properties,
|
|
64729
|
+
return some(node.properties, isContextSensitive) || isJsxOpeningElement(node.parent) && some(node.parent.parent.children, isContextSensitive);
|
|
64741
64730
|
case 291 /* JsxAttribute */: {
|
|
64742
64731
|
const { initializer } = node;
|
|
64743
|
-
return !!initializer &&
|
|
64732
|
+
return !!initializer && isContextSensitive(initializer);
|
|
64744
64733
|
}
|
|
64745
64734
|
case 294 /* JsxExpression */: {
|
|
64746
64735
|
const { expression } = node;
|
|
64747
|
-
return !!expression &&
|
|
64736
|
+
return !!expression && isContextSensitive(expression);
|
|
64748
64737
|
}
|
|
64749
64738
|
}
|
|
64750
64739
|
return false;
|
|
64751
64740
|
}
|
|
64752
|
-
function containsContextSensitive(node) {
|
|
64753
|
-
return containsContextRelatedNode(node, isContextSensitiveFunctionOrObjectLiteralMethod);
|
|
64754
|
-
}
|
|
64755
|
-
function containsContextSensitiveOrCallOrNewExpression(node) {
|
|
64756
|
-
return containsContextRelatedNode(node, (n) => isContextSensitiveFunctionOrObjectLiteralMethod(n) || isCallOrNewExpression(n));
|
|
64757
|
-
}
|
|
64758
64741
|
function isContextSensitiveFunctionLikeDeclaration(node) {
|
|
64759
64742
|
return hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node);
|
|
64760
64743
|
}
|
|
@@ -64763,9 +64746,9 @@ function createTypeChecker(host) {
|
|
|
64763
64746
|
return false;
|
|
64764
64747
|
}
|
|
64765
64748
|
if (node.body.kind !== 241 /* Block */) {
|
|
64766
|
-
return
|
|
64749
|
+
return isContextSensitive(node.body);
|
|
64767
64750
|
}
|
|
64768
|
-
return !!forEachReturnStatement(node.body, (statement) => !!statement.expression &&
|
|
64751
|
+
return !!forEachReturnStatement(node.body, (statement) => !!statement.expression && isContextSensitive(statement.expression));
|
|
64769
64752
|
}
|
|
64770
64753
|
function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
|
|
64771
64754
|
return (isFunctionExpressionOrArrowFunction(func) || isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func);
|
|
@@ -74246,7 +74229,7 @@ function createTypeChecker(host) {
|
|
|
74246
74229
|
hasOmittedExpression
|
|
74247
74230
|
));
|
|
74248
74231
|
elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
|
|
74249
|
-
if (inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) &&
|
|
74232
|
+
if (inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(e)) {
|
|
74250
74233
|
const inferenceContext = getInferenceContext(node);
|
|
74251
74234
|
Debug.assert(inferenceContext);
|
|
74252
74235
|
addIntraExpressionInferenceSite(inferenceContext, e, type);
|
|
@@ -74433,7 +74416,7 @@ function createTypeChecker(host) {
|
|
|
74433
74416
|
prop.links.target = member;
|
|
74434
74417
|
member = prop;
|
|
74435
74418
|
allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
|
|
74436
|
-
if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 303 /* PropertyAssignment */ || memberDecl.kind === 174 /* MethodDeclaration */) &&
|
|
74419
|
+
if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 303 /* PropertyAssignment */ || memberDecl.kind === 174 /* MethodDeclaration */) && isContextSensitive(memberDecl)) {
|
|
74437
74420
|
const inferenceContext = getInferenceContext(node);
|
|
74438
74421
|
Debug.assert(inferenceContext);
|
|
74439
74422
|
const inferenceNode = memberDecl.kind === 303 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
|
|
@@ -74621,7 +74604,7 @@ function createTypeChecker(host) {
|
|
|
74621
74604
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
74622
74605
|
}
|
|
74623
74606
|
}
|
|
74624
|
-
if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) &&
|
|
74607
|
+
if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
|
|
74625
74608
|
const inferenceContext = getInferenceContext(attributes);
|
|
74626
74609
|
Debug.assert(inferenceContext);
|
|
74627
74610
|
const inferenceNode = attributeDecl.initializer.expression;
|
|
@@ -76857,7 +76840,7 @@ function createTypeChecker(host) {
|
|
|
76857
76840
|
Debug.assert(candidates.length, "Revert #54442 and add a testcase with whatever triggered this");
|
|
76858
76841
|
const args = getEffectiveCallArguments(node);
|
|
76859
76842
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
76860
|
-
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args,
|
|
76843
|
+
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
76861
76844
|
let candidatesForArgumentError;
|
|
76862
76845
|
let candidateForArgumentArityError;
|
|
76863
76846
|
let candidateForTypeArgumentError;
|
|
@@ -79236,7 +79219,7 @@ function createTypeChecker(host) {
|
|
|
79236
79219
|
if (isFunctionExpression(node)) {
|
|
79237
79220
|
checkCollisionsForDeclarationName(node, node.name);
|
|
79238
79221
|
}
|
|
79239
|
-
if (checkMode && checkMode & 4 /* SkipContextSensitive */ &&
|
|
79222
|
+
if (checkMode && checkMode & 4 /* SkipContextSensitive */ && isContextSensitive(node)) {
|
|
79240
79223
|
if (!getEffectiveReturnTypeNode(node) && !hasContextSensitiveParameters(node)) {
|
|
79241
79224
|
const contextualSignature = getContextualSignature(node);
|
|
79242
79225
|
if (contextualSignature && couldContainTypeVariables(getReturnTypeOfSignature(contextualSignature))) {
|
|
@@ -79283,7 +79266,7 @@ function createTypeChecker(host) {
|
|
|
79283
79266
|
if (!signature) {
|
|
79284
79267
|
return;
|
|
79285
79268
|
}
|
|
79286
|
-
if (
|
|
79269
|
+
if (isContextSensitive(node)) {
|
|
79287
79270
|
if (contextualSignature) {
|
|
79288
79271
|
const inferenceContext = getInferenceContext(node);
|
|
79289
79272
|
let instantiatedContextualSignature;
|
|
@@ -144188,7 +144171,7 @@ function extractConstantInScope(node, scope, { substitutions }, rangeFacts, cont
|
|
|
144188
144171
|
false
|
|
144189
144172
|
) && !isPrivateIdentifier(node.name) && !identifierToKeywordKind(node.name) ? node.name.text : getUniqueName(isClassLike(scope) ? "newProperty" : "newLocal", file);
|
|
144190
144173
|
const isJS = isInJSFile(scope);
|
|
144191
|
-
let variableType = isJS || !checker.
|
|
144174
|
+
let variableType = isJS || !checker.isContextSensitive(node) ? void 0 : checker.typeToTypeNode(checker.getContextualType(node), scope, 1 /* NoTruncation */);
|
|
144192
144175
|
let initializer = transformConstantInitializer(skipParentheses(node), substitutions);
|
|
144193
144176
|
({ variableType, initializer } = transformFunctionInitializerAndType(variableType, initializer));
|
|
144194
144177
|
suppressLeadingAndTrailingTrivia(initializer);
|
package/lib/typescript.js
CHANGED
|
@@ -4769,7 +4769,6 @@ ${lanes.join("\n")}
|
|
|
4769
4769
|
CharacterCodes2[CharacterCodes2["ideographicSpace"] = 12288] = "ideographicSpace";
|
|
4770
4770
|
CharacterCodes2[CharacterCodes2["mathematicalSpace"] = 8287] = "mathematicalSpace";
|
|
4771
4771
|
CharacterCodes2[CharacterCodes2["ogham"] = 5760] = "ogham";
|
|
4772
|
-
CharacterCodes2[CharacterCodes2["replacementCharacter"] = 65533] = "replacementCharacter";
|
|
4773
4772
|
CharacterCodes2[CharacterCodes2["_"] = 95] = "_";
|
|
4774
4773
|
CharacterCodes2[CharacterCodes2["$"] = 36] = "$";
|
|
4775
4774
|
CharacterCodes2[CharacterCodes2["_0"] = 48] = "_0";
|
|
@@ -10309,7 +10308,7 @@ ${lanes.join("\n")}
|
|
|
10309
10308
|
}
|
|
10310
10309
|
const ch = codePointAt(text, pos);
|
|
10311
10310
|
if (pos === 0) {
|
|
10312
|
-
if (
|
|
10311
|
+
if (text.slice(0, 256).includes("\uFFFD")) {
|
|
10313
10312
|
error2(Diagnostics.File_appears_to_be_binary);
|
|
10314
10313
|
pos = end;
|
|
10315
10314
|
return token = 8 /* NonTextFileMarkerTrivia */;
|
|
@@ -46344,7 +46343,7 @@ ${lanes.join("\n")}
|
|
|
46344
46343
|
void 0
|
|
46345
46344
|
);
|
|
46346
46345
|
},
|
|
46347
|
-
|
|
46346
|
+
isContextSensitive,
|
|
46348
46347
|
getTypeOfPropertyOfContextualType,
|
|
46349
46348
|
getFullyQualifiedName,
|
|
46350
46349
|
getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
|
|
@@ -50647,7 +50646,7 @@ ${lanes.join("\n")}
|
|
|
50647
50646
|
);
|
|
50648
50647
|
}
|
|
50649
50648
|
function symbolValueDeclarationIsContextSensitive(symbol) {
|
|
50650
|
-
return symbol && !!symbol.valueDeclaration && isExpression(symbol.valueDeclaration) && !
|
|
50649
|
+
return symbol && !!symbol.valueDeclaration && isExpression(symbol.valueDeclaration) && !isContextSensitive(symbol.valueDeclaration);
|
|
50651
50650
|
}
|
|
50652
50651
|
function toNodeBuilderFlags(flags = 0 /* None */) {
|
|
50653
50652
|
return flags & 848330095 /* NodeBuilderFlagsMask */;
|
|
@@ -57262,14 +57261,6 @@ ${lanes.join("\n")}
|
|
|
57262
57261
|
return getCheckFlags(s) & 4096 /* Late */;
|
|
57263
57262
|
}
|
|
57264
57263
|
function forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(type, include, stringsOnly, cb) {
|
|
57265
|
-
if (isTupleType(type)) {
|
|
57266
|
-
forEachType(getUnionType(getElementTypes(type).map((_, i) => getStringLiteralType("" + i))), cb);
|
|
57267
|
-
return;
|
|
57268
|
-
}
|
|
57269
|
-
if (isArrayType(type)) {
|
|
57270
|
-
cb(numberType);
|
|
57271
|
-
return;
|
|
57272
|
-
}
|
|
57273
57264
|
for (const prop of getPropertiesOfType(type)) {
|
|
57274
57265
|
cb(getLiteralTypeFromProperty(prop, include));
|
|
57275
57266
|
}
|
|
@@ -59166,7 +59157,7 @@ ${lanes.join("\n")}
|
|
|
59166
59157
|
if (constraint) {
|
|
59167
59158
|
constraints = append(constraints, constraint);
|
|
59168
59159
|
}
|
|
59169
|
-
} else if (type.flags & 262144 /* TypeParameter */ && parent2.kind === 200 /* MappedType */ &&
|
|
59160
|
+
} else if (type.flags & 262144 /* TypeParameter */ && parent2.kind === 200 /* MappedType */ && node === parent2.type) {
|
|
59170
59161
|
const mappedType = getTypeFromTypeNode(parent2);
|
|
59171
59162
|
if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) {
|
|
59172
59163
|
const typeParameter = getHomomorphicTypeVariable(mappedType);
|
|
@@ -62467,47 +62458,39 @@ ${lanes.join("\n")}
|
|
|
62467
62458
|
function instantiateIndexInfo(info, mapper) {
|
|
62468
62459
|
return createIndexInfo(info.keyType, instantiateType(info.type, mapper), info.isReadonly, info.declaration);
|
|
62469
62460
|
}
|
|
62470
|
-
function
|
|
62461
|
+
function isContextSensitive(node) {
|
|
62471
62462
|
Debug.assert(node.kind !== 174 /* MethodDeclaration */ || isObjectLiteralMethod(node));
|
|
62472
62463
|
switch (node.kind) {
|
|
62473
62464
|
case 218 /* FunctionExpression */:
|
|
62474
62465
|
case 219 /* ArrowFunction */:
|
|
62475
62466
|
case 174 /* MethodDeclaration */:
|
|
62476
62467
|
case 262 /* FunctionDeclaration */:
|
|
62477
|
-
|
|
62478
|
-
case 214 /* NewExpression */:
|
|
62479
|
-
return predicate(node);
|
|
62468
|
+
return isContextSensitiveFunctionLikeDeclaration(node);
|
|
62480
62469
|
case 210 /* ObjectLiteralExpression */:
|
|
62481
|
-
return some(node.properties,
|
|
62470
|
+
return some(node.properties, isContextSensitive);
|
|
62482
62471
|
case 209 /* ArrayLiteralExpression */:
|
|
62483
|
-
return some(node.elements,
|
|
62472
|
+
return some(node.elements, isContextSensitive);
|
|
62484
62473
|
case 227 /* ConditionalExpression */:
|
|
62485
|
-
return
|
|
62474
|
+
return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse);
|
|
62486
62475
|
case 226 /* BinaryExpression */:
|
|
62487
|
-
return (node.operatorToken.kind === 57 /* BarBarToken */ || node.operatorToken.kind === 61 /* QuestionQuestionToken */) && (
|
|
62476
|
+
return (node.operatorToken.kind === 57 /* BarBarToken */ || node.operatorToken.kind === 61 /* QuestionQuestionToken */) && (isContextSensitive(node.left) || isContextSensitive(node.right));
|
|
62488
62477
|
case 303 /* PropertyAssignment */:
|
|
62489
|
-
return
|
|
62478
|
+
return isContextSensitive(node.initializer);
|
|
62490
62479
|
case 217 /* ParenthesizedExpression */:
|
|
62491
|
-
return
|
|
62480
|
+
return isContextSensitive(node.expression);
|
|
62492
62481
|
case 292 /* JsxAttributes */:
|
|
62493
|
-
return some(node.properties,
|
|
62482
|
+
return some(node.properties, isContextSensitive) || isJsxOpeningElement(node.parent) && some(node.parent.parent.children, isContextSensitive);
|
|
62494
62483
|
case 291 /* JsxAttribute */: {
|
|
62495
62484
|
const { initializer } = node;
|
|
62496
|
-
return !!initializer &&
|
|
62485
|
+
return !!initializer && isContextSensitive(initializer);
|
|
62497
62486
|
}
|
|
62498
62487
|
case 294 /* JsxExpression */: {
|
|
62499
62488
|
const { expression } = node;
|
|
62500
|
-
return !!expression &&
|
|
62489
|
+
return !!expression && isContextSensitive(expression);
|
|
62501
62490
|
}
|
|
62502
62491
|
}
|
|
62503
62492
|
return false;
|
|
62504
62493
|
}
|
|
62505
|
-
function containsContextSensitive(node) {
|
|
62506
|
-
return containsContextRelatedNode(node, isContextSensitiveFunctionOrObjectLiteralMethod);
|
|
62507
|
-
}
|
|
62508
|
-
function containsContextSensitiveOrCallOrNewExpression(node) {
|
|
62509
|
-
return containsContextRelatedNode(node, (n) => isContextSensitiveFunctionOrObjectLiteralMethod(n) || isCallOrNewExpression(n));
|
|
62510
|
-
}
|
|
62511
62494
|
function isContextSensitiveFunctionLikeDeclaration(node) {
|
|
62512
62495
|
return hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node);
|
|
62513
62496
|
}
|
|
@@ -62516,9 +62499,9 @@ ${lanes.join("\n")}
|
|
|
62516
62499
|
return false;
|
|
62517
62500
|
}
|
|
62518
62501
|
if (node.body.kind !== 241 /* Block */) {
|
|
62519
|
-
return
|
|
62502
|
+
return isContextSensitive(node.body);
|
|
62520
62503
|
}
|
|
62521
|
-
return !!forEachReturnStatement(node.body, (statement) => !!statement.expression &&
|
|
62504
|
+
return !!forEachReturnStatement(node.body, (statement) => !!statement.expression && isContextSensitive(statement.expression));
|
|
62522
62505
|
}
|
|
62523
62506
|
function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
|
|
62524
62507
|
return (isFunctionExpressionOrArrowFunction(func) || isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func);
|
|
@@ -71999,7 +71982,7 @@ ${lanes.join("\n")}
|
|
|
71999
71982
|
hasOmittedExpression
|
|
72000
71983
|
));
|
|
72001
71984
|
elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
|
|
72002
|
-
if (inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) &&
|
|
71985
|
+
if (inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(e)) {
|
|
72003
71986
|
const inferenceContext = getInferenceContext(node);
|
|
72004
71987
|
Debug.assert(inferenceContext);
|
|
72005
71988
|
addIntraExpressionInferenceSite(inferenceContext, e, type);
|
|
@@ -72186,7 +72169,7 @@ ${lanes.join("\n")}
|
|
|
72186
72169
|
prop.links.target = member;
|
|
72187
72170
|
member = prop;
|
|
72188
72171
|
allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
|
|
72189
|
-
if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 303 /* PropertyAssignment */ || memberDecl.kind === 174 /* MethodDeclaration */) &&
|
|
72172
|
+
if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 303 /* PropertyAssignment */ || memberDecl.kind === 174 /* MethodDeclaration */) && isContextSensitive(memberDecl)) {
|
|
72190
72173
|
const inferenceContext = getInferenceContext(node);
|
|
72191
72174
|
Debug.assert(inferenceContext);
|
|
72192
72175
|
const inferenceNode = memberDecl.kind === 303 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
|
|
@@ -72374,7 +72357,7 @@ ${lanes.join("\n")}
|
|
|
72374
72357
|
addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
|
|
72375
72358
|
}
|
|
72376
72359
|
}
|
|
72377
|
-
if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) &&
|
|
72360
|
+
if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
|
|
72378
72361
|
const inferenceContext = getInferenceContext(attributes);
|
|
72379
72362
|
Debug.assert(inferenceContext);
|
|
72380
72363
|
const inferenceNode = attributeDecl.initializer.expression;
|
|
@@ -74610,7 +74593,7 @@ ${lanes.join("\n")}
|
|
|
74610
74593
|
Debug.assert(candidates.length, "Revert #54442 and add a testcase with whatever triggered this");
|
|
74611
74594
|
const args = getEffectiveCallArguments(node);
|
|
74612
74595
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
74613
|
-
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args,
|
|
74596
|
+
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
74614
74597
|
let candidatesForArgumentError;
|
|
74615
74598
|
let candidateForArgumentArityError;
|
|
74616
74599
|
let candidateForTypeArgumentError;
|
|
@@ -76989,7 +76972,7 @@ ${lanes.join("\n")}
|
|
|
76989
76972
|
if (isFunctionExpression(node)) {
|
|
76990
76973
|
checkCollisionsForDeclarationName(node, node.name);
|
|
76991
76974
|
}
|
|
76992
|
-
if (checkMode && checkMode & 4 /* SkipContextSensitive */ &&
|
|
76975
|
+
if (checkMode && checkMode & 4 /* SkipContextSensitive */ && isContextSensitive(node)) {
|
|
76993
76976
|
if (!getEffectiveReturnTypeNode(node) && !hasContextSensitiveParameters(node)) {
|
|
76994
76977
|
const contextualSignature = getContextualSignature(node);
|
|
76995
76978
|
if (contextualSignature && couldContainTypeVariables(getReturnTypeOfSignature(contextualSignature))) {
|
|
@@ -77036,7 +77019,7 @@ ${lanes.join("\n")}
|
|
|
77036
77019
|
if (!signature) {
|
|
77037
77020
|
return;
|
|
77038
77021
|
}
|
|
77039
|
-
if (
|
|
77022
|
+
if (isContextSensitive(node)) {
|
|
77040
77023
|
if (contextualSignature) {
|
|
77041
77024
|
const inferenceContext = getInferenceContext(node);
|
|
77042
77025
|
let instantiatedContextualSignature;
|
|
@@ -142612,7 +142595,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
142612
142595
|
false
|
|
142613
142596
|
) && !isPrivateIdentifier(node.name) && !identifierToKeywordKind(node.name) ? node.name.text : getUniqueName(isClassLike(scope) ? "newProperty" : "newLocal", file);
|
|
142614
142597
|
const isJS = isInJSFile(scope);
|
|
142615
|
-
let variableType = isJS || !checker.
|
|
142598
|
+
let variableType = isJS || !checker.isContextSensitive(node) ? void 0 : checker.typeToTypeNode(checker.getContextualType(node), scope, 1 /* NoTruncation */);
|
|
142616
142599
|
let initializer = transformConstantInitializer(skipParentheses(node), substitutions);
|
|
142617
142600
|
({ variableType, initializer } = transformFunctionInitializerAndType(variableType, initializer));
|
|
142618
142601
|
suppressLeadingAndTrailingTrivia(initializer);
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -8430,7 +8430,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8430
8430
|
}
|
|
8431
8431
|
const ch = codePointAt(text, pos);
|
|
8432
8432
|
if (pos === 0) {
|
|
8433
|
-
if (
|
|
8433
|
+
if (text.slice(0, 256).includes("\uFFFD")) {
|
|
8434
8434
|
error(Diagnostics.File_appears_to_be_binary);
|
|
8435
8435
|
pos = end;
|
|
8436
8436
|
return token = 8 /* NonTextFileMarkerTrivia */;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.4.0-pr-
|
|
5
|
+
"version": "5.4.0-pr-57008-39",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
"node": "20.1.0",
|
|
115
115
|
"npm": "8.19.4"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "8535713d1934c2739cdbd7bce75540ddaa93fda2"
|
|
118
118
|
}
|