@typescript-deploys/pr-build 5.5.0-pr-57465-44 → 5.5.0-pr-57267-6
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 +4 -115
- package/lib/tsserver.js +286 -331
- package/lib/typescript.js +284 -332
- package/lib/typingsInstaller.js +1 -1
- 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.5";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240227`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -56016,15 +56016,7 @@ function createTypeChecker(host) {
|
|
|
56016
56016
|
jsdocPredicate = getTypePredicateOfSignature(jsdocSignature);
|
|
56017
56017
|
}
|
|
56018
56018
|
}
|
|
56019
|
-
|
|
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
|
-
}
|
|
56019
|
+
signature.resolvedTypePredicate = type && isTypePredicateNode(type) ? createTypePredicateFromTypePredicateNode(type, signature) : jsdocPredicate || noTypePredicate;
|
|
56028
56020
|
}
|
|
56029
56021
|
Debug.assert(!!signature.resolvedTypePredicate);
|
|
56030
56022
|
}
|
|
@@ -74433,109 +74425,6 @@ function createTypeChecker(host) {
|
|
|
74433
74425
|
return false;
|
|
74434
74426
|
}
|
|
74435
74427
|
}
|
|
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
|
-
}
|
|
74539
74428
|
function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {
|
|
74540
74429
|
addLazyDiagnostic(checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics);
|
|
74541
74430
|
return;
|
|
@@ -111168,8 +111057,8 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
111168
111057
|
removeComments: compilerOptions.removeComments,
|
|
111169
111058
|
newLine: compilerOptions.newLine,
|
|
111170
111059
|
noEmitHelpers: compilerOptions.noEmitHelpers,
|
|
111171
|
-
module: compilerOptions
|
|
111172
|
-
target: compilerOptions
|
|
111060
|
+
module: getEmitModuleKind(compilerOptions),
|
|
111061
|
+
target: getEmitScriptTarget(compilerOptions),
|
|
111173
111062
|
sourceMap: compilerOptions.sourceMap,
|
|
111174
111063
|
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
111175
111064
|
inlineSources: compilerOptions.inlineSources,
|