@typescript-deploys/pr-build 5.4.0-pr-57122-21 → 5.5.0-pr-57465-17
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 +97 -9
- package/lib/tsserver.js +120 -21
- package/lib/typescript.d.ts +1 -1
- package/lib/typescript.js +119 -21
- package/lib/typingsInstaller.js +2 -2
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -17,8 +17,8 @@ and limitations under the License.
|
|
|
17
17
|
"use strict";
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
|
-
var versionMajorMinor = "5.
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
20
|
+
var versionMajorMinor = "5.5";
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240221`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -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, signature) || noTypePredicate;
|
|
56025
|
+
} else {
|
|
56026
|
+
signature.resolvedTypePredicate = noTypePredicate;
|
|
56027
|
+
}
|
|
56020
56028
|
}
|
|
56021
56029
|
Debug.assert(!!signature.resolvedTypePredicate);
|
|
56022
56030
|
}
|
|
@@ -74425,6 +74433,89 @@ function createTypeChecker(host) {
|
|
|
74425
74433
|
return false;
|
|
74426
74434
|
}
|
|
74427
74435
|
}
|
|
74436
|
+
function getTypePredicateFromBody(func, _sig) {
|
|
74437
|
+
const functionFlags = getFunctionFlags(func);
|
|
74438
|
+
if (functionFlags !== 0 /* Normal */)
|
|
74439
|
+
return void 0;
|
|
74440
|
+
let singleReturn;
|
|
74441
|
+
if (func.body && func.body.kind !== 241 /* Block */) {
|
|
74442
|
+
singleReturn = func.body;
|
|
74443
|
+
} else {
|
|
74444
|
+
if (functionHasImplicitReturn(func))
|
|
74445
|
+
return void 0;
|
|
74446
|
+
const bailedEarly = forEachReturnStatement(func.body, (returnStatement) => {
|
|
74447
|
+
if (singleReturn || !returnStatement.expression)
|
|
74448
|
+
return true;
|
|
74449
|
+
singleReturn = returnStatement.expression;
|
|
74450
|
+
});
|
|
74451
|
+
if (bailedEarly || !singleReturn)
|
|
74452
|
+
return void 0;
|
|
74453
|
+
}
|
|
74454
|
+
const predicate = checkIfExpressionRefinesAnyParameter(singleReturn);
|
|
74455
|
+
if (predicate) {
|
|
74456
|
+
const [i, type] = predicate;
|
|
74457
|
+
const param = func.parameters[i];
|
|
74458
|
+
if (isIdentifier(param.name)) {
|
|
74459
|
+
return createTypePredicate(1 /* Identifier */, param.name.escapedText, i, type);
|
|
74460
|
+
}
|
|
74461
|
+
}
|
|
74462
|
+
return void 0;
|
|
74463
|
+
function checkIfExpressionRefinesAnyParameter(expr) {
|
|
74464
|
+
expr = skipParentheses(
|
|
74465
|
+
expr,
|
|
74466
|
+
/*excludeJSDocTypeAssertions*/
|
|
74467
|
+
true
|
|
74468
|
+
);
|
|
74469
|
+
const type = checkExpressionCached(expr, 64 /* TypeOnly */);
|
|
74470
|
+
if (type !== booleanType || !func.body)
|
|
74471
|
+
return void 0;
|
|
74472
|
+
return forEach(func.parameters, (param, i) => {
|
|
74473
|
+
const initType = getSymbolLinks(param.symbol).type;
|
|
74474
|
+
if (!initType || initType === booleanType || isSymbolAssigned(param.symbol)) {
|
|
74475
|
+
return;
|
|
74476
|
+
}
|
|
74477
|
+
const trueType2 = checkIfExpressionRefinesParameter(
|
|
74478
|
+
expr,
|
|
74479
|
+
param,
|
|
74480
|
+
initType,
|
|
74481
|
+
/*forceFullCheck*/
|
|
74482
|
+
false
|
|
74483
|
+
);
|
|
74484
|
+
if (trueType2) {
|
|
74485
|
+
const trueSubtype = checkIfExpressionRefinesParameter(
|
|
74486
|
+
expr,
|
|
74487
|
+
param,
|
|
74488
|
+
trueType2,
|
|
74489
|
+
/*forceFullCheck*/
|
|
74490
|
+
true
|
|
74491
|
+
);
|
|
74492
|
+
if (trueSubtype) {
|
|
74493
|
+
return [i, trueType2];
|
|
74494
|
+
}
|
|
74495
|
+
}
|
|
74496
|
+
});
|
|
74497
|
+
}
|
|
74498
|
+
function checkIfExpressionRefinesParameter(expr, param, initType, forceFullCheck) {
|
|
74499
|
+
const antecedent = expr.flowNode ?? { flags: 2 /* Start */ };
|
|
74500
|
+
const trueCondition = {
|
|
74501
|
+
flags: 32 /* TrueCondition */,
|
|
74502
|
+
node: expr,
|
|
74503
|
+
antecedent
|
|
74504
|
+
};
|
|
74505
|
+
const trueType2 = getFlowTypeOfReference(param.name, initType, initType, func, trueCondition);
|
|
74506
|
+
if (trueType2 === initType && !forceFullCheck)
|
|
74507
|
+
return void 0;
|
|
74508
|
+
const falseCondition = {
|
|
74509
|
+
...trueCondition,
|
|
74510
|
+
flags: 64 /* FalseCondition */
|
|
74511
|
+
};
|
|
74512
|
+
const falseType2 = getFlowTypeOfReference(param.name, initType, initType, func, falseCondition);
|
|
74513
|
+
const candidateFalse = filterType(initType, (t) => !isTypeSubtypeOf(t, trueType2));
|
|
74514
|
+
if (isTypeIdenticalTo(candidateFalse, falseType2)) {
|
|
74515
|
+
return trueType2;
|
|
74516
|
+
}
|
|
74517
|
+
}
|
|
74518
|
+
}
|
|
74428
74519
|
function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {
|
|
74429
74520
|
addLazyDiagnostic(checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics);
|
|
74430
74521
|
return;
|
|
@@ -77029,20 +77120,17 @@ function createTypeChecker(host) {
|
|
|
77029
77120
|
const objectType = type.objectType;
|
|
77030
77121
|
const indexType = type.indexType;
|
|
77031
77122
|
const objectIndexType = isGenericMappedType(objectType) && getMappedTypeNameTypeKind(objectType) === 2 /* Remapping */ ? getIndexTypeForMappedType(objectType, 0 /* None */) : getIndexType(objectType, 0 /* None */);
|
|
77032
|
-
|
|
77123
|
+
const hasNumberIndexInfo = !!getIndexInfoOfType(objectType, numberType);
|
|
77124
|
+
if (everyType(indexType, (t) => isTypeAssignableTo(t, objectIndexType) || hasNumberIndexInfo && isApplicableIndexType(t, numberType))) {
|
|
77033
77125
|
if (accessNode.kind === 212 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
|
|
77034
77126
|
error(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
77035
77127
|
}
|
|
77036
77128
|
return type;
|
|
77037
77129
|
}
|
|
77038
|
-
const apparentObjectType = getApparentType(objectType);
|
|
77039
|
-
if (getIndexInfoOfType(apparentObjectType, numberType) && isTypeAssignableToKind(indexType, 296 /* NumberLike */)) {
|
|
77040
|
-
return type;
|
|
77041
|
-
}
|
|
77042
77130
|
if (isGenericObjectType(objectType)) {
|
|
77043
77131
|
const propertyName = getPropertyNameFromIndex(indexType, accessNode);
|
|
77044
77132
|
if (propertyName) {
|
|
77045
|
-
const propertySymbol = forEachType(
|
|
77133
|
+
const propertySymbol = forEachType(getApparentType(objectType), (t) => getPropertyOfType(t, propertyName));
|
|
77046
77134
|
if (propertySymbol && getDeclarationModifierFlagsFromSymbol(propertySymbol) & 6 /* NonPublicAccessibilityModifier */) {
|
|
77047
77135
|
error(accessNode, Diagnostics.Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter, unescapeLeadingUnderscores(propertyName));
|
|
77048
77136
|
return errorType;
|
package/lib/tsserver.js
CHANGED
|
@@ -1231,6 +1231,7 @@ __export(server_exports, {
|
|
|
1231
1231
|
isBindingOrAssignmentPattern: () => isBindingOrAssignmentPattern,
|
|
1232
1232
|
isBindingPattern: () => isBindingPattern,
|
|
1233
1233
|
isBlock: () => isBlock,
|
|
1234
|
+
isBlockLike: () => isBlockLike,
|
|
1234
1235
|
isBlockOrCatchScoped: () => isBlockOrCatchScoped,
|
|
1235
1236
|
isBlockScope: () => isBlockScope,
|
|
1236
1237
|
isBlockScopedContainerTopLevel: () => isBlockScopedContainerTopLevel,
|
|
@@ -2339,8 +2340,8 @@ __export(server_exports, {
|
|
|
2339
2340
|
module.exports = __toCommonJS(server_exports);
|
|
2340
2341
|
|
|
2341
2342
|
// src/compiler/corePublic.ts
|
|
2342
|
-
var versionMajorMinor = "5.
|
|
2343
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2343
|
+
var versionMajorMinor = "5.5";
|
|
2344
|
+
var version = `${versionMajorMinor}.0-insiders.20240221`;
|
|
2344
2345
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2345
2346
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2346
2347
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -60760,7 +60761,15 @@ function createTypeChecker(host) {
|
|
|
60760
60761
|
jsdocPredicate = getTypePredicateOfSignature(jsdocSignature);
|
|
60761
60762
|
}
|
|
60762
60763
|
}
|
|
60763
|
-
|
|
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, signature) || noTypePredicate;
|
|
60770
|
+
} else {
|
|
60771
|
+
signature.resolvedTypePredicate = noTypePredicate;
|
|
60772
|
+
}
|
|
60764
60773
|
}
|
|
60765
60774
|
Debug.assert(!!signature.resolvedTypePredicate);
|
|
60766
60775
|
}
|
|
@@ -79169,6 +79178,89 @@ function createTypeChecker(host) {
|
|
|
79169
79178
|
return false;
|
|
79170
79179
|
}
|
|
79171
79180
|
}
|
|
79181
|
+
function getTypePredicateFromBody(func, _sig) {
|
|
79182
|
+
const functionFlags = getFunctionFlags(func);
|
|
79183
|
+
if (functionFlags !== 0 /* Normal */)
|
|
79184
|
+
return void 0;
|
|
79185
|
+
let singleReturn;
|
|
79186
|
+
if (func.body && func.body.kind !== 241 /* Block */) {
|
|
79187
|
+
singleReturn = func.body;
|
|
79188
|
+
} else {
|
|
79189
|
+
if (functionHasImplicitReturn(func))
|
|
79190
|
+
return void 0;
|
|
79191
|
+
const bailedEarly = forEachReturnStatement(func.body, (returnStatement) => {
|
|
79192
|
+
if (singleReturn || !returnStatement.expression)
|
|
79193
|
+
return true;
|
|
79194
|
+
singleReturn = returnStatement.expression;
|
|
79195
|
+
});
|
|
79196
|
+
if (bailedEarly || !singleReturn)
|
|
79197
|
+
return void 0;
|
|
79198
|
+
}
|
|
79199
|
+
const predicate = checkIfExpressionRefinesAnyParameter(singleReturn);
|
|
79200
|
+
if (predicate) {
|
|
79201
|
+
const [i, type] = predicate;
|
|
79202
|
+
const param = func.parameters[i];
|
|
79203
|
+
if (isIdentifier(param.name)) {
|
|
79204
|
+
return createTypePredicate(1 /* Identifier */, param.name.escapedText, i, type);
|
|
79205
|
+
}
|
|
79206
|
+
}
|
|
79207
|
+
return void 0;
|
|
79208
|
+
function checkIfExpressionRefinesAnyParameter(expr) {
|
|
79209
|
+
expr = skipParentheses(
|
|
79210
|
+
expr,
|
|
79211
|
+
/*excludeJSDocTypeAssertions*/
|
|
79212
|
+
true
|
|
79213
|
+
);
|
|
79214
|
+
const type = checkExpressionCached(expr, 64 /* TypeOnly */);
|
|
79215
|
+
if (type !== booleanType || !func.body)
|
|
79216
|
+
return void 0;
|
|
79217
|
+
return forEach(func.parameters, (param, i) => {
|
|
79218
|
+
const initType = getSymbolLinks(param.symbol).type;
|
|
79219
|
+
if (!initType || initType === booleanType || isSymbolAssigned(param.symbol)) {
|
|
79220
|
+
return;
|
|
79221
|
+
}
|
|
79222
|
+
const trueType2 = checkIfExpressionRefinesParameter(
|
|
79223
|
+
expr,
|
|
79224
|
+
param,
|
|
79225
|
+
initType,
|
|
79226
|
+
/*forceFullCheck*/
|
|
79227
|
+
false
|
|
79228
|
+
);
|
|
79229
|
+
if (trueType2) {
|
|
79230
|
+
const trueSubtype = checkIfExpressionRefinesParameter(
|
|
79231
|
+
expr,
|
|
79232
|
+
param,
|
|
79233
|
+
trueType2,
|
|
79234
|
+
/*forceFullCheck*/
|
|
79235
|
+
true
|
|
79236
|
+
);
|
|
79237
|
+
if (trueSubtype) {
|
|
79238
|
+
return [i, trueType2];
|
|
79239
|
+
}
|
|
79240
|
+
}
|
|
79241
|
+
});
|
|
79242
|
+
}
|
|
79243
|
+
function checkIfExpressionRefinesParameter(expr, param, initType, forceFullCheck) {
|
|
79244
|
+
const antecedent = expr.flowNode ?? { flags: 2 /* Start */ };
|
|
79245
|
+
const trueCondition = {
|
|
79246
|
+
flags: 32 /* TrueCondition */,
|
|
79247
|
+
node: expr,
|
|
79248
|
+
antecedent
|
|
79249
|
+
};
|
|
79250
|
+
const trueType2 = getFlowTypeOfReference(param.name, initType, initType, func, trueCondition);
|
|
79251
|
+
if (trueType2 === initType && !forceFullCheck)
|
|
79252
|
+
return void 0;
|
|
79253
|
+
const falseCondition = {
|
|
79254
|
+
...trueCondition,
|
|
79255
|
+
flags: 64 /* FalseCondition */
|
|
79256
|
+
};
|
|
79257
|
+
const falseType2 = getFlowTypeOfReference(param.name, initType, initType, func, falseCondition);
|
|
79258
|
+
const candidateFalse = filterType(initType, (t) => !isTypeSubtypeOf(t, trueType2));
|
|
79259
|
+
if (isTypeIdenticalTo(candidateFalse, falseType2)) {
|
|
79260
|
+
return trueType2;
|
|
79261
|
+
}
|
|
79262
|
+
}
|
|
79263
|
+
}
|
|
79172
79264
|
function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {
|
|
79173
79265
|
addLazyDiagnostic(checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics);
|
|
79174
79266
|
return;
|
|
@@ -81773,20 +81865,17 @@ function createTypeChecker(host) {
|
|
|
81773
81865
|
const objectType = type.objectType;
|
|
81774
81866
|
const indexType = type.indexType;
|
|
81775
81867
|
const objectIndexType = isGenericMappedType(objectType) && getMappedTypeNameTypeKind(objectType) === 2 /* Remapping */ ? getIndexTypeForMappedType(objectType, 0 /* None */) : getIndexType(objectType, 0 /* None */);
|
|
81776
|
-
|
|
81868
|
+
const hasNumberIndexInfo = !!getIndexInfoOfType(objectType, numberType);
|
|
81869
|
+
if (everyType(indexType, (t) => isTypeAssignableTo(t, objectIndexType) || hasNumberIndexInfo && isApplicableIndexType(t, numberType))) {
|
|
81777
81870
|
if (accessNode.kind === 212 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
|
|
81778
81871
|
error2(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
81779
81872
|
}
|
|
81780
81873
|
return type;
|
|
81781
81874
|
}
|
|
81782
|
-
const apparentObjectType = getApparentType(objectType);
|
|
81783
|
-
if (getIndexInfoOfType(apparentObjectType, numberType) && isTypeAssignableToKind(indexType, 296 /* NumberLike */)) {
|
|
81784
|
-
return type;
|
|
81785
|
-
}
|
|
81786
81875
|
if (isGenericObjectType(objectType)) {
|
|
81787
81876
|
const propertyName = getPropertyNameFromIndex(indexType, accessNode);
|
|
81788
81877
|
if (propertyName) {
|
|
81789
|
-
const propertySymbol = forEachType(
|
|
81878
|
+
const propertySymbol = forEachType(getApparentType(objectType), (t) => getPropertyOfType(t, propertyName));
|
|
81790
81879
|
if (propertySymbol && getDeclarationModifierFlagsFromSymbol(propertySymbol) & 6 /* NonPublicAccessibilityModifier */) {
|
|
81791
81880
|
error2(accessNode, Diagnostics.Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter, unescapeLeadingUnderscores(propertyName));
|
|
81792
81881
|
return errorType;
|
|
@@ -135473,6 +135562,17 @@ function fileShouldUseJavaScriptRequire(file, program, host, preferRequire) {
|
|
|
135473
135562
|
}
|
|
135474
135563
|
return preferRequire;
|
|
135475
135564
|
}
|
|
135565
|
+
function isBlockLike(node) {
|
|
135566
|
+
switch (node.kind) {
|
|
135567
|
+
case 241 /* Block */:
|
|
135568
|
+
case 312 /* SourceFile */:
|
|
135569
|
+
case 268 /* ModuleBlock */:
|
|
135570
|
+
case 296 /* CaseClause */:
|
|
135571
|
+
return true;
|
|
135572
|
+
default:
|
|
135573
|
+
return false;
|
|
135574
|
+
}
|
|
135575
|
+
}
|
|
135476
135576
|
|
|
135477
135577
|
// src/services/exportInfoMap.ts
|
|
135478
135578
|
var ImportKind = /* @__PURE__ */ ((ImportKind2) => {
|
|
@@ -140822,6 +140922,14 @@ registerRefactor(refactorNameForMoveToFile, {
|
|
|
140822
140922
|
if (!interactiveRefactorArguments) {
|
|
140823
140923
|
return emptyArray;
|
|
140824
140924
|
}
|
|
140925
|
+
if (context.endPosition !== void 0) {
|
|
140926
|
+
const file = context.file;
|
|
140927
|
+
const startNodeAncestor = findAncestor(getTokenAtPosition(file, context.startPosition), isBlockLike);
|
|
140928
|
+
const endNodeAncestor = findAncestor(getTokenAtPosition(file, context.endPosition), isBlockLike);
|
|
140929
|
+
if (startNodeAncestor && !isSourceFile(startNodeAncestor) && endNodeAncestor && !isSourceFile(endNodeAncestor)) {
|
|
140930
|
+
return emptyArray;
|
|
140931
|
+
}
|
|
140932
|
+
}
|
|
140825
140933
|
if (context.preferences.allowTextChangesInNewFiles && statements) {
|
|
140826
140934
|
return [{ name: refactorNameForMoveToFile, description: description2, actions: [moveToFileAction] }];
|
|
140827
140935
|
}
|
|
@@ -144899,17 +145007,6 @@ function isExtractableExpression(node) {
|
|
|
144899
145007
|
}
|
|
144900
145008
|
return true;
|
|
144901
145009
|
}
|
|
144902
|
-
function isBlockLike(node) {
|
|
144903
|
-
switch (node.kind) {
|
|
144904
|
-
case 241 /* Block */:
|
|
144905
|
-
case 312 /* SourceFile */:
|
|
144906
|
-
case 268 /* ModuleBlock */:
|
|
144907
|
-
case 296 /* CaseClause */:
|
|
144908
|
-
return true;
|
|
144909
|
-
default:
|
|
144910
|
-
return false;
|
|
144911
|
-
}
|
|
144912
|
-
}
|
|
144913
145010
|
function isInJSXContent(node) {
|
|
144914
145011
|
return isStringLiteralJsxAttribute(node) || (isJsxElement(node) || isJsxSelfClosingElement(node) || isJsxFragment(node)) && (isJsxElement(node.parent) || isJsxFragment(node.parent));
|
|
144915
145012
|
}
|
|
@@ -175659,6 +175756,7 @@ __export(ts_exports2, {
|
|
|
175659
175756
|
isBindingOrAssignmentPattern: () => isBindingOrAssignmentPattern,
|
|
175660
175757
|
isBindingPattern: () => isBindingPattern,
|
|
175661
175758
|
isBlock: () => isBlock,
|
|
175759
|
+
isBlockLike: () => isBlockLike,
|
|
175662
175760
|
isBlockOrCatchScoped: () => isBlockOrCatchScoped,
|
|
175663
175761
|
isBlockScope: () => isBlockScope,
|
|
175664
175762
|
isBlockScopedContainerTopLevel: () => isBlockScopedContainerTopLevel,
|
|
@@ -183957,7 +184055,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183957
184055
|
return;
|
|
183958
184056
|
}
|
|
183959
184057
|
this.logger.info(`Enabling plugin ${pluginConfigEntry.name} from candidate paths: ${searchPaths.join(",")}`);
|
|
183960
|
-
if (!pluginConfigEntry.name ||
|
|
184058
|
+
if (!pluginConfigEntry.name || isExternalModuleNameRelative(pluginConfigEntry.name) || /[\\/]\.\.?($|[\\/])/.test(pluginConfigEntry.name)) {
|
|
183961
184059
|
this.logger.info(`Skipped loading plugin ${pluginConfigEntry.name || JSON.stringify(pluginConfigEntry)} because only package name is allowed plugin name`);
|
|
183962
184060
|
return;
|
|
183963
184061
|
}
|
|
@@ -190483,6 +190581,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
190483
190581
|
isBindingOrAssignmentPattern,
|
|
190484
190582
|
isBindingPattern,
|
|
190485
190583
|
isBlock,
|
|
190584
|
+
isBlockLike,
|
|
190486
190585
|
isBlockOrCatchScoped,
|
|
190487
190586
|
isBlockScope,
|
|
190488
190587
|
isBlockScopedContainerTopLevel,
|
package/lib/typescript.d.ts
CHANGED
package/lib/typescript.js
CHANGED
|
@@ -34,8 +34,8 @@ var ts = (() => {
|
|
|
34
34
|
var init_corePublic = __esm({
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
|
-
versionMajorMinor = "5.
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
37
|
+
versionMajorMinor = "5.5";
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20240221`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -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, signature) || noTypePredicate;
|
|
58524
|
+
} else {
|
|
58525
|
+
signature.resolvedTypePredicate = noTypePredicate;
|
|
58526
|
+
}
|
|
58519
58527
|
}
|
|
58520
58528
|
Debug.assert(!!signature.resolvedTypePredicate);
|
|
58521
58529
|
}
|
|
@@ -76924,6 +76932,89 @@ ${lanes.join("\n")}
|
|
|
76924
76932
|
return false;
|
|
76925
76933
|
}
|
|
76926
76934
|
}
|
|
76935
|
+
function getTypePredicateFromBody(func, _sig) {
|
|
76936
|
+
const functionFlags = getFunctionFlags(func);
|
|
76937
|
+
if (functionFlags !== 0 /* Normal */)
|
|
76938
|
+
return void 0;
|
|
76939
|
+
let singleReturn;
|
|
76940
|
+
if (func.body && func.body.kind !== 241 /* Block */) {
|
|
76941
|
+
singleReturn = func.body;
|
|
76942
|
+
} else {
|
|
76943
|
+
if (functionHasImplicitReturn(func))
|
|
76944
|
+
return void 0;
|
|
76945
|
+
const bailedEarly = forEachReturnStatement(func.body, (returnStatement) => {
|
|
76946
|
+
if (singleReturn || !returnStatement.expression)
|
|
76947
|
+
return true;
|
|
76948
|
+
singleReturn = returnStatement.expression;
|
|
76949
|
+
});
|
|
76950
|
+
if (bailedEarly || !singleReturn)
|
|
76951
|
+
return void 0;
|
|
76952
|
+
}
|
|
76953
|
+
const predicate = checkIfExpressionRefinesAnyParameter(singleReturn);
|
|
76954
|
+
if (predicate) {
|
|
76955
|
+
const [i, type] = predicate;
|
|
76956
|
+
const param = func.parameters[i];
|
|
76957
|
+
if (isIdentifier(param.name)) {
|
|
76958
|
+
return createTypePredicate(1 /* Identifier */, param.name.escapedText, i, type);
|
|
76959
|
+
}
|
|
76960
|
+
}
|
|
76961
|
+
return void 0;
|
|
76962
|
+
function checkIfExpressionRefinesAnyParameter(expr) {
|
|
76963
|
+
expr = skipParentheses(
|
|
76964
|
+
expr,
|
|
76965
|
+
/*excludeJSDocTypeAssertions*/
|
|
76966
|
+
true
|
|
76967
|
+
);
|
|
76968
|
+
const type = checkExpressionCached(expr, 64 /* TypeOnly */);
|
|
76969
|
+
if (type !== booleanType || !func.body)
|
|
76970
|
+
return void 0;
|
|
76971
|
+
return forEach(func.parameters, (param, i) => {
|
|
76972
|
+
const initType = getSymbolLinks(param.symbol).type;
|
|
76973
|
+
if (!initType || initType === booleanType || isSymbolAssigned(param.symbol)) {
|
|
76974
|
+
return;
|
|
76975
|
+
}
|
|
76976
|
+
const trueType2 = checkIfExpressionRefinesParameter(
|
|
76977
|
+
expr,
|
|
76978
|
+
param,
|
|
76979
|
+
initType,
|
|
76980
|
+
/*forceFullCheck*/
|
|
76981
|
+
false
|
|
76982
|
+
);
|
|
76983
|
+
if (trueType2) {
|
|
76984
|
+
const trueSubtype = checkIfExpressionRefinesParameter(
|
|
76985
|
+
expr,
|
|
76986
|
+
param,
|
|
76987
|
+
trueType2,
|
|
76988
|
+
/*forceFullCheck*/
|
|
76989
|
+
true
|
|
76990
|
+
);
|
|
76991
|
+
if (trueSubtype) {
|
|
76992
|
+
return [i, trueType2];
|
|
76993
|
+
}
|
|
76994
|
+
}
|
|
76995
|
+
});
|
|
76996
|
+
}
|
|
76997
|
+
function checkIfExpressionRefinesParameter(expr, param, initType, forceFullCheck) {
|
|
76998
|
+
const antecedent = expr.flowNode ?? { flags: 2 /* Start */ };
|
|
76999
|
+
const trueCondition = {
|
|
77000
|
+
flags: 32 /* TrueCondition */,
|
|
77001
|
+
node: expr,
|
|
77002
|
+
antecedent
|
|
77003
|
+
};
|
|
77004
|
+
const trueType2 = getFlowTypeOfReference(param.name, initType, initType, func, trueCondition);
|
|
77005
|
+
if (trueType2 === initType && !forceFullCheck)
|
|
77006
|
+
return void 0;
|
|
77007
|
+
const falseCondition = {
|
|
77008
|
+
...trueCondition,
|
|
77009
|
+
flags: 64 /* FalseCondition */
|
|
77010
|
+
};
|
|
77011
|
+
const falseType2 = getFlowTypeOfReference(param.name, initType, initType, func, falseCondition);
|
|
77012
|
+
const candidateFalse = filterType(initType, (t) => !isTypeSubtypeOf(t, trueType2));
|
|
77013
|
+
if (isTypeIdenticalTo(candidateFalse, falseType2)) {
|
|
77014
|
+
return trueType2;
|
|
77015
|
+
}
|
|
77016
|
+
}
|
|
77017
|
+
}
|
|
76927
77018
|
function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {
|
|
76928
77019
|
addLazyDiagnostic(checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics);
|
|
76929
77020
|
return;
|
|
@@ -79528,20 +79619,17 @@ ${lanes.join("\n")}
|
|
|
79528
79619
|
const objectType = type.objectType;
|
|
79529
79620
|
const indexType = type.indexType;
|
|
79530
79621
|
const objectIndexType = isGenericMappedType(objectType) && getMappedTypeNameTypeKind(objectType) === 2 /* Remapping */ ? getIndexTypeForMappedType(objectType, 0 /* None */) : getIndexType(objectType, 0 /* None */);
|
|
79531
|
-
|
|
79622
|
+
const hasNumberIndexInfo = !!getIndexInfoOfType(objectType, numberType);
|
|
79623
|
+
if (everyType(indexType, (t) => isTypeAssignableTo(t, objectIndexType) || hasNumberIndexInfo && isApplicableIndexType(t, numberType))) {
|
|
79532
79624
|
if (accessNode.kind === 212 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
|
|
79533
79625
|
error2(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
79534
79626
|
}
|
|
79535
79627
|
return type;
|
|
79536
79628
|
}
|
|
79537
|
-
const apparentObjectType = getApparentType(objectType);
|
|
79538
|
-
if (getIndexInfoOfType(apparentObjectType, numberType) && isTypeAssignableToKind(indexType, 296 /* NumberLike */)) {
|
|
79539
|
-
return type;
|
|
79540
|
-
}
|
|
79541
79629
|
if (isGenericObjectType(objectType)) {
|
|
79542
79630
|
const propertyName = getPropertyNameFromIndex(indexType, accessNode);
|
|
79543
79631
|
if (propertyName) {
|
|
79544
|
-
const propertySymbol = forEachType(
|
|
79632
|
+
const propertySymbol = forEachType(getApparentType(objectType), (t) => getPropertyOfType(t, propertyName));
|
|
79545
79633
|
if (propertySymbol && getDeclarationModifierFlagsFromSymbol(propertySymbol) & 6 /* NonPublicAccessibilityModifier */) {
|
|
79546
79634
|
error2(accessNode, Diagnostics.Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter, unescapeLeadingUnderscores(propertyName));
|
|
79547
79635
|
return errorType;
|
|
@@ -133720,6 +133808,17 @@ ${lanes.join("\n")}
|
|
|
133720
133808
|
}
|
|
133721
133809
|
return preferRequire;
|
|
133722
133810
|
}
|
|
133811
|
+
function isBlockLike(node) {
|
|
133812
|
+
switch (node.kind) {
|
|
133813
|
+
case 241 /* Block */:
|
|
133814
|
+
case 312 /* SourceFile */:
|
|
133815
|
+
case 268 /* ModuleBlock */:
|
|
133816
|
+
case 296 /* CaseClause */:
|
|
133817
|
+
return true;
|
|
133818
|
+
default:
|
|
133819
|
+
return false;
|
|
133820
|
+
}
|
|
133821
|
+
}
|
|
133723
133822
|
var scanner, SemanticMeaning, tripleSlashDirectivePrefixRegex, typeKeywords, QuotePreference, displayPartWriter, lineFeed2, ANONYMOUS, syntaxMayBeASICandidate;
|
|
133724
133823
|
var init_utilities4 = __esm({
|
|
133725
133824
|
"src/services/utilities.ts"() {
|
|
@@ -140165,6 +140264,14 @@ ${lanes.join("\n")}
|
|
|
140165
140264
|
if (!interactiveRefactorArguments) {
|
|
140166
140265
|
return emptyArray;
|
|
140167
140266
|
}
|
|
140267
|
+
if (context.endPosition !== void 0) {
|
|
140268
|
+
const file = context.file;
|
|
140269
|
+
const startNodeAncestor = findAncestor(getTokenAtPosition(file, context.startPosition), isBlockLike);
|
|
140270
|
+
const endNodeAncestor = findAncestor(getTokenAtPosition(file, context.endPosition), isBlockLike);
|
|
140271
|
+
if (startNodeAncestor && !isSourceFile(startNodeAncestor) && endNodeAncestor && !isSourceFile(endNodeAncestor)) {
|
|
140272
|
+
return emptyArray;
|
|
140273
|
+
}
|
|
140274
|
+
}
|
|
140168
140275
|
if (context.preferences.allowTextChangesInNewFiles && statements) {
|
|
140169
140276
|
return [{ name: refactorNameForMoveToFile, description: description2, actions: [moveToFileAction] }];
|
|
140170
140277
|
}
|
|
@@ -143324,17 +143431,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
143324
143431
|
}
|
|
143325
143432
|
return true;
|
|
143326
143433
|
}
|
|
143327
|
-
function isBlockLike(node) {
|
|
143328
|
-
switch (node.kind) {
|
|
143329
|
-
case 241 /* Block */:
|
|
143330
|
-
case 312 /* SourceFile */:
|
|
143331
|
-
case 268 /* ModuleBlock */:
|
|
143332
|
-
case 296 /* CaseClause */:
|
|
143333
|
-
return true;
|
|
143334
|
-
default:
|
|
143335
|
-
return false;
|
|
143336
|
-
}
|
|
143337
|
-
}
|
|
143338
143434
|
function isInJSXContent(node) {
|
|
143339
143435
|
return isStringLiteralJsxAttribute(node) || (isJsxElement(node) || isJsxSelfClosingElement(node) || isJsxFragment(node)) && (isJsxElement(node.parent) || isJsxFragment(node.parent));
|
|
143340
143436
|
}
|
|
@@ -181278,7 +181374,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
181278
181374
|
return;
|
|
181279
181375
|
}
|
|
181280
181376
|
this.logger.info(`Enabling plugin ${pluginConfigEntry.name} from candidate paths: ${searchPaths.join(",")}`);
|
|
181281
|
-
if (!pluginConfigEntry.name ||
|
|
181377
|
+
if (!pluginConfigEntry.name || isExternalModuleNameRelative(pluginConfigEntry.name) || /[\\/]\.\.?($|[\\/])/.test(pluginConfigEntry.name)) {
|
|
181282
181378
|
this.logger.info(`Skipped loading plugin ${pluginConfigEntry.name || JSON.stringify(pluginConfigEntry)} because only package name is allowed plugin name`);
|
|
181283
181379
|
return;
|
|
181284
181380
|
}
|
|
@@ -187245,6 +187341,7 @@ ${e.message}`;
|
|
|
187245
187341
|
isBindingOrAssignmentPattern: () => isBindingOrAssignmentPattern,
|
|
187246
187342
|
isBindingPattern: () => isBindingPattern,
|
|
187247
187343
|
isBlock: () => isBlock,
|
|
187344
|
+
isBlockLike: () => isBlockLike,
|
|
187248
187345
|
isBlockOrCatchScoped: () => isBlockOrCatchScoped,
|
|
187249
187346
|
isBlockScope: () => isBlockScope,
|
|
187250
187347
|
isBlockScopedContainerTopLevel: () => isBlockScopedContainerTopLevel,
|
|
@@ -189666,6 +189763,7 @@ ${e.message}`;
|
|
|
189666
189763
|
isBindingOrAssignmentPattern: () => isBindingOrAssignmentPattern,
|
|
189667
189764
|
isBindingPattern: () => isBindingPattern,
|
|
189668
189765
|
isBlock: () => isBlock,
|
|
189766
|
+
isBlockLike: () => isBlockLike,
|
|
189669
189767
|
isBlockOrCatchScoped: () => isBlockOrCatchScoped,
|
|
189670
189768
|
isBlockScope: () => isBlockScope,
|
|
189671
189769
|
isBlockScopedContainerTopLevel: () => isBlockScopedContainerTopLevel,
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -53,8 +53,8 @@ var fs = __toESM(require("fs"));
|
|
|
53
53
|
var path = __toESM(require("path"));
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
|
-
var versionMajorMinor = "5.
|
|
57
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
56
|
+
var versionMajorMinor = "5.5";
|
|
57
|
+
var version = `${versionMajorMinor}.0-insiders.20240221`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
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
|
+
"version": "5.5.0-pr-57465-17",
|
|
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": "ef7996632fbbd9382ba181bef671a581e4bea069"
|
|
118
118
|
}
|