@typescript-deploys/pr-build 5.4.0-pr-57358-23 → 5.4.0-pr-55842-26
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 +43 -41
- package/lib/tsserver.js +130 -157
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +130 -157
- package/lib/typingsInstaller.js +2 -2
- 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.4";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240214`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -32496,7 +32496,7 @@ var Parser;
|
|
|
32496
32496
|
if (!jsDocDiagnostics) {
|
|
32497
32497
|
jsDocDiagnostics = [];
|
|
32498
32498
|
}
|
|
32499
|
-
jsDocDiagnostics
|
|
32499
|
+
addRange(jsDocDiagnostics, parseDiagnostics, saveParseDiagnosticsLength);
|
|
32500
32500
|
}
|
|
32501
32501
|
currentToken = saveToken;
|
|
32502
32502
|
parseDiagnostics.length = saveParseDiagnosticsLength;
|
|
@@ -58408,6 +58408,9 @@ function createTypeChecker(host) {
|
|
|
58408
58408
|
if (objectType.flags & (1 /* Any */ | 131072 /* Never */)) {
|
|
58409
58409
|
return objectType;
|
|
58410
58410
|
}
|
|
58411
|
+
if (indexType === neverType) {
|
|
58412
|
+
return neverType;
|
|
58413
|
+
}
|
|
58411
58414
|
const indexInfo = getApplicableIndexInfo(objectType, indexType) || getIndexInfoOfType(objectType, stringType);
|
|
58412
58415
|
if (indexInfo) {
|
|
58413
58416
|
if (accessFlags & 2 /* NoIndexSignatures */ && indexInfo.keyType !== numberType) {
|
|
@@ -58431,9 +58434,6 @@ function createTypeChecker(host) {
|
|
|
58431
58434
|
}
|
|
58432
58435
|
return indexInfo.type;
|
|
58433
58436
|
}
|
|
58434
|
-
if (indexType.flags & 131072 /* Never */) {
|
|
58435
|
-
return neverType;
|
|
58436
|
-
}
|
|
58437
58437
|
if (isJSLiteralType(objectType)) {
|
|
58438
58438
|
return anyType;
|
|
58439
58439
|
}
|
|
@@ -65650,7 +65650,7 @@ function createTypeChecker(host) {
|
|
|
65650
65650
|
function hasMatchingArgument(expression, reference) {
|
|
65651
65651
|
if (expression.arguments) {
|
|
65652
65652
|
for (const argument of expression.arguments) {
|
|
65653
|
-
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference)) {
|
|
65653
|
+
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference) || getCandidateDiscriminantPropertyAccess(argument, reference)) {
|
|
65654
65654
|
return true;
|
|
65655
65655
|
}
|
|
65656
65656
|
}
|
|
@@ -65660,6 +65660,36 @@ function createTypeChecker(host) {
|
|
|
65660
65660
|
}
|
|
65661
65661
|
return false;
|
|
65662
65662
|
}
|
|
65663
|
+
function getCandidateDiscriminantPropertyAccess(expr, reference) {
|
|
65664
|
+
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
|
|
65665
|
+
if (isIdentifier(expr)) {
|
|
65666
|
+
const symbol = getResolvedSymbol(expr);
|
|
65667
|
+
const declaration = symbol.valueDeclaration;
|
|
65668
|
+
if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
|
|
65669
|
+
return declaration;
|
|
65670
|
+
}
|
|
65671
|
+
}
|
|
65672
|
+
} else if (isAccessExpression(expr)) {
|
|
65673
|
+
if (isMatchingReference(reference, expr.expression)) {
|
|
65674
|
+
return expr;
|
|
65675
|
+
}
|
|
65676
|
+
} else if (isIdentifier(expr)) {
|
|
65677
|
+
const symbol = getResolvedSymbol(expr);
|
|
65678
|
+
if (isConstantVariable(symbol)) {
|
|
65679
|
+
const declaration = symbol.valueDeclaration;
|
|
65680
|
+
if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
|
|
65681
|
+
return declaration.initializer;
|
|
65682
|
+
}
|
|
65683
|
+
if (isBindingElement(declaration) && !declaration.initializer) {
|
|
65684
|
+
const parent = declaration.parent.parent;
|
|
65685
|
+
if (isVariableDeclaration(parent) && !parent.type && parent.initializer && (isIdentifier(parent.initializer) || isAccessExpression(parent.initializer)) && isMatchingReference(reference, parent.initializer)) {
|
|
65686
|
+
return declaration;
|
|
65687
|
+
}
|
|
65688
|
+
}
|
|
65689
|
+
}
|
|
65690
|
+
}
|
|
65691
|
+
return void 0;
|
|
65692
|
+
}
|
|
65663
65693
|
function getFlowNodeId(flow) {
|
|
65664
65694
|
if (!flow.id || flow.id < 0) {
|
|
65665
65695
|
flow.id = nextFlowId;
|
|
@@ -66759,39 +66789,9 @@ function createTypeChecker(host) {
|
|
|
66759
66789
|
}
|
|
66760
66790
|
return result;
|
|
66761
66791
|
}
|
|
66762
|
-
function getCandidateDiscriminantPropertyAccess(expr) {
|
|
66763
|
-
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
|
|
66764
|
-
if (isIdentifier(expr)) {
|
|
66765
|
-
const symbol = getResolvedSymbol(expr);
|
|
66766
|
-
const declaration = symbol.valueDeclaration;
|
|
66767
|
-
if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
|
|
66768
|
-
return declaration;
|
|
66769
|
-
}
|
|
66770
|
-
}
|
|
66771
|
-
} else if (isAccessExpression(expr)) {
|
|
66772
|
-
if (isMatchingReference(reference, expr.expression)) {
|
|
66773
|
-
return expr;
|
|
66774
|
-
}
|
|
66775
|
-
} else if (isIdentifier(expr)) {
|
|
66776
|
-
const symbol = getResolvedSymbol(expr);
|
|
66777
|
-
if (isConstantVariable(symbol)) {
|
|
66778
|
-
const declaration = symbol.valueDeclaration;
|
|
66779
|
-
if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
|
|
66780
|
-
return declaration.initializer;
|
|
66781
|
-
}
|
|
66782
|
-
if (isBindingElement(declaration) && !declaration.initializer) {
|
|
66783
|
-
const parent = declaration.parent.parent;
|
|
66784
|
-
if (isVariableDeclaration(parent) && !parent.type && parent.initializer && (isIdentifier(parent.initializer) || isAccessExpression(parent.initializer)) && isMatchingReference(reference, parent.initializer)) {
|
|
66785
|
-
return declaration;
|
|
66786
|
-
}
|
|
66787
|
-
}
|
|
66788
|
-
}
|
|
66789
|
-
}
|
|
66790
|
-
return void 0;
|
|
66791
|
-
}
|
|
66792
66792
|
function getDiscriminantPropertyAccess(expr, computedType) {
|
|
66793
66793
|
if (declaredType.flags & 1048576 /* Union */ || computedType.flags & 1048576 /* Union */) {
|
|
66794
|
-
const access = getCandidateDiscriminantPropertyAccess(expr);
|
|
66794
|
+
const access = getCandidateDiscriminantPropertyAccess(expr, reference);
|
|
66795
66795
|
if (access) {
|
|
66796
66796
|
const name = getAccessedPropertyName(access);
|
|
66797
66797
|
if (name) {
|
|
@@ -67337,10 +67337,12 @@ function createTypeChecker(host) {
|
|
|
67337
67337
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
67338
67338
|
}
|
|
67339
67339
|
function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
|
|
67340
|
-
|
|
67341
|
-
|
|
67342
|
-
|
|
67343
|
-
|
|
67340
|
+
if (hasMatchingArgument(callExpression, reference)) {
|
|
67341
|
+
const signature = assumeTrue || !isCallChain(callExpression) ? getEffectsSignature(callExpression) : void 0;
|
|
67342
|
+
const predicate = signature && getTypePredicateOfSignature(signature);
|
|
67343
|
+
if (predicate && (predicate.kind === 0 /* This */ || predicate.kind === 1 /* Identifier */)) {
|
|
67344
|
+
return narrowTypeByTypePredicate(type, predicate, callExpression, assumeTrue);
|
|
67345
|
+
}
|
|
67344
67346
|
}
|
|
67345
67347
|
if (containsMissingType(type) && isAccessExpression(reference) && isPropertyAccessExpression(callExpression.expression)) {
|
|
67346
67348
|
const callAccess = callExpression.expression;
|
package/lib/tsserver.js
CHANGED
|
@@ -2340,7 +2340,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2340
2340
|
|
|
2341
2341
|
// src/compiler/corePublic.ts
|
|
2342
2342
|
var versionMajorMinor = "5.4";
|
|
2343
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2343
|
+
var version = `${versionMajorMinor}.0-insiders.20240214`;
|
|
2344
2344
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2345
2345
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2346
2346
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -36931,7 +36931,7 @@ var Parser;
|
|
|
36931
36931
|
if (!jsDocDiagnostics) {
|
|
36932
36932
|
jsDocDiagnostics = [];
|
|
36933
36933
|
}
|
|
36934
|
-
jsDocDiagnostics
|
|
36934
|
+
addRange(jsDocDiagnostics, parseDiagnostics, saveParseDiagnosticsLength);
|
|
36935
36935
|
}
|
|
36936
36936
|
currentToken = saveToken;
|
|
36937
36937
|
parseDiagnostics.length = saveParseDiagnosticsLength;
|
|
@@ -63152,6 +63152,9 @@ function createTypeChecker(host) {
|
|
|
63152
63152
|
if (objectType.flags & (1 /* Any */ | 131072 /* Never */)) {
|
|
63153
63153
|
return objectType;
|
|
63154
63154
|
}
|
|
63155
|
+
if (indexType === neverType) {
|
|
63156
|
+
return neverType;
|
|
63157
|
+
}
|
|
63155
63158
|
const indexInfo = getApplicableIndexInfo(objectType, indexType) || getIndexInfoOfType(objectType, stringType);
|
|
63156
63159
|
if (indexInfo) {
|
|
63157
63160
|
if (accessFlags & 2 /* NoIndexSignatures */ && indexInfo.keyType !== numberType) {
|
|
@@ -63175,9 +63178,6 @@ function createTypeChecker(host) {
|
|
|
63175
63178
|
}
|
|
63176
63179
|
return indexInfo.type;
|
|
63177
63180
|
}
|
|
63178
|
-
if (indexType.flags & 131072 /* Never */) {
|
|
63179
|
-
return neverType;
|
|
63180
|
-
}
|
|
63181
63181
|
if (isJSLiteralType(objectType)) {
|
|
63182
63182
|
return anyType;
|
|
63183
63183
|
}
|
|
@@ -70394,7 +70394,7 @@ function createTypeChecker(host) {
|
|
|
70394
70394
|
function hasMatchingArgument(expression, reference) {
|
|
70395
70395
|
if (expression.arguments) {
|
|
70396
70396
|
for (const argument of expression.arguments) {
|
|
70397
|
-
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference)) {
|
|
70397
|
+
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference) || getCandidateDiscriminantPropertyAccess(argument, reference)) {
|
|
70398
70398
|
return true;
|
|
70399
70399
|
}
|
|
70400
70400
|
}
|
|
@@ -70404,6 +70404,36 @@ function createTypeChecker(host) {
|
|
|
70404
70404
|
}
|
|
70405
70405
|
return false;
|
|
70406
70406
|
}
|
|
70407
|
+
function getCandidateDiscriminantPropertyAccess(expr, reference) {
|
|
70408
|
+
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
|
|
70409
|
+
if (isIdentifier(expr)) {
|
|
70410
|
+
const symbol = getResolvedSymbol(expr);
|
|
70411
|
+
const declaration = symbol.valueDeclaration;
|
|
70412
|
+
if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
|
|
70413
|
+
return declaration;
|
|
70414
|
+
}
|
|
70415
|
+
}
|
|
70416
|
+
} else if (isAccessExpression(expr)) {
|
|
70417
|
+
if (isMatchingReference(reference, expr.expression)) {
|
|
70418
|
+
return expr;
|
|
70419
|
+
}
|
|
70420
|
+
} else if (isIdentifier(expr)) {
|
|
70421
|
+
const symbol = getResolvedSymbol(expr);
|
|
70422
|
+
if (isConstantVariable(symbol)) {
|
|
70423
|
+
const declaration = symbol.valueDeclaration;
|
|
70424
|
+
if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
|
|
70425
|
+
return declaration.initializer;
|
|
70426
|
+
}
|
|
70427
|
+
if (isBindingElement(declaration) && !declaration.initializer) {
|
|
70428
|
+
const parent2 = declaration.parent.parent;
|
|
70429
|
+
if (isVariableDeclaration(parent2) && !parent2.type && parent2.initializer && (isIdentifier(parent2.initializer) || isAccessExpression(parent2.initializer)) && isMatchingReference(reference, parent2.initializer)) {
|
|
70430
|
+
return declaration;
|
|
70431
|
+
}
|
|
70432
|
+
}
|
|
70433
|
+
}
|
|
70434
|
+
}
|
|
70435
|
+
return void 0;
|
|
70436
|
+
}
|
|
70407
70437
|
function getFlowNodeId(flow) {
|
|
70408
70438
|
if (!flow.id || flow.id < 0) {
|
|
70409
70439
|
flow.id = nextFlowId;
|
|
@@ -71503,39 +71533,9 @@ function createTypeChecker(host) {
|
|
|
71503
71533
|
}
|
|
71504
71534
|
return result;
|
|
71505
71535
|
}
|
|
71506
|
-
function getCandidateDiscriminantPropertyAccess(expr) {
|
|
71507
|
-
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
|
|
71508
|
-
if (isIdentifier(expr)) {
|
|
71509
|
-
const symbol = getResolvedSymbol(expr);
|
|
71510
|
-
const declaration = symbol.valueDeclaration;
|
|
71511
|
-
if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
|
|
71512
|
-
return declaration;
|
|
71513
|
-
}
|
|
71514
|
-
}
|
|
71515
|
-
} else if (isAccessExpression(expr)) {
|
|
71516
|
-
if (isMatchingReference(reference, expr.expression)) {
|
|
71517
|
-
return expr;
|
|
71518
|
-
}
|
|
71519
|
-
} else if (isIdentifier(expr)) {
|
|
71520
|
-
const symbol = getResolvedSymbol(expr);
|
|
71521
|
-
if (isConstantVariable(symbol)) {
|
|
71522
|
-
const declaration = symbol.valueDeclaration;
|
|
71523
|
-
if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
|
|
71524
|
-
return declaration.initializer;
|
|
71525
|
-
}
|
|
71526
|
-
if (isBindingElement(declaration) && !declaration.initializer) {
|
|
71527
|
-
const parent2 = declaration.parent.parent;
|
|
71528
|
-
if (isVariableDeclaration(parent2) && !parent2.type && parent2.initializer && (isIdentifier(parent2.initializer) || isAccessExpression(parent2.initializer)) && isMatchingReference(reference, parent2.initializer)) {
|
|
71529
|
-
return declaration;
|
|
71530
|
-
}
|
|
71531
|
-
}
|
|
71532
|
-
}
|
|
71533
|
-
}
|
|
71534
|
-
return void 0;
|
|
71535
|
-
}
|
|
71536
71536
|
function getDiscriminantPropertyAccess(expr, computedType) {
|
|
71537
71537
|
if (declaredType.flags & 1048576 /* Union */ || computedType.flags & 1048576 /* Union */) {
|
|
71538
|
-
const access = getCandidateDiscriminantPropertyAccess(expr);
|
|
71538
|
+
const access = getCandidateDiscriminantPropertyAccess(expr, reference);
|
|
71539
71539
|
if (access) {
|
|
71540
71540
|
const name = getAccessedPropertyName(access);
|
|
71541
71541
|
if (name) {
|
|
@@ -72081,10 +72081,12 @@ function createTypeChecker(host) {
|
|
|
72081
72081
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
72082
72082
|
}
|
|
72083
72083
|
function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
|
|
72084
|
-
|
|
72085
|
-
|
|
72086
|
-
|
|
72087
|
-
|
|
72084
|
+
if (hasMatchingArgument(callExpression, reference)) {
|
|
72085
|
+
const signature = assumeTrue || !isCallChain(callExpression) ? getEffectsSignature(callExpression) : void 0;
|
|
72086
|
+
const predicate = signature && getTypePredicateOfSignature(signature);
|
|
72087
|
+
if (predicate && (predicate.kind === 0 /* This */ || predicate.kind === 1 /* Identifier */)) {
|
|
72088
|
+
return narrowTypeByTypePredicate(type, predicate, callExpression, assumeTrue);
|
|
72089
|
+
}
|
|
72088
72090
|
}
|
|
72089
72091
|
if (containsMissingType(type) && isAccessExpression(reference) && isPropertyAccessExpression(callExpression.expression)) {
|
|
72090
72092
|
const callAccess = callExpression.expression;
|
|
@@ -178157,7 +178159,7 @@ var ScriptInfo = class {
|
|
|
178157
178159
|
}
|
|
178158
178160
|
break;
|
|
178159
178161
|
default:
|
|
178160
|
-
if (
|
|
178162
|
+
if (orderedRemoveItem(this.containingProjects, project)) {
|
|
178161
178163
|
project.onFileAddedOrRemoved(this.isSymlink());
|
|
178162
178164
|
}
|
|
178163
178165
|
break;
|
|
@@ -181829,7 +181831,7 @@ var _ProjectService = class _ProjectService {
|
|
|
181829
181831
|
);
|
|
181830
181832
|
project.addRoot(info);
|
|
181831
181833
|
if (info.containingProjects[0] !== project) {
|
|
181832
|
-
info.
|
|
181834
|
+
orderedRemoveItem(info.containingProjects, project);
|
|
181833
181835
|
info.containingProjects.unshift(project);
|
|
181834
181836
|
}
|
|
181835
181837
|
project.updateGraph();
|
|
@@ -182124,8 +182126,7 @@ var _ProjectService = class _ProjectService {
|
|
|
182124
182126
|
* otherwise just file name
|
|
182125
182127
|
*/
|
|
182126
182128
|
getConfigFileNameForFile(info) {
|
|
182127
|
-
if (
|
|
182128
|
-
Debug.assert(info.isScriptOpen());
|
|
182129
|
+
if (!isAncestorConfigFileInfo(info)) {
|
|
182129
182130
|
const result = this.configFileForOpenFiles.get(info.path);
|
|
182130
182131
|
if (result !== void 0)
|
|
182131
182132
|
return result || void 0;
|
|
@@ -183120,11 +183121,13 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183120
183121
|
} = this.hostConfiguration.preferences;
|
|
183121
183122
|
this.hostConfiguration.preferences = { ...this.hostConfiguration.preferences, ...args.preferences };
|
|
183122
183123
|
if (lazyConfiguredProjectsFromExternalProject && !this.hostConfiguration.preferences.lazyConfiguredProjectsFromExternalProject) {
|
|
183123
|
-
this.
|
|
183124
|
-
|
|
183125
|
-
project.
|
|
183126
|
-
|
|
183127
|
-
|
|
183124
|
+
this.externalProjectToConfiguredProjectMap.forEach(
|
|
183125
|
+
(projects) => projects.forEach((project) => {
|
|
183126
|
+
if (!project.isClosed() && project.hasExternalProjectRef() && project.pendingUpdateLevel === 2 /* Full */ && !this.pendingProjectUpdates.has(project.getProjectName())) {
|
|
183127
|
+
project.updateGraph();
|
|
183128
|
+
}
|
|
183129
|
+
})
|
|
183130
|
+
);
|
|
183128
183131
|
}
|
|
183129
183132
|
if (includePackageJsonAutoImports !== args.preferences.includePackageJsonAutoImports) {
|
|
183130
183133
|
this.forEachProject((project) => {
|
|
@@ -183709,23 +183712,20 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183709
183712
|
scriptInfo.editContent(change.span.start, change.span.start + change.span.length, change.newText);
|
|
183710
183713
|
}
|
|
183711
183714
|
}
|
|
183712
|
-
closeConfiguredProjectReferencedFromExternalProject(
|
|
183713
|
-
|
|
183714
|
-
|
|
183715
|
-
|
|
183716
|
-
|
|
183717
|
-
|
|
183718
|
-
return;
|
|
183715
|
+
closeConfiguredProjectReferencedFromExternalProject(configuredProjects) {
|
|
183716
|
+
configuredProjects == null ? void 0 : configuredProjects.forEach((configuredProject) => {
|
|
183717
|
+
if (!configuredProject.isClosed()) {
|
|
183718
|
+
configuredProject.deleteExternalProjectReference();
|
|
183719
|
+
if (!configuredProject.hasOpenRef())
|
|
183720
|
+
this.removeProject(configuredProject);
|
|
183719
183721
|
}
|
|
183720
|
-
}
|
|
183722
|
+
});
|
|
183721
183723
|
}
|
|
183722
183724
|
closeExternalProject(uncheckedFileName, print) {
|
|
183723
183725
|
const fileName = toNormalizedPath(uncheckedFileName);
|
|
183724
|
-
const
|
|
183725
|
-
if (
|
|
183726
|
-
|
|
183727
|
-
this.closeConfiguredProjectReferencedFromExternalProject(configFile);
|
|
183728
|
-
}
|
|
183726
|
+
const configuredProjects = this.externalProjectToConfiguredProjectMap.get(fileName);
|
|
183727
|
+
if (configuredProjects) {
|
|
183728
|
+
this.closeConfiguredProjectReferencedFromExternalProject(configuredProjects);
|
|
183729
183729
|
this.externalProjectToConfiguredProjectMap.delete(fileName);
|
|
183730
183730
|
} else {
|
|
183731
183731
|
const externalProject = this.findExternalProjectByProjectName(uncheckedFileName);
|
|
@@ -183765,16 +183765,18 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183765
183765
|
this.safelist = defaultTypeSafeList;
|
|
183766
183766
|
}
|
|
183767
183767
|
applySafeList(proj) {
|
|
183768
|
-
const { rootFiles } = proj;
|
|
183769
183768
|
const typeAcquisition = proj.typeAcquisition;
|
|
183770
183769
|
Debug.assert(!!typeAcquisition, "proj.typeAcquisition should be set by now");
|
|
183770
|
+
const result = this.applySafeListWorker(proj, proj.rootFiles, typeAcquisition);
|
|
183771
|
+
return (result == null ? void 0 : result.excludedFiles) ?? [];
|
|
183772
|
+
}
|
|
183773
|
+
applySafeListWorker(proj, rootFiles, typeAcquisition) {
|
|
183771
183774
|
if (typeAcquisition.enable === false || typeAcquisition.disableFilenameBasedTypeAcquisition) {
|
|
183772
|
-
return
|
|
183775
|
+
return void 0;
|
|
183773
183776
|
}
|
|
183774
183777
|
const typeAcqInclude = typeAcquisition.include || (typeAcquisition.include = []);
|
|
183775
183778
|
const excludeRules = [];
|
|
183776
183779
|
const normalizedNames = rootFiles.map((f) => normalizeSlashes(f.fileName));
|
|
183777
|
-
const excludedFiles = [];
|
|
183778
183780
|
for (const name of Object.keys(this.safelist)) {
|
|
183779
183781
|
const rule2 = this.safelist[name];
|
|
183780
183782
|
for (const root of normalizedNames) {
|
|
@@ -183815,12 +183817,12 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183815
183817
|
}
|
|
183816
183818
|
}
|
|
183817
183819
|
const excludeRegexes = excludeRules.map((e) => new RegExp(e, "i"));
|
|
183818
|
-
|
|
183819
|
-
|
|
183820
|
+
let filesToKeep;
|
|
183821
|
+
let excludedFiles;
|
|
183822
|
+
for (let i = 0; i < rootFiles.length; i++) {
|
|
183820
183823
|
if (excludeRegexes.some((re) => re.test(normalizedNames[i]))) {
|
|
183821
|
-
|
|
183824
|
+
addExcludedFile(i);
|
|
183822
183825
|
} else {
|
|
183823
|
-
let exclude = false;
|
|
183824
183826
|
if (typeAcquisition.enable) {
|
|
183825
183827
|
const baseName = getBaseFileName(toFileNameLowerCase(normalizedNames[i]));
|
|
183826
183828
|
if (fileExtensionIs(baseName, "js")) {
|
|
@@ -183829,120 +183831,91 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183829
183831
|
const typeName = this.legacySafelist.get(cleanedTypingName);
|
|
183830
183832
|
if (typeName !== void 0) {
|
|
183831
183833
|
this.logger.info(`Excluded '${normalizedNames[i]}' because it matched ${cleanedTypingName} from the legacy safelist`);
|
|
183832
|
-
|
|
183833
|
-
exclude = true;
|
|
183834
|
+
addExcludedFile(i);
|
|
183834
183835
|
if (!typeAcqInclude.includes(typeName)) {
|
|
183835
183836
|
typeAcqInclude.push(typeName);
|
|
183836
183837
|
}
|
|
183838
|
+
continue;
|
|
183837
183839
|
}
|
|
183838
183840
|
}
|
|
183839
183841
|
}
|
|
183840
|
-
if (
|
|
183841
|
-
|
|
183842
|
-
|
|
183843
|
-
|
|
183844
|
-
filesToKeep.push(proj.rootFiles[i]);
|
|
183845
|
-
}
|
|
183842
|
+
if (/^.+[.-]min\.js$/.test(normalizedNames[i])) {
|
|
183843
|
+
addExcludedFile(i);
|
|
183844
|
+
} else {
|
|
183845
|
+
filesToKeep == null ? void 0 : filesToKeep.push(rootFiles[i]);
|
|
183846
183846
|
}
|
|
183847
183847
|
}
|
|
183848
183848
|
}
|
|
183849
|
-
|
|
183850
|
-
|
|
183849
|
+
return excludedFiles ? {
|
|
183850
|
+
rootFiles: filesToKeep,
|
|
183851
|
+
excludedFiles
|
|
183852
|
+
} : void 0;
|
|
183853
|
+
function addExcludedFile(index) {
|
|
183854
|
+
if (!excludedFiles) {
|
|
183855
|
+
Debug.assert(!filesToKeep);
|
|
183856
|
+
filesToKeep = rootFiles.slice(0, index);
|
|
183857
|
+
excludedFiles = [];
|
|
183858
|
+
}
|
|
183859
|
+
excludedFiles.push(normalizedNames[index]);
|
|
183860
|
+
}
|
|
183851
183861
|
}
|
|
183852
183862
|
openExternalProject(proj, print) {
|
|
183853
|
-
|
|
183854
|
-
|
|
183855
|
-
|
|
183856
|
-
|
|
183857
|
-
proj.typeAcquisition.enable = hasNoTypeScriptSource(proj.rootFiles.map((f) => f.fileName));
|
|
183858
|
-
}
|
|
183859
|
-
const excludedFiles = this.applySafeList(proj);
|
|
183860
|
-
let tsConfigFiles;
|
|
183861
|
-
const rootFiles = [];
|
|
183863
|
+
const existingExternalProject = this.findExternalProjectByProjectName(proj.projectFileName);
|
|
183864
|
+
const existingConfiguredProjects = this.externalProjectToConfiguredProjectMap.get(proj.projectFileName);
|
|
183865
|
+
let configuredProjects;
|
|
183866
|
+
let rootFiles = [];
|
|
183862
183867
|
for (const file of proj.rootFiles) {
|
|
183863
183868
|
const normalized = toNormalizedPath(file.fileName);
|
|
183864
183869
|
if (getBaseConfigFileName(normalized)) {
|
|
183865
183870
|
if (this.serverMode === 0 /* Semantic */ && this.host.fileExists(normalized)) {
|
|
183866
|
-
|
|
183871
|
+
let project = this.findConfiguredProjectByProjectName(normalized);
|
|
183872
|
+
if (!project) {
|
|
183873
|
+
project = this.getHostPreferences().lazyConfiguredProjectsFromExternalProject ? this.createConfiguredProjectWithDelayLoad(normalized, `Creating configured project in external project: ${proj.projectFileName}`) : this.createLoadAndUpdateConfiguredProject(normalized, `Creating configured project in external project: ${proj.projectFileName}`);
|
|
183874
|
+
}
|
|
183875
|
+
if (!(existingConfiguredProjects == null ? void 0 : existingConfiguredProjects.has(project))) {
|
|
183876
|
+
project.addExternalProjectReference();
|
|
183877
|
+
}
|
|
183878
|
+
(configuredProjects ?? (configuredProjects = /* @__PURE__ */ new Set())).add(project);
|
|
183879
|
+
existingConfiguredProjects == null ? void 0 : existingConfiguredProjects.delete(project);
|
|
183867
183880
|
}
|
|
183868
183881
|
} else {
|
|
183869
183882
|
rootFiles.push(file);
|
|
183870
183883
|
}
|
|
183871
183884
|
}
|
|
183872
|
-
if (
|
|
183873
|
-
|
|
183874
|
-
|
|
183875
|
-
|
|
183876
|
-
|
|
183877
|
-
|
|
183878
|
-
|
|
183879
|
-
|
|
183885
|
+
if (configuredProjects) {
|
|
183886
|
+
this.externalProjectToConfiguredProjectMap.set(proj.projectFileName, configuredProjects);
|
|
183887
|
+
if (existingExternalProject)
|
|
183888
|
+
this.removeProject(existingExternalProject);
|
|
183889
|
+
} else {
|
|
183890
|
+
this.externalProjectToConfiguredProjectMap.delete(proj.projectFileName);
|
|
183891
|
+
const typeAcquisition = proj.typeAcquisition || {};
|
|
183892
|
+
typeAcquisition.include = typeAcquisition.include || [];
|
|
183893
|
+
typeAcquisition.exclude = typeAcquisition.exclude || [];
|
|
183894
|
+
if (typeAcquisition.enable === void 0) {
|
|
183895
|
+
typeAcquisition.enable = hasNoTypeScriptSource(rootFiles.map((f) => f.fileName));
|
|
183896
|
+
}
|
|
183897
|
+
const excludeResult = this.applySafeListWorker(proj, rootFiles, typeAcquisition);
|
|
183898
|
+
const excludedFiles = (excludeResult == null ? void 0 : excludeResult.excludedFiles) ?? [];
|
|
183899
|
+
rootFiles = (excludeResult == null ? void 0 : excludeResult.rootFiles) ?? rootFiles;
|
|
183900
|
+
if (existingExternalProject) {
|
|
183901
|
+
existingExternalProject.excludedFiles = excludedFiles;
|
|
183880
183902
|
const compilerOptions = convertCompilerOptions(proj.options);
|
|
183881
|
-
const watchOptionsAndErrors = convertWatchOptions(proj.options,
|
|
183882
|
-
const lastFileExceededProgramSize = this.getFilenameForExceededTotalSizeLimitForNonTsFiles(proj.projectFileName, compilerOptions,
|
|
183903
|
+
const watchOptionsAndErrors = convertWatchOptions(proj.options, existingExternalProject.getCurrentDirectory());
|
|
183904
|
+
const lastFileExceededProgramSize = this.getFilenameForExceededTotalSizeLimitForNonTsFiles(proj.projectFileName, compilerOptions, rootFiles, externalFilePropertyReader);
|
|
183883
183905
|
if (lastFileExceededProgramSize) {
|
|
183884
|
-
|
|
183906
|
+
existingExternalProject.disableLanguageService(lastFileExceededProgramSize);
|
|
183885
183907
|
} else {
|
|
183886
|
-
|
|
183908
|
+
existingExternalProject.enableLanguageService();
|
|
183887
183909
|
}
|
|
183888
|
-
|
|
183889
|
-
this.updateRootAndOptionsOfNonInferredProject(
|
|
183890
|
-
|
|
183891
|
-
if (print)
|
|
183892
|
-
this.printProjects();
|
|
183893
|
-
return;
|
|
183894
|
-
}
|
|
183895
|
-
this.closeExternalProject(
|
|
183896
|
-
proj.projectFileName,
|
|
183897
|
-
/*print*/
|
|
183898
|
-
false
|
|
183899
|
-
);
|
|
183900
|
-
} else if (this.externalProjectToConfiguredProjectMap.get(proj.projectFileName)) {
|
|
183901
|
-
if (!tsConfigFiles) {
|
|
183902
|
-
this.closeExternalProject(
|
|
183903
|
-
proj.projectFileName,
|
|
183904
|
-
/*print*/
|
|
183905
|
-
false
|
|
183906
|
-
);
|
|
183910
|
+
existingExternalProject.setProjectErrors(watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.errors);
|
|
183911
|
+
this.updateRootAndOptionsOfNonInferredProject(existingExternalProject, rootFiles, externalFilePropertyReader, compilerOptions, typeAcquisition, proj.options.compileOnSave, watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions);
|
|
183912
|
+
existingExternalProject.updateGraph();
|
|
183907
183913
|
} else {
|
|
183908
|
-
const
|
|
183909
|
-
|
|
183910
|
-
let iOld = 0;
|
|
183911
|
-
while (iNew < tsConfigFiles.length && iOld < oldConfigFiles.length) {
|
|
183912
|
-
const newConfig = tsConfigFiles[iNew];
|
|
183913
|
-
const oldConfig = oldConfigFiles[iOld];
|
|
183914
|
-
if (oldConfig < newConfig) {
|
|
183915
|
-
this.closeConfiguredProjectReferencedFromExternalProject(oldConfig);
|
|
183916
|
-
iOld++;
|
|
183917
|
-
} else if (oldConfig > newConfig) {
|
|
183918
|
-
iNew++;
|
|
183919
|
-
} else {
|
|
183920
|
-
(exisingConfigFiles || (exisingConfigFiles = [])).push(oldConfig);
|
|
183921
|
-
iOld++;
|
|
183922
|
-
iNew++;
|
|
183923
|
-
}
|
|
183924
|
-
}
|
|
183925
|
-
for (let i = iOld; i < oldConfigFiles.length; i++) {
|
|
183926
|
-
this.closeConfiguredProjectReferencedFromExternalProject(oldConfigFiles[i]);
|
|
183927
|
-
}
|
|
183914
|
+
const project = this.createExternalProject(proj.projectFileName, rootFiles, proj.options, typeAcquisition, excludedFiles);
|
|
183915
|
+
project.updateGraph();
|
|
183928
183916
|
}
|
|
183929
183917
|
}
|
|
183930
|
-
|
|
183931
|
-
this.externalProjectToConfiguredProjectMap.set(proj.projectFileName, tsConfigFiles);
|
|
183932
|
-
for (const tsconfigFile of tsConfigFiles) {
|
|
183933
|
-
let project = this.findConfiguredProjectByProjectName(tsconfigFile);
|
|
183934
|
-
if (!project) {
|
|
183935
|
-
project = this.getHostPreferences().lazyConfiguredProjectsFromExternalProject ? this.createConfiguredProjectWithDelayLoad(tsconfigFile, `Creating configured project in external project: ${proj.projectFileName}`) : this.createLoadAndUpdateConfiguredProject(tsconfigFile, `Creating configured project in external project: ${proj.projectFileName}`);
|
|
183936
|
-
}
|
|
183937
|
-
if (project && !contains(exisingConfigFiles, tsconfigFile)) {
|
|
183938
|
-
project.addExternalProjectReference();
|
|
183939
|
-
}
|
|
183940
|
-
}
|
|
183941
|
-
} else {
|
|
183942
|
-
this.externalProjectToConfiguredProjectMap.delete(proj.projectFileName);
|
|
183943
|
-
const project = this.createExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition, excludedFiles);
|
|
183944
|
-
project.updateGraph();
|
|
183945
|
-
}
|
|
183918
|
+
this.closeConfiguredProjectReferencedFromExternalProject(existingConfiguredProjects);
|
|
183946
183919
|
if (print)
|
|
183947
183920
|
this.printProjects();
|
|
183948
183921
|
}
|
package/lib/typescript.d.ts
CHANGED
|
@@ -3906,6 +3906,7 @@ declare namespace ts {
|
|
|
3906
3906
|
private static escapeFilenameForRegex;
|
|
3907
3907
|
resetSafeList(): void;
|
|
3908
3908
|
applySafeList(proj: protocol.ExternalProject): NormalizedPath[];
|
|
3909
|
+
private applySafeListWorker;
|
|
3909
3910
|
openExternalProject(proj: protocol.ExternalProject): void;
|
|
3910
3911
|
hasDeferredExtension(): boolean;
|
|
3911
3912
|
private enableRequestedPluginsAsync;
|
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.4";
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20240214`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -35009,7 +35009,7 @@ ${lanes.join("\n")}
|
|
|
35009
35009
|
if (!jsDocDiagnostics) {
|
|
35010
35010
|
jsDocDiagnostics = [];
|
|
35011
35011
|
}
|
|
35012
|
-
jsDocDiagnostics
|
|
35012
|
+
addRange(jsDocDiagnostics, parseDiagnostics, saveParseDiagnosticsLength);
|
|
35013
35013
|
}
|
|
35014
35014
|
currentToken = saveToken;
|
|
35015
35015
|
parseDiagnostics.length = saveParseDiagnosticsLength;
|
|
@@ -60907,6 +60907,9 @@ ${lanes.join("\n")}
|
|
|
60907
60907
|
if (objectType.flags & (1 /* Any */ | 131072 /* Never */)) {
|
|
60908
60908
|
return objectType;
|
|
60909
60909
|
}
|
|
60910
|
+
if (indexType === neverType) {
|
|
60911
|
+
return neverType;
|
|
60912
|
+
}
|
|
60910
60913
|
const indexInfo = getApplicableIndexInfo(objectType, indexType) || getIndexInfoOfType(objectType, stringType);
|
|
60911
60914
|
if (indexInfo) {
|
|
60912
60915
|
if (accessFlags & 2 /* NoIndexSignatures */ && indexInfo.keyType !== numberType) {
|
|
@@ -60930,9 +60933,6 @@ ${lanes.join("\n")}
|
|
|
60930
60933
|
}
|
|
60931
60934
|
return indexInfo.type;
|
|
60932
60935
|
}
|
|
60933
|
-
if (indexType.flags & 131072 /* Never */) {
|
|
60934
|
-
return neverType;
|
|
60935
|
-
}
|
|
60936
60936
|
if (isJSLiteralType(objectType)) {
|
|
60937
60937
|
return anyType;
|
|
60938
60938
|
}
|
|
@@ -68149,7 +68149,7 @@ ${lanes.join("\n")}
|
|
|
68149
68149
|
function hasMatchingArgument(expression, reference) {
|
|
68150
68150
|
if (expression.arguments) {
|
|
68151
68151
|
for (const argument of expression.arguments) {
|
|
68152
|
-
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference)) {
|
|
68152
|
+
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference) || getCandidateDiscriminantPropertyAccess(argument, reference)) {
|
|
68153
68153
|
return true;
|
|
68154
68154
|
}
|
|
68155
68155
|
}
|
|
@@ -68159,6 +68159,36 @@ ${lanes.join("\n")}
|
|
|
68159
68159
|
}
|
|
68160
68160
|
return false;
|
|
68161
68161
|
}
|
|
68162
|
+
function getCandidateDiscriminantPropertyAccess(expr, reference) {
|
|
68163
|
+
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
|
|
68164
|
+
if (isIdentifier(expr)) {
|
|
68165
|
+
const symbol = getResolvedSymbol(expr);
|
|
68166
|
+
const declaration = symbol.valueDeclaration;
|
|
68167
|
+
if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
|
|
68168
|
+
return declaration;
|
|
68169
|
+
}
|
|
68170
|
+
}
|
|
68171
|
+
} else if (isAccessExpression(expr)) {
|
|
68172
|
+
if (isMatchingReference(reference, expr.expression)) {
|
|
68173
|
+
return expr;
|
|
68174
|
+
}
|
|
68175
|
+
} else if (isIdentifier(expr)) {
|
|
68176
|
+
const symbol = getResolvedSymbol(expr);
|
|
68177
|
+
if (isConstantVariable(symbol)) {
|
|
68178
|
+
const declaration = symbol.valueDeclaration;
|
|
68179
|
+
if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
|
|
68180
|
+
return declaration.initializer;
|
|
68181
|
+
}
|
|
68182
|
+
if (isBindingElement(declaration) && !declaration.initializer) {
|
|
68183
|
+
const parent2 = declaration.parent.parent;
|
|
68184
|
+
if (isVariableDeclaration(parent2) && !parent2.type && parent2.initializer && (isIdentifier(parent2.initializer) || isAccessExpression(parent2.initializer)) && isMatchingReference(reference, parent2.initializer)) {
|
|
68185
|
+
return declaration;
|
|
68186
|
+
}
|
|
68187
|
+
}
|
|
68188
|
+
}
|
|
68189
|
+
}
|
|
68190
|
+
return void 0;
|
|
68191
|
+
}
|
|
68162
68192
|
function getFlowNodeId(flow) {
|
|
68163
68193
|
if (!flow.id || flow.id < 0) {
|
|
68164
68194
|
flow.id = nextFlowId;
|
|
@@ -69258,39 +69288,9 @@ ${lanes.join("\n")}
|
|
|
69258
69288
|
}
|
|
69259
69289
|
return result;
|
|
69260
69290
|
}
|
|
69261
|
-
function getCandidateDiscriminantPropertyAccess(expr) {
|
|
69262
|
-
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
|
|
69263
|
-
if (isIdentifier(expr)) {
|
|
69264
|
-
const symbol = getResolvedSymbol(expr);
|
|
69265
|
-
const declaration = symbol.valueDeclaration;
|
|
69266
|
-
if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
|
|
69267
|
-
return declaration;
|
|
69268
|
-
}
|
|
69269
|
-
}
|
|
69270
|
-
} else if (isAccessExpression(expr)) {
|
|
69271
|
-
if (isMatchingReference(reference, expr.expression)) {
|
|
69272
|
-
return expr;
|
|
69273
|
-
}
|
|
69274
|
-
} else if (isIdentifier(expr)) {
|
|
69275
|
-
const symbol = getResolvedSymbol(expr);
|
|
69276
|
-
if (isConstantVariable(symbol)) {
|
|
69277
|
-
const declaration = symbol.valueDeclaration;
|
|
69278
|
-
if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
|
|
69279
|
-
return declaration.initializer;
|
|
69280
|
-
}
|
|
69281
|
-
if (isBindingElement(declaration) && !declaration.initializer) {
|
|
69282
|
-
const parent2 = declaration.parent.parent;
|
|
69283
|
-
if (isVariableDeclaration(parent2) && !parent2.type && parent2.initializer && (isIdentifier(parent2.initializer) || isAccessExpression(parent2.initializer)) && isMatchingReference(reference, parent2.initializer)) {
|
|
69284
|
-
return declaration;
|
|
69285
|
-
}
|
|
69286
|
-
}
|
|
69287
|
-
}
|
|
69288
|
-
}
|
|
69289
|
-
return void 0;
|
|
69290
|
-
}
|
|
69291
69291
|
function getDiscriminantPropertyAccess(expr, computedType) {
|
|
69292
69292
|
if (declaredType.flags & 1048576 /* Union */ || computedType.flags & 1048576 /* Union */) {
|
|
69293
|
-
const access = getCandidateDiscriminantPropertyAccess(expr);
|
|
69293
|
+
const access = getCandidateDiscriminantPropertyAccess(expr, reference);
|
|
69294
69294
|
if (access) {
|
|
69295
69295
|
const name = getAccessedPropertyName(access);
|
|
69296
69296
|
if (name) {
|
|
@@ -69836,10 +69836,12 @@ ${lanes.join("\n")}
|
|
|
69836
69836
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
69837
69837
|
}
|
|
69838
69838
|
function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
|
|
69839
|
-
|
|
69840
|
-
|
|
69841
|
-
|
|
69842
|
-
|
|
69839
|
+
if (hasMatchingArgument(callExpression, reference)) {
|
|
69840
|
+
const signature = assumeTrue || !isCallChain(callExpression) ? getEffectsSignature(callExpression) : void 0;
|
|
69841
|
+
const predicate = signature && getTypePredicateOfSignature(signature);
|
|
69842
|
+
if (predicate && (predicate.kind === 0 /* This */ || predicate.kind === 1 /* Identifier */)) {
|
|
69843
|
+
return narrowTypeByTypePredicate(type, predicate, callExpression, assumeTrue);
|
|
69844
|
+
}
|
|
69843
69845
|
}
|
|
69844
69846
|
if (containsMissingType(type) && isAccessExpression(reference) && isPropertyAccessExpression(callExpression.expression)) {
|
|
69845
69847
|
const callAccess = callExpression.expression;
|
|
@@ -175441,7 +175443,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
175441
175443
|
}
|
|
175442
175444
|
break;
|
|
175443
175445
|
default:
|
|
175444
|
-
if (
|
|
175446
|
+
if (orderedRemoveItem(this.containingProjects, project)) {
|
|
175445
175447
|
project.onFileAddedOrRemoved(this.isSymlink());
|
|
175446
175448
|
}
|
|
175447
175449
|
break;
|
|
@@ -179150,7 +179152,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
179150
179152
|
);
|
|
179151
179153
|
project.addRoot(info);
|
|
179152
179154
|
if (info.containingProjects[0] !== project) {
|
|
179153
|
-
info.
|
|
179155
|
+
orderedRemoveItem(info.containingProjects, project);
|
|
179154
179156
|
info.containingProjects.unshift(project);
|
|
179155
179157
|
}
|
|
179156
179158
|
project.updateGraph();
|
|
@@ -179445,8 +179447,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
179445
179447
|
* otherwise just file name
|
|
179446
179448
|
*/
|
|
179447
179449
|
getConfigFileNameForFile(info) {
|
|
179448
|
-
if (
|
|
179449
|
-
Debug.assert(info.isScriptOpen());
|
|
179450
|
+
if (!isAncestorConfigFileInfo(info)) {
|
|
179450
179451
|
const result = this.configFileForOpenFiles.get(info.path);
|
|
179451
179452
|
if (result !== void 0)
|
|
179452
179453
|
return result || void 0;
|
|
@@ -180441,11 +180442,13 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
180441
180442
|
} = this.hostConfiguration.preferences;
|
|
180442
180443
|
this.hostConfiguration.preferences = { ...this.hostConfiguration.preferences, ...args.preferences };
|
|
180443
180444
|
if (lazyConfiguredProjectsFromExternalProject && !this.hostConfiguration.preferences.lazyConfiguredProjectsFromExternalProject) {
|
|
180444
|
-
this.
|
|
180445
|
-
|
|
180446
|
-
project.
|
|
180447
|
-
|
|
180448
|
-
|
|
180445
|
+
this.externalProjectToConfiguredProjectMap.forEach(
|
|
180446
|
+
(projects) => projects.forEach((project) => {
|
|
180447
|
+
if (!project.isClosed() && project.hasExternalProjectRef() && project.pendingUpdateLevel === 2 /* Full */ && !this.pendingProjectUpdates.has(project.getProjectName())) {
|
|
180448
|
+
project.updateGraph();
|
|
180449
|
+
}
|
|
180450
|
+
})
|
|
180451
|
+
);
|
|
180449
180452
|
}
|
|
180450
180453
|
if (includePackageJsonAutoImports !== args.preferences.includePackageJsonAutoImports) {
|
|
180451
180454
|
this.forEachProject((project) => {
|
|
@@ -181030,23 +181033,20 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
181030
181033
|
scriptInfo.editContent(change.span.start, change.span.start + change.span.length, change.newText);
|
|
181031
181034
|
}
|
|
181032
181035
|
}
|
|
181033
|
-
closeConfiguredProjectReferencedFromExternalProject(
|
|
181034
|
-
|
|
181035
|
-
|
|
181036
|
-
|
|
181037
|
-
|
|
181038
|
-
|
|
181039
|
-
return;
|
|
181036
|
+
closeConfiguredProjectReferencedFromExternalProject(configuredProjects) {
|
|
181037
|
+
configuredProjects == null ? void 0 : configuredProjects.forEach((configuredProject) => {
|
|
181038
|
+
if (!configuredProject.isClosed()) {
|
|
181039
|
+
configuredProject.deleteExternalProjectReference();
|
|
181040
|
+
if (!configuredProject.hasOpenRef())
|
|
181041
|
+
this.removeProject(configuredProject);
|
|
181040
181042
|
}
|
|
181041
|
-
}
|
|
181043
|
+
});
|
|
181042
181044
|
}
|
|
181043
181045
|
closeExternalProject(uncheckedFileName, print) {
|
|
181044
181046
|
const fileName = toNormalizedPath(uncheckedFileName);
|
|
181045
|
-
const
|
|
181046
|
-
if (
|
|
181047
|
-
|
|
181048
|
-
this.closeConfiguredProjectReferencedFromExternalProject(configFile);
|
|
181049
|
-
}
|
|
181047
|
+
const configuredProjects = this.externalProjectToConfiguredProjectMap.get(fileName);
|
|
181048
|
+
if (configuredProjects) {
|
|
181049
|
+
this.closeConfiguredProjectReferencedFromExternalProject(configuredProjects);
|
|
181050
181050
|
this.externalProjectToConfiguredProjectMap.delete(fileName);
|
|
181051
181051
|
} else {
|
|
181052
181052
|
const externalProject = this.findExternalProjectByProjectName(uncheckedFileName);
|
|
@@ -181086,16 +181086,18 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
181086
181086
|
this.safelist = defaultTypeSafeList;
|
|
181087
181087
|
}
|
|
181088
181088
|
applySafeList(proj) {
|
|
181089
|
-
const { rootFiles } = proj;
|
|
181090
181089
|
const typeAcquisition = proj.typeAcquisition;
|
|
181091
181090
|
Debug.assert(!!typeAcquisition, "proj.typeAcquisition should be set by now");
|
|
181091
|
+
const result = this.applySafeListWorker(proj, proj.rootFiles, typeAcquisition);
|
|
181092
|
+
return (result == null ? void 0 : result.excludedFiles) ?? [];
|
|
181093
|
+
}
|
|
181094
|
+
applySafeListWorker(proj, rootFiles, typeAcquisition) {
|
|
181092
181095
|
if (typeAcquisition.enable === false || typeAcquisition.disableFilenameBasedTypeAcquisition) {
|
|
181093
|
-
return
|
|
181096
|
+
return void 0;
|
|
181094
181097
|
}
|
|
181095
181098
|
const typeAcqInclude = typeAcquisition.include || (typeAcquisition.include = []);
|
|
181096
181099
|
const excludeRules = [];
|
|
181097
181100
|
const normalizedNames = rootFiles.map((f) => normalizeSlashes(f.fileName));
|
|
181098
|
-
const excludedFiles = [];
|
|
181099
181101
|
for (const name of Object.keys(this.safelist)) {
|
|
181100
181102
|
const rule2 = this.safelist[name];
|
|
181101
181103
|
for (const root of normalizedNames) {
|
|
@@ -181136,12 +181138,12 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
181136
181138
|
}
|
|
181137
181139
|
}
|
|
181138
181140
|
const excludeRegexes = excludeRules.map((e) => new RegExp(e, "i"));
|
|
181139
|
-
|
|
181140
|
-
|
|
181141
|
+
let filesToKeep;
|
|
181142
|
+
let excludedFiles;
|
|
181143
|
+
for (let i = 0; i < rootFiles.length; i++) {
|
|
181141
181144
|
if (excludeRegexes.some((re) => re.test(normalizedNames[i]))) {
|
|
181142
|
-
|
|
181145
|
+
addExcludedFile(i);
|
|
181143
181146
|
} else {
|
|
181144
|
-
let exclude = false;
|
|
181145
181147
|
if (typeAcquisition.enable) {
|
|
181146
181148
|
const baseName = getBaseFileName(toFileNameLowerCase(normalizedNames[i]));
|
|
181147
181149
|
if (fileExtensionIs(baseName, "js")) {
|
|
@@ -181150,120 +181152,91 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
181150
181152
|
const typeName = this.legacySafelist.get(cleanedTypingName);
|
|
181151
181153
|
if (typeName !== void 0) {
|
|
181152
181154
|
this.logger.info(`Excluded '${normalizedNames[i]}' because it matched ${cleanedTypingName} from the legacy safelist`);
|
|
181153
|
-
|
|
181154
|
-
exclude = true;
|
|
181155
|
+
addExcludedFile(i);
|
|
181155
181156
|
if (!typeAcqInclude.includes(typeName)) {
|
|
181156
181157
|
typeAcqInclude.push(typeName);
|
|
181157
181158
|
}
|
|
181159
|
+
continue;
|
|
181158
181160
|
}
|
|
181159
181161
|
}
|
|
181160
181162
|
}
|
|
181161
|
-
if (
|
|
181162
|
-
|
|
181163
|
-
|
|
181164
|
-
|
|
181165
|
-
filesToKeep.push(proj.rootFiles[i]);
|
|
181166
|
-
}
|
|
181163
|
+
if (/^.+[.-]min\.js$/.test(normalizedNames[i])) {
|
|
181164
|
+
addExcludedFile(i);
|
|
181165
|
+
} else {
|
|
181166
|
+
filesToKeep == null ? void 0 : filesToKeep.push(rootFiles[i]);
|
|
181167
181167
|
}
|
|
181168
181168
|
}
|
|
181169
181169
|
}
|
|
181170
|
-
|
|
181171
|
-
|
|
181170
|
+
return excludedFiles ? {
|
|
181171
|
+
rootFiles: filesToKeep,
|
|
181172
|
+
excludedFiles
|
|
181173
|
+
} : void 0;
|
|
181174
|
+
function addExcludedFile(index) {
|
|
181175
|
+
if (!excludedFiles) {
|
|
181176
|
+
Debug.assert(!filesToKeep);
|
|
181177
|
+
filesToKeep = rootFiles.slice(0, index);
|
|
181178
|
+
excludedFiles = [];
|
|
181179
|
+
}
|
|
181180
|
+
excludedFiles.push(normalizedNames[index]);
|
|
181181
|
+
}
|
|
181172
181182
|
}
|
|
181173
181183
|
openExternalProject(proj, print) {
|
|
181174
|
-
|
|
181175
|
-
|
|
181176
|
-
|
|
181177
|
-
|
|
181178
|
-
proj.typeAcquisition.enable = hasNoTypeScriptSource(proj.rootFiles.map((f) => f.fileName));
|
|
181179
|
-
}
|
|
181180
|
-
const excludedFiles = this.applySafeList(proj);
|
|
181181
|
-
let tsConfigFiles;
|
|
181182
|
-
const rootFiles = [];
|
|
181184
|
+
const existingExternalProject = this.findExternalProjectByProjectName(proj.projectFileName);
|
|
181185
|
+
const existingConfiguredProjects = this.externalProjectToConfiguredProjectMap.get(proj.projectFileName);
|
|
181186
|
+
let configuredProjects;
|
|
181187
|
+
let rootFiles = [];
|
|
181183
181188
|
for (const file of proj.rootFiles) {
|
|
181184
181189
|
const normalized = toNormalizedPath(file.fileName);
|
|
181185
181190
|
if (getBaseConfigFileName(normalized)) {
|
|
181186
181191
|
if (this.serverMode === 0 /* Semantic */ && this.host.fileExists(normalized)) {
|
|
181187
|
-
|
|
181192
|
+
let project = this.findConfiguredProjectByProjectName(normalized);
|
|
181193
|
+
if (!project) {
|
|
181194
|
+
project = this.getHostPreferences().lazyConfiguredProjectsFromExternalProject ? this.createConfiguredProjectWithDelayLoad(normalized, `Creating configured project in external project: ${proj.projectFileName}`) : this.createLoadAndUpdateConfiguredProject(normalized, `Creating configured project in external project: ${proj.projectFileName}`);
|
|
181195
|
+
}
|
|
181196
|
+
if (!(existingConfiguredProjects == null ? void 0 : existingConfiguredProjects.has(project))) {
|
|
181197
|
+
project.addExternalProjectReference();
|
|
181198
|
+
}
|
|
181199
|
+
(configuredProjects ?? (configuredProjects = /* @__PURE__ */ new Set())).add(project);
|
|
181200
|
+
existingConfiguredProjects == null ? void 0 : existingConfiguredProjects.delete(project);
|
|
181188
181201
|
}
|
|
181189
181202
|
} else {
|
|
181190
181203
|
rootFiles.push(file);
|
|
181191
181204
|
}
|
|
181192
181205
|
}
|
|
181193
|
-
if (
|
|
181194
|
-
|
|
181195
|
-
|
|
181196
|
-
|
|
181197
|
-
|
|
181198
|
-
|
|
181199
|
-
|
|
181200
|
-
|
|
181206
|
+
if (configuredProjects) {
|
|
181207
|
+
this.externalProjectToConfiguredProjectMap.set(proj.projectFileName, configuredProjects);
|
|
181208
|
+
if (existingExternalProject)
|
|
181209
|
+
this.removeProject(existingExternalProject);
|
|
181210
|
+
} else {
|
|
181211
|
+
this.externalProjectToConfiguredProjectMap.delete(proj.projectFileName);
|
|
181212
|
+
const typeAcquisition = proj.typeAcquisition || {};
|
|
181213
|
+
typeAcquisition.include = typeAcquisition.include || [];
|
|
181214
|
+
typeAcquisition.exclude = typeAcquisition.exclude || [];
|
|
181215
|
+
if (typeAcquisition.enable === void 0) {
|
|
181216
|
+
typeAcquisition.enable = hasNoTypeScriptSource(rootFiles.map((f) => f.fileName));
|
|
181217
|
+
}
|
|
181218
|
+
const excludeResult = this.applySafeListWorker(proj, rootFiles, typeAcquisition);
|
|
181219
|
+
const excludedFiles = (excludeResult == null ? void 0 : excludeResult.excludedFiles) ?? [];
|
|
181220
|
+
rootFiles = (excludeResult == null ? void 0 : excludeResult.rootFiles) ?? rootFiles;
|
|
181221
|
+
if (existingExternalProject) {
|
|
181222
|
+
existingExternalProject.excludedFiles = excludedFiles;
|
|
181201
181223
|
const compilerOptions = convertCompilerOptions(proj.options);
|
|
181202
|
-
const watchOptionsAndErrors = convertWatchOptions(proj.options,
|
|
181203
|
-
const lastFileExceededProgramSize = this.getFilenameForExceededTotalSizeLimitForNonTsFiles(proj.projectFileName, compilerOptions,
|
|
181224
|
+
const watchOptionsAndErrors = convertWatchOptions(proj.options, existingExternalProject.getCurrentDirectory());
|
|
181225
|
+
const lastFileExceededProgramSize = this.getFilenameForExceededTotalSizeLimitForNonTsFiles(proj.projectFileName, compilerOptions, rootFiles, externalFilePropertyReader);
|
|
181204
181226
|
if (lastFileExceededProgramSize) {
|
|
181205
|
-
|
|
181227
|
+
existingExternalProject.disableLanguageService(lastFileExceededProgramSize);
|
|
181206
181228
|
} else {
|
|
181207
|
-
|
|
181229
|
+
existingExternalProject.enableLanguageService();
|
|
181208
181230
|
}
|
|
181209
|
-
|
|
181210
|
-
this.updateRootAndOptionsOfNonInferredProject(
|
|
181211
|
-
|
|
181212
|
-
if (print)
|
|
181213
|
-
this.printProjects();
|
|
181214
|
-
return;
|
|
181215
|
-
}
|
|
181216
|
-
this.closeExternalProject(
|
|
181217
|
-
proj.projectFileName,
|
|
181218
|
-
/*print*/
|
|
181219
|
-
false
|
|
181220
|
-
);
|
|
181221
|
-
} else if (this.externalProjectToConfiguredProjectMap.get(proj.projectFileName)) {
|
|
181222
|
-
if (!tsConfigFiles) {
|
|
181223
|
-
this.closeExternalProject(
|
|
181224
|
-
proj.projectFileName,
|
|
181225
|
-
/*print*/
|
|
181226
|
-
false
|
|
181227
|
-
);
|
|
181231
|
+
existingExternalProject.setProjectErrors(watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.errors);
|
|
181232
|
+
this.updateRootAndOptionsOfNonInferredProject(existingExternalProject, rootFiles, externalFilePropertyReader, compilerOptions, typeAcquisition, proj.options.compileOnSave, watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions);
|
|
181233
|
+
existingExternalProject.updateGraph();
|
|
181228
181234
|
} else {
|
|
181229
|
-
const
|
|
181230
|
-
|
|
181231
|
-
let iOld = 0;
|
|
181232
|
-
while (iNew < tsConfigFiles.length && iOld < oldConfigFiles.length) {
|
|
181233
|
-
const newConfig = tsConfigFiles[iNew];
|
|
181234
|
-
const oldConfig = oldConfigFiles[iOld];
|
|
181235
|
-
if (oldConfig < newConfig) {
|
|
181236
|
-
this.closeConfiguredProjectReferencedFromExternalProject(oldConfig);
|
|
181237
|
-
iOld++;
|
|
181238
|
-
} else if (oldConfig > newConfig) {
|
|
181239
|
-
iNew++;
|
|
181240
|
-
} else {
|
|
181241
|
-
(exisingConfigFiles || (exisingConfigFiles = [])).push(oldConfig);
|
|
181242
|
-
iOld++;
|
|
181243
|
-
iNew++;
|
|
181244
|
-
}
|
|
181245
|
-
}
|
|
181246
|
-
for (let i = iOld; i < oldConfigFiles.length; i++) {
|
|
181247
|
-
this.closeConfiguredProjectReferencedFromExternalProject(oldConfigFiles[i]);
|
|
181248
|
-
}
|
|
181235
|
+
const project = this.createExternalProject(proj.projectFileName, rootFiles, proj.options, typeAcquisition, excludedFiles);
|
|
181236
|
+
project.updateGraph();
|
|
181249
181237
|
}
|
|
181250
181238
|
}
|
|
181251
|
-
|
|
181252
|
-
this.externalProjectToConfiguredProjectMap.set(proj.projectFileName, tsConfigFiles);
|
|
181253
|
-
for (const tsconfigFile of tsConfigFiles) {
|
|
181254
|
-
let project = this.findConfiguredProjectByProjectName(tsconfigFile);
|
|
181255
|
-
if (!project) {
|
|
181256
|
-
project = this.getHostPreferences().lazyConfiguredProjectsFromExternalProject ? this.createConfiguredProjectWithDelayLoad(tsconfigFile, `Creating configured project in external project: ${proj.projectFileName}`) : this.createLoadAndUpdateConfiguredProject(tsconfigFile, `Creating configured project in external project: ${proj.projectFileName}`);
|
|
181257
|
-
}
|
|
181258
|
-
if (project && !contains(exisingConfigFiles, tsconfigFile)) {
|
|
181259
|
-
project.addExternalProjectReference();
|
|
181260
|
-
}
|
|
181261
|
-
}
|
|
181262
|
-
} else {
|
|
181263
|
-
this.externalProjectToConfiguredProjectMap.delete(proj.projectFileName);
|
|
181264
|
-
const project = this.createExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition, excludedFiles);
|
|
181265
|
-
project.updateGraph();
|
|
181266
|
-
}
|
|
181239
|
+
this.closeConfiguredProjectReferencedFromExternalProject(existingConfiguredProjects);
|
|
181267
181240
|
if (print)
|
|
181268
181241
|
this.printProjects();
|
|
181269
181242
|
}
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.4";
|
|
57
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
57
|
+
var version = `${versionMajorMinor}.0-insiders.20240214`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -24326,7 +24326,7 @@ var Parser;
|
|
|
24326
24326
|
if (!jsDocDiagnostics) {
|
|
24327
24327
|
jsDocDiagnostics = [];
|
|
24328
24328
|
}
|
|
24329
|
-
jsDocDiagnostics
|
|
24329
|
+
addRange(jsDocDiagnostics, parseDiagnostics, saveParseDiagnosticsLength);
|
|
24330
24330
|
}
|
|
24331
24331
|
currentToken = saveToken;
|
|
24332
24332
|
parseDiagnostics.length = saveParseDiagnosticsLength;
|
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-55842-26",
|
|
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": "48898f2f820ea4a404e1f6ffc6e28e279d3ad869"
|
|
118
118
|
}
|