@typescript-deploys/pr-build 5.5.0-pr-57480-2 → 5.5.0-pr-57465-44
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 +112 -1
- package/lib/tsserver.js +118 -7
- package/lib/typescript.js +118 -7
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -56016,7 +56016,15 @@ function createTypeChecker(host) {
|
|
|
56016
56016
|
jsdocPredicate = getTypePredicateOfSignature(jsdocSignature);
|
|
56017
56017
|
}
|
|
56018
56018
|
}
|
|
56019
|
-
|
|
56019
|
+
if (type || jsdocPredicate) {
|
|
56020
|
+
signature.resolvedTypePredicate = type && isTypePredicateNode(type) ? createTypePredicateFromTypePredicateNode(type, signature) : jsdocPredicate || noTypePredicate;
|
|
56021
|
+
} else if (signature.declaration && isFunctionLikeDeclaration(signature.declaration) && (!signature.resolvedReturnType || signature.resolvedReturnType === booleanType)) {
|
|
56022
|
+
const { declaration } = signature;
|
|
56023
|
+
signature.resolvedTypePredicate = noTypePredicate;
|
|
56024
|
+
signature.resolvedTypePredicate = getTypePredicateFromBody(declaration) || noTypePredicate;
|
|
56025
|
+
} else {
|
|
56026
|
+
signature.resolvedTypePredicate = noTypePredicate;
|
|
56027
|
+
}
|
|
56020
56028
|
}
|
|
56021
56029
|
Debug.assert(!!signature.resolvedTypePredicate);
|
|
56022
56030
|
}
|
|
@@ -74425,6 +74433,109 @@ function createTypeChecker(host) {
|
|
|
74425
74433
|
return false;
|
|
74426
74434
|
}
|
|
74427
74435
|
}
|
|
74436
|
+
function getTypePredicateFromBody(func) {
|
|
74437
|
+
switch (func.kind) {
|
|
74438
|
+
case 176 /* Constructor */:
|
|
74439
|
+
case 177 /* GetAccessor */:
|
|
74440
|
+
case 178 /* SetAccessor */:
|
|
74441
|
+
return void 0;
|
|
74442
|
+
}
|
|
74443
|
+
const functionFlags = getFunctionFlags(func);
|
|
74444
|
+
if (functionFlags !== 0 /* Normal */ || func.parameters.length === 0)
|
|
74445
|
+
return void 0;
|
|
74446
|
+
let singleReturn;
|
|
74447
|
+
if (func.body && func.body.kind !== 241 /* Block */) {
|
|
74448
|
+
singleReturn = func.body;
|
|
74449
|
+
} else {
|
|
74450
|
+
if (functionHasImplicitReturn(func))
|
|
74451
|
+
return void 0;
|
|
74452
|
+
const bailedEarly = forEachReturnStatement(func.body, (returnStatement) => {
|
|
74453
|
+
if (singleReturn || !returnStatement.expression)
|
|
74454
|
+
return true;
|
|
74455
|
+
singleReturn = returnStatement.expression;
|
|
74456
|
+
});
|
|
74457
|
+
if (bailedEarly || !singleReturn)
|
|
74458
|
+
return void 0;
|
|
74459
|
+
}
|
|
74460
|
+
if (isTriviallyNonBoolean(singleReturn))
|
|
74461
|
+
return void 0;
|
|
74462
|
+
const predicate = checkIfExpressionRefinesAnyParameter(singleReturn);
|
|
74463
|
+
if (predicate) {
|
|
74464
|
+
const [i, type] = predicate;
|
|
74465
|
+
const param = func.parameters[i];
|
|
74466
|
+
if (isIdentifier(param.name)) {
|
|
74467
|
+
return createTypePredicate(1 /* Identifier */, param.name.escapedText, i, type);
|
|
74468
|
+
}
|
|
74469
|
+
}
|
|
74470
|
+
return void 0;
|
|
74471
|
+
function checkIfExpressionRefinesAnyParameter(expr) {
|
|
74472
|
+
expr = skipParentheses(
|
|
74473
|
+
expr,
|
|
74474
|
+
/*excludeJSDocTypeAssertions*/
|
|
74475
|
+
true
|
|
74476
|
+
);
|
|
74477
|
+
const type = checkExpressionCached(expr, 64 /* TypeOnly */);
|
|
74478
|
+
if (type !== booleanType || !func.body)
|
|
74479
|
+
return void 0;
|
|
74480
|
+
return forEach(func.parameters, (param, i) => {
|
|
74481
|
+
const initType = getSymbolLinks(param.symbol).type;
|
|
74482
|
+
if (!initType || initType === booleanType || isSymbolAssigned(param.symbol)) {
|
|
74483
|
+
return;
|
|
74484
|
+
}
|
|
74485
|
+
const trueType2 = checkIfExpressionRefinesParameter(
|
|
74486
|
+
expr,
|
|
74487
|
+
param,
|
|
74488
|
+
initType,
|
|
74489
|
+
/*forceFullCheck*/
|
|
74490
|
+
false
|
|
74491
|
+
);
|
|
74492
|
+
if (trueType2) {
|
|
74493
|
+
const trueSubtype = checkIfExpressionRefinesParameter(
|
|
74494
|
+
expr,
|
|
74495
|
+
param,
|
|
74496
|
+
trueType2,
|
|
74497
|
+
/*forceFullCheck*/
|
|
74498
|
+
true
|
|
74499
|
+
);
|
|
74500
|
+
if (trueSubtype) {
|
|
74501
|
+
return [i, trueType2];
|
|
74502
|
+
}
|
|
74503
|
+
}
|
|
74504
|
+
});
|
|
74505
|
+
}
|
|
74506
|
+
function checkIfExpressionRefinesParameter(expr, param, initType, forceFullCheck) {
|
|
74507
|
+
const antecedent = expr.flowNode ?? { flags: 2 /* Start */ };
|
|
74508
|
+
const trueCondition = {
|
|
74509
|
+
flags: 32 /* TrueCondition */,
|
|
74510
|
+
node: expr,
|
|
74511
|
+
antecedent
|
|
74512
|
+
};
|
|
74513
|
+
const trueType2 = getFlowTypeOfReference(param.name, initType, initType, func, trueCondition);
|
|
74514
|
+
if (trueType2 === initType && !forceFullCheck)
|
|
74515
|
+
return void 0;
|
|
74516
|
+
const falseCondition = {
|
|
74517
|
+
...trueCondition,
|
|
74518
|
+
flags: 64 /* FalseCondition */
|
|
74519
|
+
};
|
|
74520
|
+
const falseType2 = getFlowTypeOfReference(param.name, initType, initType, func, falseCondition);
|
|
74521
|
+
const candidateFalse = filterType(initType, (t) => !isTypeSubtypeOf(t, trueType2));
|
|
74522
|
+
if (isTypeIdenticalTo(candidateFalse, falseType2)) {
|
|
74523
|
+
return trueType2;
|
|
74524
|
+
}
|
|
74525
|
+
}
|
|
74526
|
+
function isTriviallyNonBoolean(expr) {
|
|
74527
|
+
if (isLiteralExpression(expr) || isLiteralExpressionOfObject(expr)) {
|
|
74528
|
+
return true;
|
|
74529
|
+
}
|
|
74530
|
+
if (isIdentifier(expr)) {
|
|
74531
|
+
const sym = getResolvedSymbol(expr);
|
|
74532
|
+
if (sym.flags & (32 /* Class */ | 4096 /* ObjectLiteral */ | 16 /* Function */ | 384 /* Enum */ | 8 /* EnumMember */)) {
|
|
74533
|
+
return true;
|
|
74534
|
+
}
|
|
74535
|
+
}
|
|
74536
|
+
return false;
|
|
74537
|
+
}
|
|
74538
|
+
}
|
|
74428
74539
|
function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {
|
|
74429
74540
|
addLazyDiagnostic(checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics);
|
|
74430
74541
|
return;
|
package/lib/tsserver.js
CHANGED
|
@@ -60761,7 +60761,15 @@ function createTypeChecker(host) {
|
|
|
60761
60761
|
jsdocPredicate = getTypePredicateOfSignature(jsdocSignature);
|
|
60762
60762
|
}
|
|
60763
60763
|
}
|
|
60764
|
-
|
|
60764
|
+
if (type || jsdocPredicate) {
|
|
60765
|
+
signature.resolvedTypePredicate = type && isTypePredicateNode(type) ? createTypePredicateFromTypePredicateNode(type, signature) : jsdocPredicate || noTypePredicate;
|
|
60766
|
+
} else if (signature.declaration && isFunctionLikeDeclaration(signature.declaration) && (!signature.resolvedReturnType || signature.resolvedReturnType === booleanType)) {
|
|
60767
|
+
const { declaration } = signature;
|
|
60768
|
+
signature.resolvedTypePredicate = noTypePredicate;
|
|
60769
|
+
signature.resolvedTypePredicate = getTypePredicateFromBody(declaration) || noTypePredicate;
|
|
60770
|
+
} else {
|
|
60771
|
+
signature.resolvedTypePredicate = noTypePredicate;
|
|
60772
|
+
}
|
|
60765
60773
|
}
|
|
60766
60774
|
Debug.assert(!!signature.resolvedTypePredicate);
|
|
60767
60775
|
}
|
|
@@ -79170,6 +79178,109 @@ function createTypeChecker(host) {
|
|
|
79170
79178
|
return false;
|
|
79171
79179
|
}
|
|
79172
79180
|
}
|
|
79181
|
+
function getTypePredicateFromBody(func) {
|
|
79182
|
+
switch (func.kind) {
|
|
79183
|
+
case 176 /* Constructor */:
|
|
79184
|
+
case 177 /* GetAccessor */:
|
|
79185
|
+
case 178 /* SetAccessor */:
|
|
79186
|
+
return void 0;
|
|
79187
|
+
}
|
|
79188
|
+
const functionFlags = getFunctionFlags(func);
|
|
79189
|
+
if (functionFlags !== 0 /* Normal */ || func.parameters.length === 0)
|
|
79190
|
+
return void 0;
|
|
79191
|
+
let singleReturn;
|
|
79192
|
+
if (func.body && func.body.kind !== 241 /* Block */) {
|
|
79193
|
+
singleReturn = func.body;
|
|
79194
|
+
} else {
|
|
79195
|
+
if (functionHasImplicitReturn(func))
|
|
79196
|
+
return void 0;
|
|
79197
|
+
const bailedEarly = forEachReturnStatement(func.body, (returnStatement) => {
|
|
79198
|
+
if (singleReturn || !returnStatement.expression)
|
|
79199
|
+
return true;
|
|
79200
|
+
singleReturn = returnStatement.expression;
|
|
79201
|
+
});
|
|
79202
|
+
if (bailedEarly || !singleReturn)
|
|
79203
|
+
return void 0;
|
|
79204
|
+
}
|
|
79205
|
+
if (isTriviallyNonBoolean(singleReturn))
|
|
79206
|
+
return void 0;
|
|
79207
|
+
const predicate = checkIfExpressionRefinesAnyParameter(singleReturn);
|
|
79208
|
+
if (predicate) {
|
|
79209
|
+
const [i, type] = predicate;
|
|
79210
|
+
const param = func.parameters[i];
|
|
79211
|
+
if (isIdentifier(param.name)) {
|
|
79212
|
+
return createTypePredicate(1 /* Identifier */, param.name.escapedText, i, type);
|
|
79213
|
+
}
|
|
79214
|
+
}
|
|
79215
|
+
return void 0;
|
|
79216
|
+
function checkIfExpressionRefinesAnyParameter(expr) {
|
|
79217
|
+
expr = skipParentheses(
|
|
79218
|
+
expr,
|
|
79219
|
+
/*excludeJSDocTypeAssertions*/
|
|
79220
|
+
true
|
|
79221
|
+
);
|
|
79222
|
+
const type = checkExpressionCached(expr, 64 /* TypeOnly */);
|
|
79223
|
+
if (type !== booleanType || !func.body)
|
|
79224
|
+
return void 0;
|
|
79225
|
+
return forEach(func.parameters, (param, i) => {
|
|
79226
|
+
const initType = getSymbolLinks(param.symbol).type;
|
|
79227
|
+
if (!initType || initType === booleanType || isSymbolAssigned(param.symbol)) {
|
|
79228
|
+
return;
|
|
79229
|
+
}
|
|
79230
|
+
const trueType2 = checkIfExpressionRefinesParameter(
|
|
79231
|
+
expr,
|
|
79232
|
+
param,
|
|
79233
|
+
initType,
|
|
79234
|
+
/*forceFullCheck*/
|
|
79235
|
+
false
|
|
79236
|
+
);
|
|
79237
|
+
if (trueType2) {
|
|
79238
|
+
const trueSubtype = checkIfExpressionRefinesParameter(
|
|
79239
|
+
expr,
|
|
79240
|
+
param,
|
|
79241
|
+
trueType2,
|
|
79242
|
+
/*forceFullCheck*/
|
|
79243
|
+
true
|
|
79244
|
+
);
|
|
79245
|
+
if (trueSubtype) {
|
|
79246
|
+
return [i, trueType2];
|
|
79247
|
+
}
|
|
79248
|
+
}
|
|
79249
|
+
});
|
|
79250
|
+
}
|
|
79251
|
+
function checkIfExpressionRefinesParameter(expr, param, initType, forceFullCheck) {
|
|
79252
|
+
const antecedent = expr.flowNode ?? { flags: 2 /* Start */ };
|
|
79253
|
+
const trueCondition = {
|
|
79254
|
+
flags: 32 /* TrueCondition */,
|
|
79255
|
+
node: expr,
|
|
79256
|
+
antecedent
|
|
79257
|
+
};
|
|
79258
|
+
const trueType2 = getFlowTypeOfReference(param.name, initType, initType, func, trueCondition);
|
|
79259
|
+
if (trueType2 === initType && !forceFullCheck)
|
|
79260
|
+
return void 0;
|
|
79261
|
+
const falseCondition = {
|
|
79262
|
+
...trueCondition,
|
|
79263
|
+
flags: 64 /* FalseCondition */
|
|
79264
|
+
};
|
|
79265
|
+
const falseType2 = getFlowTypeOfReference(param.name, initType, initType, func, falseCondition);
|
|
79266
|
+
const candidateFalse = filterType(initType, (t) => !isTypeSubtypeOf(t, trueType2));
|
|
79267
|
+
if (isTypeIdenticalTo(candidateFalse, falseType2)) {
|
|
79268
|
+
return trueType2;
|
|
79269
|
+
}
|
|
79270
|
+
}
|
|
79271
|
+
function isTriviallyNonBoolean(expr) {
|
|
79272
|
+
if (isLiteralExpression(expr) || isLiteralExpressionOfObject(expr)) {
|
|
79273
|
+
return true;
|
|
79274
|
+
}
|
|
79275
|
+
if (isIdentifier(expr)) {
|
|
79276
|
+
const sym = getResolvedSymbol(expr);
|
|
79277
|
+
if (sym.flags & (32 /* Class */ | 4096 /* ObjectLiteral */ | 16 /* Function */ | 384 /* Enum */ | 8 /* EnumMember */)) {
|
|
79278
|
+
return true;
|
|
79279
|
+
}
|
|
79280
|
+
}
|
|
79281
|
+
return false;
|
|
79282
|
+
}
|
|
79283
|
+
}
|
|
79173
79284
|
function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {
|
|
79174
79285
|
addLazyDiagnostic(checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics);
|
|
79175
79286
|
return;
|
|
@@ -159781,7 +159892,7 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
159781
159892
|
let importAdder;
|
|
159782
159893
|
const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext);
|
|
159783
159894
|
if (memberCompletionEntry) {
|
|
159784
|
-
({ insertText, filterText, isSnippet, importAdder
|
|
159895
|
+
({ insertText, filterText, isSnippet, importAdder } = memberCompletionEntry);
|
|
159785
159896
|
if (importAdder == null ? void 0 : importAdder.hasFixes()) {
|
|
159786
159897
|
hasAction = true;
|
|
159787
159898
|
source = "ClassMemberSnippet/" /* ClassMemberSnippet */;
|
|
@@ -159969,7 +160080,7 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
|
|
|
159969
160080
|
);
|
|
159970
160081
|
}
|
|
159971
160082
|
}
|
|
159972
|
-
return { insertText, filterText, isSnippet, importAdder,
|
|
160083
|
+
return { insertText, filterText, isSnippet, importAdder, eraseRange };
|
|
159973
160084
|
}
|
|
159974
160085
|
function getPresentModifiers(contextToken, sourceFile, position) {
|
|
159975
160086
|
if (!contextToken || getLineAndCharacterOfPosition(sourceFile, position).line > getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line) {
|
|
@@ -160621,7 +160732,7 @@ function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextTo
|
|
|
160621
160732
|
}
|
|
160622
160733
|
}
|
|
160623
160734
|
if (source === "ClassMemberSnippet/" /* ClassMemberSnippet */) {
|
|
160624
|
-
const { importAdder,
|
|
160735
|
+
const { importAdder, eraseRange } = getEntryForMemberCompletion(
|
|
160625
160736
|
host,
|
|
160626
160737
|
program,
|
|
160627
160738
|
compilerOptions,
|
|
@@ -160633,15 +160744,15 @@ function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextTo
|
|
|
160633
160744
|
contextToken,
|
|
160634
160745
|
formatContext
|
|
160635
160746
|
);
|
|
160636
|
-
if (importAdder ||
|
|
160747
|
+
if (importAdder || eraseRange) {
|
|
160637
160748
|
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
160638
160749
|
{ host, formatContext, preferences },
|
|
160639
160750
|
(tracker) => {
|
|
160640
160751
|
if (importAdder) {
|
|
160641
160752
|
importAdder.writeFixes(tracker);
|
|
160642
160753
|
}
|
|
160643
|
-
if (
|
|
160644
|
-
tracker.deleteRange(sourceFile,
|
|
160754
|
+
if (eraseRange) {
|
|
160755
|
+
tracker.deleteRange(sourceFile, eraseRange);
|
|
160645
160756
|
}
|
|
160646
160757
|
}
|
|
160647
160758
|
);
|
package/lib/typescript.js
CHANGED
|
@@ -58515,7 +58515,15 @@ ${lanes.join("\n")}
|
|
|
58515
58515
|
jsdocPredicate = getTypePredicateOfSignature(jsdocSignature);
|
|
58516
58516
|
}
|
|
58517
58517
|
}
|
|
58518
|
-
|
|
58518
|
+
if (type || jsdocPredicate) {
|
|
58519
|
+
signature.resolvedTypePredicate = type && isTypePredicateNode(type) ? createTypePredicateFromTypePredicateNode(type, signature) : jsdocPredicate || noTypePredicate;
|
|
58520
|
+
} else if (signature.declaration && isFunctionLikeDeclaration(signature.declaration) && (!signature.resolvedReturnType || signature.resolvedReturnType === booleanType)) {
|
|
58521
|
+
const { declaration } = signature;
|
|
58522
|
+
signature.resolvedTypePredicate = noTypePredicate;
|
|
58523
|
+
signature.resolvedTypePredicate = getTypePredicateFromBody(declaration) || noTypePredicate;
|
|
58524
|
+
} else {
|
|
58525
|
+
signature.resolvedTypePredicate = noTypePredicate;
|
|
58526
|
+
}
|
|
58519
58527
|
}
|
|
58520
58528
|
Debug.assert(!!signature.resolvedTypePredicate);
|
|
58521
58529
|
}
|
|
@@ -76924,6 +76932,109 @@ ${lanes.join("\n")}
|
|
|
76924
76932
|
return false;
|
|
76925
76933
|
}
|
|
76926
76934
|
}
|
|
76935
|
+
function getTypePredicateFromBody(func) {
|
|
76936
|
+
switch (func.kind) {
|
|
76937
|
+
case 176 /* Constructor */:
|
|
76938
|
+
case 177 /* GetAccessor */:
|
|
76939
|
+
case 178 /* SetAccessor */:
|
|
76940
|
+
return void 0;
|
|
76941
|
+
}
|
|
76942
|
+
const functionFlags = getFunctionFlags(func);
|
|
76943
|
+
if (functionFlags !== 0 /* Normal */ || func.parameters.length === 0)
|
|
76944
|
+
return void 0;
|
|
76945
|
+
let singleReturn;
|
|
76946
|
+
if (func.body && func.body.kind !== 241 /* Block */) {
|
|
76947
|
+
singleReturn = func.body;
|
|
76948
|
+
} else {
|
|
76949
|
+
if (functionHasImplicitReturn(func))
|
|
76950
|
+
return void 0;
|
|
76951
|
+
const bailedEarly = forEachReturnStatement(func.body, (returnStatement) => {
|
|
76952
|
+
if (singleReturn || !returnStatement.expression)
|
|
76953
|
+
return true;
|
|
76954
|
+
singleReturn = returnStatement.expression;
|
|
76955
|
+
});
|
|
76956
|
+
if (bailedEarly || !singleReturn)
|
|
76957
|
+
return void 0;
|
|
76958
|
+
}
|
|
76959
|
+
if (isTriviallyNonBoolean(singleReturn))
|
|
76960
|
+
return void 0;
|
|
76961
|
+
const predicate = checkIfExpressionRefinesAnyParameter(singleReturn);
|
|
76962
|
+
if (predicate) {
|
|
76963
|
+
const [i, type] = predicate;
|
|
76964
|
+
const param = func.parameters[i];
|
|
76965
|
+
if (isIdentifier(param.name)) {
|
|
76966
|
+
return createTypePredicate(1 /* Identifier */, param.name.escapedText, i, type);
|
|
76967
|
+
}
|
|
76968
|
+
}
|
|
76969
|
+
return void 0;
|
|
76970
|
+
function checkIfExpressionRefinesAnyParameter(expr) {
|
|
76971
|
+
expr = skipParentheses(
|
|
76972
|
+
expr,
|
|
76973
|
+
/*excludeJSDocTypeAssertions*/
|
|
76974
|
+
true
|
|
76975
|
+
);
|
|
76976
|
+
const type = checkExpressionCached(expr, 64 /* TypeOnly */);
|
|
76977
|
+
if (type !== booleanType || !func.body)
|
|
76978
|
+
return void 0;
|
|
76979
|
+
return forEach(func.parameters, (param, i) => {
|
|
76980
|
+
const initType = getSymbolLinks(param.symbol).type;
|
|
76981
|
+
if (!initType || initType === booleanType || isSymbolAssigned(param.symbol)) {
|
|
76982
|
+
return;
|
|
76983
|
+
}
|
|
76984
|
+
const trueType2 = checkIfExpressionRefinesParameter(
|
|
76985
|
+
expr,
|
|
76986
|
+
param,
|
|
76987
|
+
initType,
|
|
76988
|
+
/*forceFullCheck*/
|
|
76989
|
+
false
|
|
76990
|
+
);
|
|
76991
|
+
if (trueType2) {
|
|
76992
|
+
const trueSubtype = checkIfExpressionRefinesParameter(
|
|
76993
|
+
expr,
|
|
76994
|
+
param,
|
|
76995
|
+
trueType2,
|
|
76996
|
+
/*forceFullCheck*/
|
|
76997
|
+
true
|
|
76998
|
+
);
|
|
76999
|
+
if (trueSubtype) {
|
|
77000
|
+
return [i, trueType2];
|
|
77001
|
+
}
|
|
77002
|
+
}
|
|
77003
|
+
});
|
|
77004
|
+
}
|
|
77005
|
+
function checkIfExpressionRefinesParameter(expr, param, initType, forceFullCheck) {
|
|
77006
|
+
const antecedent = expr.flowNode ?? { flags: 2 /* Start */ };
|
|
77007
|
+
const trueCondition = {
|
|
77008
|
+
flags: 32 /* TrueCondition */,
|
|
77009
|
+
node: expr,
|
|
77010
|
+
antecedent
|
|
77011
|
+
};
|
|
77012
|
+
const trueType2 = getFlowTypeOfReference(param.name, initType, initType, func, trueCondition);
|
|
77013
|
+
if (trueType2 === initType && !forceFullCheck)
|
|
77014
|
+
return void 0;
|
|
77015
|
+
const falseCondition = {
|
|
77016
|
+
...trueCondition,
|
|
77017
|
+
flags: 64 /* FalseCondition */
|
|
77018
|
+
};
|
|
77019
|
+
const falseType2 = getFlowTypeOfReference(param.name, initType, initType, func, falseCondition);
|
|
77020
|
+
const candidateFalse = filterType(initType, (t) => !isTypeSubtypeOf(t, trueType2));
|
|
77021
|
+
if (isTypeIdenticalTo(candidateFalse, falseType2)) {
|
|
77022
|
+
return trueType2;
|
|
77023
|
+
}
|
|
77024
|
+
}
|
|
77025
|
+
function isTriviallyNonBoolean(expr) {
|
|
77026
|
+
if (isLiteralExpression(expr) || isLiteralExpressionOfObject(expr)) {
|
|
77027
|
+
return true;
|
|
77028
|
+
}
|
|
77029
|
+
if (isIdentifier(expr)) {
|
|
77030
|
+
const sym = getResolvedSymbol(expr);
|
|
77031
|
+
if (sym.flags & (32 /* Class */ | 4096 /* ObjectLiteral */ | 16 /* Function */ | 384 /* Enum */ | 8 /* EnumMember */)) {
|
|
77032
|
+
return true;
|
|
77033
|
+
}
|
|
77034
|
+
}
|
|
77035
|
+
return false;
|
|
77036
|
+
}
|
|
77037
|
+
}
|
|
76927
77038
|
function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {
|
|
76928
77039
|
addLazyDiagnostic(checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics);
|
|
76929
77040
|
return;
|
|
@@ -159003,7 +159114,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159003
159114
|
let importAdder;
|
|
159004
159115
|
const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext);
|
|
159005
159116
|
if (memberCompletionEntry) {
|
|
159006
|
-
({ insertText, filterText, isSnippet, importAdder
|
|
159117
|
+
({ insertText, filterText, isSnippet, importAdder } = memberCompletionEntry);
|
|
159007
159118
|
if (importAdder == null ? void 0 : importAdder.hasFixes()) {
|
|
159008
159119
|
hasAction = true;
|
|
159009
159120
|
source = "ClassMemberSnippet/" /* ClassMemberSnippet */;
|
|
@@ -159191,7 +159302,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159191
159302
|
);
|
|
159192
159303
|
}
|
|
159193
159304
|
}
|
|
159194
|
-
return { insertText, filterText, isSnippet, importAdder,
|
|
159305
|
+
return { insertText, filterText, isSnippet, importAdder, eraseRange };
|
|
159195
159306
|
}
|
|
159196
159307
|
function getPresentModifiers(contextToken, sourceFile, position) {
|
|
159197
159308
|
if (!contextToken || getLineAndCharacterOfPosition(sourceFile, position).line > getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line) {
|
|
@@ -159843,7 +159954,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159843
159954
|
}
|
|
159844
159955
|
}
|
|
159845
159956
|
if (source === "ClassMemberSnippet/" /* ClassMemberSnippet */) {
|
|
159846
|
-
const { importAdder,
|
|
159957
|
+
const { importAdder, eraseRange } = getEntryForMemberCompletion(
|
|
159847
159958
|
host,
|
|
159848
159959
|
program,
|
|
159849
159960
|
compilerOptions,
|
|
@@ -159855,15 +159966,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159855
159966
|
contextToken,
|
|
159856
159967
|
formatContext
|
|
159857
159968
|
);
|
|
159858
|
-
if (importAdder ||
|
|
159969
|
+
if (importAdder || eraseRange) {
|
|
159859
159970
|
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
159860
159971
|
{ host, formatContext, preferences },
|
|
159861
159972
|
(tracker) => {
|
|
159862
159973
|
if (importAdder) {
|
|
159863
159974
|
importAdder.writeFixes(tracker);
|
|
159864
159975
|
}
|
|
159865
|
-
if (
|
|
159866
|
-
tracker.deleteRange(sourceFile,
|
|
159976
|
+
if (eraseRange) {
|
|
159977
|
+
tracker.deleteRange(sourceFile, eraseRange);
|
|
159867
159978
|
}
|
|
159868
159979
|
}
|
|
159869
159980
|
);
|
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.5.0-pr-
|
|
5
|
+
"version": "5.5.0-pr-57465-44",
|
|
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": "38a3acfa5adb621582815eb125e8f5d5ebb602cf"
|
|
118
118
|
}
|