typescript 5.1.0-dev.20230302 → 5.1.0-dev.20230304
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 +13 -39
- package/lib/tsserver.js +61 -57
- package/lib/tsserverlibrary.js +61 -58
- package/lib/typescript.js +61 -58
- package/lib/typingsInstaller.js +3 -36
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -23,7 +23,7 @@ var __export = (target, all) => {
|
|
|
23
23
|
|
|
24
24
|
// src/compiler/corePublic.ts
|
|
25
25
|
var versionMajorMinor = "5.1";
|
|
26
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
26
|
+
var version = `${versionMajorMinor}.0-dev.20230304`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -2624,41 +2624,8 @@ function tryGetWebPerformanceHooks() {
|
|
|
2624
2624
|
function tryGetNodePerformanceHooks() {
|
|
2625
2625
|
if (isNodeLikeSystem()) {
|
|
2626
2626
|
try {
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
if (hasRequiredAPI(nodePerformance, PerformanceObserver2)) {
|
|
2630
|
-
performance2 = nodePerformance;
|
|
2631
|
-
const version2 = new Version(process.versions.node);
|
|
2632
|
-
const range = new VersionRange("<12.16.3 || 13 <13.13");
|
|
2633
|
-
if (range.test(version2)) {
|
|
2634
|
-
performance2 = {
|
|
2635
|
-
get timeOrigin() {
|
|
2636
|
-
return nodePerformance.timeOrigin;
|
|
2637
|
-
},
|
|
2638
|
-
now() {
|
|
2639
|
-
return nodePerformance.now();
|
|
2640
|
-
},
|
|
2641
|
-
mark(name) {
|
|
2642
|
-
return nodePerformance.mark(name);
|
|
2643
|
-
},
|
|
2644
|
-
measure(name, start = "nodeStart", end) {
|
|
2645
|
-
if (end === void 0) {
|
|
2646
|
-
end = "__performance.measure-fix__";
|
|
2647
|
-
nodePerformance.mark(end);
|
|
2648
|
-
}
|
|
2649
|
-
nodePerformance.measure(name, start, end);
|
|
2650
|
-
if (end === "__performance.measure-fix__") {
|
|
2651
|
-
nodePerformance.clearMarks("__performance.measure-fix__");
|
|
2652
|
-
}
|
|
2653
|
-
},
|
|
2654
|
-
clearMarks(name) {
|
|
2655
|
-
return nodePerformance.clearMarks(name);
|
|
2656
|
-
},
|
|
2657
|
-
clearMeasures(name) {
|
|
2658
|
-
return nodePerformance.clearMeasures(name);
|
|
2659
|
-
}
|
|
2660
|
-
};
|
|
2661
|
-
}
|
|
2627
|
+
const { performance: performance2, PerformanceObserver: PerformanceObserver2 } = require("perf_hooks");
|
|
2628
|
+
if (hasRequiredAPI(performance2, PerformanceObserver2)) {
|
|
2662
2629
|
return {
|
|
2663
2630
|
// By default, only write native events when generating a cpu profile or using the v8 profiler.
|
|
2664
2631
|
shouldWriteNativeEvents: false,
|
|
@@ -58210,6 +58177,9 @@ function createTypeChecker(host) {
|
|
|
58210
58177
|
function isTypeSubtypeOf(source, target) {
|
|
58211
58178
|
return isTypeRelatedTo(source, target, subtypeRelation);
|
|
58212
58179
|
}
|
|
58180
|
+
function isTypeStrictSubtypeOf(source, target) {
|
|
58181
|
+
return isTypeRelatedTo(source, target, strictSubtypeRelation);
|
|
58182
|
+
}
|
|
58213
58183
|
function isTypeAssignableTo(source, target) {
|
|
58214
58184
|
return isTypeRelatedTo(source, target, assignableRelation);
|
|
58215
58185
|
}
|
|
@@ -65306,7 +65276,7 @@ function createTypeChecker(host) {
|
|
|
65306
65276
|
const narrowedType = mapType(candidate, (c) => {
|
|
65307
65277
|
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
65308
65278
|
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
65309
|
-
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) =>
|
|
65279
|
+
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType);
|
|
65310
65280
|
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
65311
65281
|
});
|
|
65312
65282
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
@@ -69250,16 +69220,20 @@ function createTypeChecker(host) {
|
|
|
69250
69220
|
) : createTupleType([type], [8 /* Variadic */]);
|
|
69251
69221
|
}
|
|
69252
69222
|
function getSpreadArgumentType(args, index, argCount, restType, context, checkMode) {
|
|
69223
|
+
const inConstContext = isConstTypeVariable(restType);
|
|
69253
69224
|
if (index >= argCount - 1) {
|
|
69254
69225
|
const arg = args[argCount - 1];
|
|
69255
69226
|
if (isSpreadArgument(arg)) {
|
|
69256
|
-
|
|
69227
|
+
const spreadType = arg.kind === 234 /* SyntheticExpression */ ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode);
|
|
69228
|
+
if (isArrayLikeType(spreadType)) {
|
|
69229
|
+
return getMutableArrayOrTupleType(spreadType);
|
|
69230
|
+
}
|
|
69231
|
+
return createArrayType(checkIteratedTypeOrElementType(33 /* Spread */, spreadType, undefinedType, arg.kind === 227 /* SpreadElement */ ? arg.expression : arg), inConstContext);
|
|
69257
69232
|
}
|
|
69258
69233
|
}
|
|
69259
69234
|
const types = [];
|
|
69260
69235
|
const flags = [];
|
|
69261
69236
|
const names = [];
|
|
69262
|
-
const inConstContext = isConstTypeVariable(restType);
|
|
69263
69237
|
for (let i = index; i < argCount; i++) {
|
|
69264
69238
|
const arg = args[i];
|
|
69265
69239
|
if (isSpreadArgument(arg)) {
|
package/lib/tsserver.js
CHANGED
|
@@ -2286,7 +2286,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2286
2286
|
|
|
2287
2287
|
// src/compiler/corePublic.ts
|
|
2288
2288
|
var versionMajorMinor = "5.1";
|
|
2289
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2289
|
+
var version = `${versionMajorMinor}.0-dev.20230304`;
|
|
2290
2290
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2291
2291
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2292
2292
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -5283,41 +5283,8 @@ function tryGetWebPerformanceHooks() {
|
|
|
5283
5283
|
function tryGetNodePerformanceHooks() {
|
|
5284
5284
|
if (isNodeLikeSystem()) {
|
|
5285
5285
|
try {
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
if (hasRequiredAPI(nodePerformance, PerformanceObserver2)) {
|
|
5289
|
-
performance2 = nodePerformance;
|
|
5290
|
-
const version2 = new Version(process.versions.node);
|
|
5291
|
-
const range = new VersionRange("<12.16.3 || 13 <13.13");
|
|
5292
|
-
if (range.test(version2)) {
|
|
5293
|
-
performance2 = {
|
|
5294
|
-
get timeOrigin() {
|
|
5295
|
-
return nodePerformance.timeOrigin;
|
|
5296
|
-
},
|
|
5297
|
-
now() {
|
|
5298
|
-
return nodePerformance.now();
|
|
5299
|
-
},
|
|
5300
|
-
mark(name) {
|
|
5301
|
-
return nodePerformance.mark(name);
|
|
5302
|
-
},
|
|
5303
|
-
measure(name, start2 = "nodeStart", end) {
|
|
5304
|
-
if (end === void 0) {
|
|
5305
|
-
end = "__performance.measure-fix__";
|
|
5306
|
-
nodePerformance.mark(end);
|
|
5307
|
-
}
|
|
5308
|
-
nodePerformance.measure(name, start2, end);
|
|
5309
|
-
if (end === "__performance.measure-fix__") {
|
|
5310
|
-
nodePerformance.clearMarks("__performance.measure-fix__");
|
|
5311
|
-
}
|
|
5312
|
-
},
|
|
5313
|
-
clearMarks(name) {
|
|
5314
|
-
return nodePerformance.clearMarks(name);
|
|
5315
|
-
},
|
|
5316
|
-
clearMeasures(name) {
|
|
5317
|
-
return nodePerformance.clearMeasures(name);
|
|
5318
|
-
}
|
|
5319
|
-
};
|
|
5320
|
-
}
|
|
5286
|
+
const { performance: performance2, PerformanceObserver: PerformanceObserver2 } = require("perf_hooks");
|
|
5287
|
+
if (hasRequiredAPI(performance2, PerformanceObserver2)) {
|
|
5321
5288
|
return {
|
|
5322
5289
|
// By default, only write native events when generating a cpu profile or using the v8 profiler.
|
|
5323
5290
|
shouldWriteNativeEvents: false,
|
|
@@ -62815,6 +62782,9 @@ function createTypeChecker(host) {
|
|
|
62815
62782
|
function isTypeSubtypeOf(source, target) {
|
|
62816
62783
|
return isTypeRelatedTo(source, target, subtypeRelation);
|
|
62817
62784
|
}
|
|
62785
|
+
function isTypeStrictSubtypeOf(source, target) {
|
|
62786
|
+
return isTypeRelatedTo(source, target, strictSubtypeRelation);
|
|
62787
|
+
}
|
|
62818
62788
|
function isTypeAssignableTo(source, target) {
|
|
62819
62789
|
return isTypeRelatedTo(source, target, assignableRelation);
|
|
62820
62790
|
}
|
|
@@ -69911,7 +69881,7 @@ function createTypeChecker(host) {
|
|
|
69911
69881
|
const narrowedType = mapType(candidate, (c) => {
|
|
69912
69882
|
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
69913
69883
|
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
69914
|
-
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) =>
|
|
69884
|
+
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType);
|
|
69915
69885
|
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
69916
69886
|
});
|
|
69917
69887
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
@@ -73855,16 +73825,20 @@ function createTypeChecker(host) {
|
|
|
73855
73825
|
) : createTupleType([type], [8 /* Variadic */]);
|
|
73856
73826
|
}
|
|
73857
73827
|
function getSpreadArgumentType(args, index, argCount, restType, context, checkMode) {
|
|
73828
|
+
const inConstContext = isConstTypeVariable(restType);
|
|
73858
73829
|
if (index >= argCount - 1) {
|
|
73859
73830
|
const arg = args[argCount - 1];
|
|
73860
73831
|
if (isSpreadArgument(arg)) {
|
|
73861
|
-
|
|
73832
|
+
const spreadType = arg.kind === 234 /* SyntheticExpression */ ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode);
|
|
73833
|
+
if (isArrayLikeType(spreadType)) {
|
|
73834
|
+
return getMutableArrayOrTupleType(spreadType);
|
|
73835
|
+
}
|
|
73836
|
+
return createArrayType(checkIteratedTypeOrElementType(33 /* Spread */, spreadType, undefinedType, arg.kind === 227 /* SpreadElement */ ? arg.expression : arg), inConstContext);
|
|
73862
73837
|
}
|
|
73863
73838
|
}
|
|
73864
73839
|
const types = [];
|
|
73865
73840
|
const flags = [];
|
|
73866
73841
|
const names = [];
|
|
73867
|
-
const inConstContext = isConstTypeVariable(restType);
|
|
73868
73842
|
for (let i = index; i < argCount; i++) {
|
|
73869
73843
|
const arg = args[i];
|
|
73870
73844
|
if (isSpreadArgument(arg)) {
|
|
@@ -138743,6 +138717,7 @@ function createCodeFixActionWorker(fixName8, description2, changes, fixId52, fix
|
|
|
138743
138717
|
}
|
|
138744
138718
|
function registerCodeFix(reg) {
|
|
138745
138719
|
for (const error of reg.errorCodes) {
|
|
138720
|
+
errorCodeToFixesArray = void 0;
|
|
138746
138721
|
errorCodeToFixes.add(String(error), reg);
|
|
138747
138722
|
}
|
|
138748
138723
|
if (reg.fixIds) {
|
|
@@ -138752,8 +138727,9 @@ function registerCodeFix(reg) {
|
|
|
138752
138727
|
}
|
|
138753
138728
|
}
|
|
138754
138729
|
}
|
|
138730
|
+
var errorCodeToFixesArray;
|
|
138755
138731
|
function getSupportedErrorCodes() {
|
|
138756
|
-
return arrayFrom(errorCodeToFixes.keys());
|
|
138732
|
+
return errorCodeToFixesArray != null ? errorCodeToFixesArray : errorCodeToFixesArray = arrayFrom(errorCodeToFixes.keys());
|
|
138757
138733
|
}
|
|
138758
138734
|
function removeFixIdIfFixAllUnavailable(registration, diagnostics) {
|
|
138759
138735
|
const { errorCodes: errorCodes64 } = registration;
|
|
@@ -151464,6 +151440,8 @@ function tryGetObjectLikeCompletionContainer(contextToken) {
|
|
|
151464
151440
|
break;
|
|
151465
151441
|
case 41 /* AsteriskToken */:
|
|
151466
151442
|
return isMethodDeclaration(parent2) ? tryCast(parent2.parent, isObjectLiteralExpression) : void 0;
|
|
151443
|
+
case 132 /* AsyncKeyword */:
|
|
151444
|
+
return tryCast(parent2.parent, isObjectLiteralExpression);
|
|
151467
151445
|
case 79 /* Identifier */:
|
|
151468
151446
|
return contextToken.text === "async" && isShorthandPropertyAssignment(contextToken.parent) ? contextToken.parent.parent : void 0;
|
|
151469
151447
|
}
|
|
@@ -156484,7 +156462,7 @@ function organizeImports(sourceFile, formatContext, host, program, preferences,
|
|
|
156484
156462
|
const shouldSort = mode === "SortAndCombine" /* SortAndCombine */ || mode === "All" /* All */;
|
|
156485
156463
|
const shouldCombine = shouldSort;
|
|
156486
156464
|
const shouldRemove = mode === "RemoveUnused" /* RemoveUnused */ || mode === "All" /* All */;
|
|
156487
|
-
const topLevelImportGroupDecls =
|
|
156465
|
+
const topLevelImportGroupDecls = groupByNewlineContiguous(sourceFile, sourceFile.statements.filter(isImportDeclaration));
|
|
156488
156466
|
const comparer = getOrganizeImportsComparerWithDetection(preferences, shouldSort ? () => detectSortingWorker(topLevelImportGroupDecls, preferences) === 2 /* CaseInsensitive */ : void 0);
|
|
156489
156467
|
const processImportsOfSameModuleSpecifier = (importGroup) => {
|
|
156490
156468
|
if (shouldRemove)
|
|
@@ -156497,13 +156475,12 @@ function organizeImports(sourceFile, formatContext, host, program, preferences,
|
|
|
156497
156475
|
};
|
|
156498
156476
|
topLevelImportGroupDecls.forEach((importGroupDecl) => organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier));
|
|
156499
156477
|
if (mode !== "RemoveUnused" /* RemoveUnused */) {
|
|
156500
|
-
|
|
156501
|
-
organizeImportsWorker(topLevelExportDecls, (group2) => coalesceExportsWorker(group2, comparer));
|
|
156478
|
+
getTopLevelExportGroups(sourceFile).forEach((exportGroupDecl) => organizeImportsWorker(exportGroupDecl, (group2) => coalesceExportsWorker(group2, comparer)));
|
|
156502
156479
|
}
|
|
156503
156480
|
for (const ambientModule of sourceFile.statements.filter(isAmbientModule)) {
|
|
156504
156481
|
if (!ambientModule.body)
|
|
156505
156482
|
continue;
|
|
156506
|
-
const ambientModuleImportGroupDecls =
|
|
156483
|
+
const ambientModuleImportGroupDecls = groupByNewlineContiguous(sourceFile, ambientModule.body.statements.filter(isImportDeclaration));
|
|
156507
156484
|
ambientModuleImportGroupDecls.forEach((importGroupDecl) => organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier));
|
|
156508
156485
|
if (mode !== "RemoveUnused" /* RemoveUnused */) {
|
|
156509
156486
|
const ambientModuleExportDecls = ambientModule.body.statements.filter(isExportDeclaration);
|
|
@@ -156518,7 +156495,7 @@ function organizeImports(sourceFile, formatContext, host, program, preferences,
|
|
|
156518
156495
|
suppressLeadingTrivia(oldImportDecls[0]);
|
|
156519
156496
|
const oldImportGroups = shouldCombine ? group(oldImportDecls, (importDecl) => getExternalModuleName2(importDecl.moduleSpecifier)) : [oldImportDecls];
|
|
156520
156497
|
const sortedImportGroups = shouldSort ? stableSort(oldImportGroups, (group1, group2) => compareModuleSpecifiersWorker(group1[0].moduleSpecifier, group2[0].moduleSpecifier, comparer)) : oldImportGroups;
|
|
156521
|
-
const newImportDecls = flatMap(sortedImportGroups, (importGroup) => getExternalModuleName2(importGroup[0].moduleSpecifier) ? coalesce(importGroup) : importGroup);
|
|
156498
|
+
const newImportDecls = flatMap(sortedImportGroups, (importGroup) => getExternalModuleName2(importGroup[0].moduleSpecifier) || importGroup[0].moduleSpecifier === void 0 ? coalesce(importGroup) : importGroup);
|
|
156522
156499
|
if (newImportDecls.length === 0) {
|
|
156523
156500
|
changeTracker.deleteNodes(
|
|
156524
156501
|
sourceFile,
|
|
@@ -156545,29 +156522,29 @@ function organizeImports(sourceFile, formatContext, host, program, preferences,
|
|
|
156545
156522
|
}
|
|
156546
156523
|
}
|
|
156547
156524
|
}
|
|
156548
|
-
function
|
|
156525
|
+
function groupByNewlineContiguous(sourceFile, decls) {
|
|
156549
156526
|
const scanner2 = createScanner(
|
|
156550
156527
|
sourceFile.languageVersion,
|
|
156551
156528
|
/*skipTrivia*/
|
|
156552
156529
|
false,
|
|
156553
156530
|
sourceFile.languageVariant
|
|
156554
156531
|
);
|
|
156555
|
-
const
|
|
156532
|
+
const group2 = [];
|
|
156556
156533
|
let groupIndex = 0;
|
|
156557
|
-
for (const
|
|
156558
|
-
if (
|
|
156534
|
+
for (const decl of decls) {
|
|
156535
|
+
if (group2[groupIndex] && isNewGroup(sourceFile, decl, scanner2)) {
|
|
156559
156536
|
groupIndex++;
|
|
156560
156537
|
}
|
|
156561
|
-
if (!
|
|
156562
|
-
|
|
156538
|
+
if (!group2[groupIndex]) {
|
|
156539
|
+
group2[groupIndex] = [];
|
|
156563
156540
|
}
|
|
156564
|
-
|
|
156541
|
+
group2[groupIndex].push(decl);
|
|
156565
156542
|
}
|
|
156566
|
-
return
|
|
156543
|
+
return group2;
|
|
156567
156544
|
}
|
|
156568
|
-
function isNewGroup(sourceFile,
|
|
156569
|
-
const startPos =
|
|
156570
|
-
const endPos =
|
|
156545
|
+
function isNewGroup(sourceFile, decl, scanner2) {
|
|
156546
|
+
const startPos = decl.getFullStart();
|
|
156547
|
+
const endPos = decl.getStart();
|
|
156571
156548
|
scanner2.setText(sourceFile.text, startPos, endPos - startPos);
|
|
156572
156549
|
let numberOfNewLines = 0;
|
|
156573
156550
|
while (scanner2.getTokenPos() < endPos) {
|
|
@@ -156848,7 +156825,7 @@ function getModuleSpecifierExpression(declaration) {
|
|
|
156848
156825
|
}
|
|
156849
156826
|
function detectSorting(sourceFile, preferences) {
|
|
156850
156827
|
return detectSortingWorker(
|
|
156851
|
-
|
|
156828
|
+
groupByNewlineContiguous(sourceFile, sourceFile.statements.filter(isImportDeclaration)),
|
|
156852
156829
|
preferences
|
|
156853
156830
|
);
|
|
156854
156831
|
}
|
|
@@ -157052,6 +157029,33 @@ function getOrganizeImportsComparerWithDetection(preferences, detectIgnoreCase)
|
|
|
157052
157029
|
const ignoreCase = typeof preferences.organizeImportsIgnoreCase === "boolean" ? preferences.organizeImportsIgnoreCase : (_a2 = detectIgnoreCase == null ? void 0 : detectIgnoreCase()) != null ? _a2 : false;
|
|
157053
157030
|
return getOrganizeImportsComparer(preferences, ignoreCase);
|
|
157054
157031
|
}
|
|
157032
|
+
function getTopLevelExportGroups(sourceFile) {
|
|
157033
|
+
const topLevelExportGroups = [];
|
|
157034
|
+
const statements = sourceFile.statements;
|
|
157035
|
+
const len = length(statements);
|
|
157036
|
+
let i = 0;
|
|
157037
|
+
let groupIndex = 0;
|
|
157038
|
+
while (i < len) {
|
|
157039
|
+
if (isExportDeclaration(statements[i])) {
|
|
157040
|
+
if (topLevelExportGroups[groupIndex] === void 0) {
|
|
157041
|
+
topLevelExportGroups[groupIndex] = [];
|
|
157042
|
+
}
|
|
157043
|
+
const exportDecl = statements[i];
|
|
157044
|
+
if (exportDecl.moduleSpecifier) {
|
|
157045
|
+
topLevelExportGroups[groupIndex].push(exportDecl);
|
|
157046
|
+
i++;
|
|
157047
|
+
} else {
|
|
157048
|
+
while (i < len && isExportDeclaration(statements[i])) {
|
|
157049
|
+
topLevelExportGroups[groupIndex].push(statements[i++]);
|
|
157050
|
+
}
|
|
157051
|
+
groupIndex++;
|
|
157052
|
+
}
|
|
157053
|
+
} else {
|
|
157054
|
+
i++;
|
|
157055
|
+
}
|
|
157056
|
+
}
|
|
157057
|
+
return flatMap(topLevelExportGroups, (exportGroupDecls) => groupByNewlineContiguous(sourceFile, exportGroupDecls));
|
|
157058
|
+
}
|
|
157055
157059
|
|
|
157056
157060
|
// src/services/_namespaces/ts.OutliningElementsCollector.ts
|
|
157057
157061
|
var ts_OutliningElementsCollector_exports = {};
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.1";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230304`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -3053,41 +3053,8 @@ ${lanes.join("\n")}
|
|
|
3053
3053
|
function tryGetNodePerformanceHooks() {
|
|
3054
3054
|
if (isNodeLikeSystem()) {
|
|
3055
3055
|
try {
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
if (hasRequiredAPI(nodePerformance, PerformanceObserver2)) {
|
|
3059
|
-
performance2 = nodePerformance;
|
|
3060
|
-
const version2 = new Version(process.versions.node);
|
|
3061
|
-
const range = new VersionRange("<12.16.3 || 13 <13.13");
|
|
3062
|
-
if (range.test(version2)) {
|
|
3063
|
-
performance2 = {
|
|
3064
|
-
get timeOrigin() {
|
|
3065
|
-
return nodePerformance.timeOrigin;
|
|
3066
|
-
},
|
|
3067
|
-
now() {
|
|
3068
|
-
return nodePerformance.now();
|
|
3069
|
-
},
|
|
3070
|
-
mark(name) {
|
|
3071
|
-
return nodePerformance.mark(name);
|
|
3072
|
-
},
|
|
3073
|
-
measure(name, start = "nodeStart", end) {
|
|
3074
|
-
if (end === void 0) {
|
|
3075
|
-
end = "__performance.measure-fix__";
|
|
3076
|
-
nodePerformance.mark(end);
|
|
3077
|
-
}
|
|
3078
|
-
nodePerformance.measure(name, start, end);
|
|
3079
|
-
if (end === "__performance.measure-fix__") {
|
|
3080
|
-
nodePerformance.clearMarks("__performance.measure-fix__");
|
|
3081
|
-
}
|
|
3082
|
-
},
|
|
3083
|
-
clearMarks(name) {
|
|
3084
|
-
return nodePerformance.clearMarks(name);
|
|
3085
|
-
},
|
|
3086
|
-
clearMeasures(name) {
|
|
3087
|
-
return nodePerformance.clearMeasures(name);
|
|
3088
|
-
}
|
|
3089
|
-
};
|
|
3090
|
-
}
|
|
3056
|
+
const { performance: performance2, PerformanceObserver: PerformanceObserver2 } = require("perf_hooks");
|
|
3057
|
+
if (hasRequiredAPI(performance2, PerformanceObserver2)) {
|
|
3091
3058
|
return {
|
|
3092
3059
|
// By default, only write native events when generating a cpu profile or using the v8 profiler.
|
|
3093
3060
|
shouldWriteNativeEvents: false,
|
|
@@ -60625,6 +60592,9 @@ ${lanes.join("\n")}
|
|
|
60625
60592
|
function isTypeSubtypeOf(source, target) {
|
|
60626
60593
|
return isTypeRelatedTo(source, target, subtypeRelation);
|
|
60627
60594
|
}
|
|
60595
|
+
function isTypeStrictSubtypeOf(source, target) {
|
|
60596
|
+
return isTypeRelatedTo(source, target, strictSubtypeRelation);
|
|
60597
|
+
}
|
|
60628
60598
|
function isTypeAssignableTo(source, target) {
|
|
60629
60599
|
return isTypeRelatedTo(source, target, assignableRelation);
|
|
60630
60600
|
}
|
|
@@ -67721,7 +67691,7 @@ ${lanes.join("\n")}
|
|
|
67721
67691
|
const narrowedType = mapType(candidate, (c) => {
|
|
67722
67692
|
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
67723
67693
|
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
67724
|
-
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) =>
|
|
67694
|
+
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType);
|
|
67725
67695
|
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
67726
67696
|
});
|
|
67727
67697
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
@@ -71665,16 +71635,20 @@ ${lanes.join("\n")}
|
|
|
71665
71635
|
) : createTupleType([type], [8 /* Variadic */]);
|
|
71666
71636
|
}
|
|
71667
71637
|
function getSpreadArgumentType(args, index, argCount, restType, context, checkMode) {
|
|
71638
|
+
const inConstContext = isConstTypeVariable(restType);
|
|
71668
71639
|
if (index >= argCount - 1) {
|
|
71669
71640
|
const arg = args[argCount - 1];
|
|
71670
71641
|
if (isSpreadArgument(arg)) {
|
|
71671
|
-
|
|
71642
|
+
const spreadType = arg.kind === 234 /* SyntheticExpression */ ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode);
|
|
71643
|
+
if (isArrayLikeType(spreadType)) {
|
|
71644
|
+
return getMutableArrayOrTupleType(spreadType);
|
|
71645
|
+
}
|
|
71646
|
+
return createArrayType(checkIteratedTypeOrElementType(33 /* Spread */, spreadType, undefinedType, arg.kind === 227 /* SpreadElement */ ? arg.expression : arg), inConstContext);
|
|
71672
71647
|
}
|
|
71673
71648
|
}
|
|
71674
71649
|
const types = [];
|
|
71675
71650
|
const flags = [];
|
|
71676
71651
|
const names = [];
|
|
71677
|
-
const inConstContext = isConstTypeVariable(restType);
|
|
71678
71652
|
for (let i = index; i < argCount; i++) {
|
|
71679
71653
|
const arg = args[i];
|
|
71680
71654
|
if (isSpreadArgument(arg)) {
|
|
@@ -137197,6 +137171,7 @@ ${lanes.join("\n")}
|
|
|
137197
137171
|
}
|
|
137198
137172
|
function registerCodeFix(reg) {
|
|
137199
137173
|
for (const error of reg.errorCodes) {
|
|
137174
|
+
errorCodeToFixesArray = void 0;
|
|
137200
137175
|
errorCodeToFixes.add(String(error), reg);
|
|
137201
137176
|
}
|
|
137202
137177
|
if (reg.fixIds) {
|
|
@@ -137207,7 +137182,7 @@ ${lanes.join("\n")}
|
|
|
137207
137182
|
}
|
|
137208
137183
|
}
|
|
137209
137184
|
function getSupportedErrorCodes() {
|
|
137210
|
-
return arrayFrom(errorCodeToFixes.keys());
|
|
137185
|
+
return errorCodeToFixesArray != null ? errorCodeToFixesArray : errorCodeToFixesArray = arrayFrom(errorCodeToFixes.keys());
|
|
137211
137186
|
}
|
|
137212
137187
|
function removeFixIdIfFixAllUnavailable(registration, diagnostics) {
|
|
137213
137188
|
const { errorCodes: errorCodes64 } = registration;
|
|
@@ -137256,7 +137231,7 @@ ${lanes.join("\n")}
|
|
|
137256
137231
|
...computeSuggestionDiagnostics(sourceFile, program, cancellationToken)
|
|
137257
137232
|
];
|
|
137258
137233
|
}
|
|
137259
|
-
var errorCodeToFixes, fixIdToRegistration;
|
|
137234
|
+
var errorCodeToFixes, fixIdToRegistration, errorCodeToFixesArray;
|
|
137260
137235
|
var init_codeFixProvider = __esm({
|
|
137261
137236
|
"src/services/codeFixProvider.ts"() {
|
|
137262
137237
|
"use strict";
|
|
@@ -150518,6 +150493,8 @@ ${lanes.join("\n")}
|
|
|
150518
150493
|
break;
|
|
150519
150494
|
case 41 /* AsteriskToken */:
|
|
150520
150495
|
return isMethodDeclaration(parent2) ? tryCast(parent2.parent, isObjectLiteralExpression) : void 0;
|
|
150496
|
+
case 132 /* AsyncKeyword */:
|
|
150497
|
+
return tryCast(parent2.parent, isObjectLiteralExpression);
|
|
150521
150498
|
case 79 /* Identifier */:
|
|
150522
150499
|
return contextToken.text === "async" && isShorthandPropertyAssignment(contextToken.parent) ? contextToken.parent.parent : void 0;
|
|
150523
150500
|
}
|
|
@@ -155682,7 +155659,7 @@ ${lanes.join("\n")}
|
|
|
155682
155659
|
const shouldSort = mode === "SortAndCombine" /* SortAndCombine */ || mode === "All" /* All */;
|
|
155683
155660
|
const shouldCombine = shouldSort;
|
|
155684
155661
|
const shouldRemove = mode === "RemoveUnused" /* RemoveUnused */ || mode === "All" /* All */;
|
|
155685
|
-
const topLevelImportGroupDecls =
|
|
155662
|
+
const topLevelImportGroupDecls = groupByNewlineContiguous(sourceFile, sourceFile.statements.filter(isImportDeclaration));
|
|
155686
155663
|
const comparer = getOrganizeImportsComparerWithDetection(preferences, shouldSort ? () => detectSortingWorker(topLevelImportGroupDecls, preferences) === 2 /* CaseInsensitive */ : void 0);
|
|
155687
155664
|
const processImportsOfSameModuleSpecifier = (importGroup) => {
|
|
155688
155665
|
if (shouldRemove)
|
|
@@ -155695,13 +155672,12 @@ ${lanes.join("\n")}
|
|
|
155695
155672
|
};
|
|
155696
155673
|
topLevelImportGroupDecls.forEach((importGroupDecl) => organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier));
|
|
155697
155674
|
if (mode !== "RemoveUnused" /* RemoveUnused */) {
|
|
155698
|
-
|
|
155699
|
-
organizeImportsWorker(topLevelExportDecls, (group2) => coalesceExportsWorker(group2, comparer));
|
|
155675
|
+
getTopLevelExportGroups(sourceFile).forEach((exportGroupDecl) => organizeImportsWorker(exportGroupDecl, (group2) => coalesceExportsWorker(group2, comparer)));
|
|
155700
155676
|
}
|
|
155701
155677
|
for (const ambientModule of sourceFile.statements.filter(isAmbientModule)) {
|
|
155702
155678
|
if (!ambientModule.body)
|
|
155703
155679
|
continue;
|
|
155704
|
-
const ambientModuleImportGroupDecls =
|
|
155680
|
+
const ambientModuleImportGroupDecls = groupByNewlineContiguous(sourceFile, ambientModule.body.statements.filter(isImportDeclaration));
|
|
155705
155681
|
ambientModuleImportGroupDecls.forEach((importGroupDecl) => organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier));
|
|
155706
155682
|
if (mode !== "RemoveUnused" /* RemoveUnused */) {
|
|
155707
155683
|
const ambientModuleExportDecls = ambientModule.body.statements.filter(isExportDeclaration);
|
|
@@ -155716,7 +155692,7 @@ ${lanes.join("\n")}
|
|
|
155716
155692
|
suppressLeadingTrivia(oldImportDecls[0]);
|
|
155717
155693
|
const oldImportGroups = shouldCombine ? group(oldImportDecls, (importDecl) => getExternalModuleName2(importDecl.moduleSpecifier)) : [oldImportDecls];
|
|
155718
155694
|
const sortedImportGroups = shouldSort ? stableSort(oldImportGroups, (group1, group2) => compareModuleSpecifiersWorker(group1[0].moduleSpecifier, group2[0].moduleSpecifier, comparer)) : oldImportGroups;
|
|
155719
|
-
const newImportDecls = flatMap(sortedImportGroups, (importGroup) => getExternalModuleName2(importGroup[0].moduleSpecifier) ? coalesce(importGroup) : importGroup);
|
|
155695
|
+
const newImportDecls = flatMap(sortedImportGroups, (importGroup) => getExternalModuleName2(importGroup[0].moduleSpecifier) || importGroup[0].moduleSpecifier === void 0 ? coalesce(importGroup) : importGroup);
|
|
155720
155696
|
if (newImportDecls.length === 0) {
|
|
155721
155697
|
changeTracker.deleteNodes(
|
|
155722
155698
|
sourceFile,
|
|
@@ -155743,29 +155719,29 @@ ${lanes.join("\n")}
|
|
|
155743
155719
|
}
|
|
155744
155720
|
}
|
|
155745
155721
|
}
|
|
155746
|
-
function
|
|
155722
|
+
function groupByNewlineContiguous(sourceFile, decls) {
|
|
155747
155723
|
const scanner2 = createScanner(
|
|
155748
155724
|
sourceFile.languageVersion,
|
|
155749
155725
|
/*skipTrivia*/
|
|
155750
155726
|
false,
|
|
155751
155727
|
sourceFile.languageVariant
|
|
155752
155728
|
);
|
|
155753
|
-
const
|
|
155729
|
+
const group2 = [];
|
|
155754
155730
|
let groupIndex = 0;
|
|
155755
|
-
for (const
|
|
155756
|
-
if (
|
|
155731
|
+
for (const decl of decls) {
|
|
155732
|
+
if (group2[groupIndex] && isNewGroup(sourceFile, decl, scanner2)) {
|
|
155757
155733
|
groupIndex++;
|
|
155758
155734
|
}
|
|
155759
|
-
if (!
|
|
155760
|
-
|
|
155735
|
+
if (!group2[groupIndex]) {
|
|
155736
|
+
group2[groupIndex] = [];
|
|
155761
155737
|
}
|
|
155762
|
-
|
|
155738
|
+
group2[groupIndex].push(decl);
|
|
155763
155739
|
}
|
|
155764
|
-
return
|
|
155740
|
+
return group2;
|
|
155765
155741
|
}
|
|
155766
|
-
function isNewGroup(sourceFile,
|
|
155767
|
-
const startPos =
|
|
155768
|
-
const endPos =
|
|
155742
|
+
function isNewGroup(sourceFile, decl, scanner2) {
|
|
155743
|
+
const startPos = decl.getFullStart();
|
|
155744
|
+
const endPos = decl.getStart();
|
|
155769
155745
|
scanner2.setText(sourceFile.text, startPos, endPos - startPos);
|
|
155770
155746
|
let numberOfNewLines = 0;
|
|
155771
155747
|
while (scanner2.getTokenPos() < endPos) {
|
|
@@ -156046,7 +156022,7 @@ ${lanes.join("\n")}
|
|
|
156046
156022
|
}
|
|
156047
156023
|
function detectSorting(sourceFile, preferences) {
|
|
156048
156024
|
return detectSortingWorker(
|
|
156049
|
-
|
|
156025
|
+
groupByNewlineContiguous(sourceFile, sourceFile.statements.filter(isImportDeclaration)),
|
|
156050
156026
|
preferences
|
|
156051
156027
|
);
|
|
156052
156028
|
}
|
|
@@ -156213,6 +156189,33 @@ ${lanes.join("\n")}
|
|
|
156213
156189
|
const ignoreCase = typeof preferences.organizeImportsIgnoreCase === "boolean" ? preferences.organizeImportsIgnoreCase : (_a2 = detectIgnoreCase == null ? void 0 : detectIgnoreCase()) != null ? _a2 : false;
|
|
156214
156190
|
return getOrganizeImportsComparer(preferences, ignoreCase);
|
|
156215
156191
|
}
|
|
156192
|
+
function getTopLevelExportGroups(sourceFile) {
|
|
156193
|
+
const topLevelExportGroups = [];
|
|
156194
|
+
const statements = sourceFile.statements;
|
|
156195
|
+
const len = length(statements);
|
|
156196
|
+
let i = 0;
|
|
156197
|
+
let groupIndex = 0;
|
|
156198
|
+
while (i < len) {
|
|
156199
|
+
if (isExportDeclaration(statements[i])) {
|
|
156200
|
+
if (topLevelExportGroups[groupIndex] === void 0) {
|
|
156201
|
+
topLevelExportGroups[groupIndex] = [];
|
|
156202
|
+
}
|
|
156203
|
+
const exportDecl = statements[i];
|
|
156204
|
+
if (exportDecl.moduleSpecifier) {
|
|
156205
|
+
topLevelExportGroups[groupIndex].push(exportDecl);
|
|
156206
|
+
i++;
|
|
156207
|
+
} else {
|
|
156208
|
+
while (i < len && isExportDeclaration(statements[i])) {
|
|
156209
|
+
topLevelExportGroups[groupIndex].push(statements[i++]);
|
|
156210
|
+
}
|
|
156211
|
+
groupIndex++;
|
|
156212
|
+
}
|
|
156213
|
+
} else {
|
|
156214
|
+
i++;
|
|
156215
|
+
}
|
|
156216
|
+
}
|
|
156217
|
+
return flatMap(topLevelExportGroups, (exportGroupDecls) => groupByNewlineContiguous(sourceFile, exportGroupDecls));
|
|
156218
|
+
}
|
|
156216
156219
|
var ImportSpecifierSortingCache, detectImportSpecifierSorting;
|
|
156217
156220
|
var init_organizeImports = __esm({
|
|
156218
156221
|
"src/services/organizeImports.ts"() {
|
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.1";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230304`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -3053,41 +3053,8 @@ ${lanes.join("\n")}
|
|
|
3053
3053
|
function tryGetNodePerformanceHooks() {
|
|
3054
3054
|
if (isNodeLikeSystem()) {
|
|
3055
3055
|
try {
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
if (hasRequiredAPI(nodePerformance, PerformanceObserver2)) {
|
|
3059
|
-
performance2 = nodePerformance;
|
|
3060
|
-
const version2 = new Version(process.versions.node);
|
|
3061
|
-
const range = new VersionRange("<12.16.3 || 13 <13.13");
|
|
3062
|
-
if (range.test(version2)) {
|
|
3063
|
-
performance2 = {
|
|
3064
|
-
get timeOrigin() {
|
|
3065
|
-
return nodePerformance.timeOrigin;
|
|
3066
|
-
},
|
|
3067
|
-
now() {
|
|
3068
|
-
return nodePerformance.now();
|
|
3069
|
-
},
|
|
3070
|
-
mark(name) {
|
|
3071
|
-
return nodePerformance.mark(name);
|
|
3072
|
-
},
|
|
3073
|
-
measure(name, start = "nodeStart", end) {
|
|
3074
|
-
if (end === void 0) {
|
|
3075
|
-
end = "__performance.measure-fix__";
|
|
3076
|
-
nodePerformance.mark(end);
|
|
3077
|
-
}
|
|
3078
|
-
nodePerformance.measure(name, start, end);
|
|
3079
|
-
if (end === "__performance.measure-fix__") {
|
|
3080
|
-
nodePerformance.clearMarks("__performance.measure-fix__");
|
|
3081
|
-
}
|
|
3082
|
-
},
|
|
3083
|
-
clearMarks(name) {
|
|
3084
|
-
return nodePerformance.clearMarks(name);
|
|
3085
|
-
},
|
|
3086
|
-
clearMeasures(name) {
|
|
3087
|
-
return nodePerformance.clearMeasures(name);
|
|
3088
|
-
}
|
|
3089
|
-
};
|
|
3090
|
-
}
|
|
3056
|
+
const { performance: performance2, PerformanceObserver: PerformanceObserver2 } = require("perf_hooks");
|
|
3057
|
+
if (hasRequiredAPI(performance2, PerformanceObserver2)) {
|
|
3091
3058
|
return {
|
|
3092
3059
|
// By default, only write native events when generating a cpu profile or using the v8 profiler.
|
|
3093
3060
|
shouldWriteNativeEvents: false,
|
|
@@ -60625,6 +60592,9 @@ ${lanes.join("\n")}
|
|
|
60625
60592
|
function isTypeSubtypeOf(source, target) {
|
|
60626
60593
|
return isTypeRelatedTo(source, target, subtypeRelation);
|
|
60627
60594
|
}
|
|
60595
|
+
function isTypeStrictSubtypeOf(source, target) {
|
|
60596
|
+
return isTypeRelatedTo(source, target, strictSubtypeRelation);
|
|
60597
|
+
}
|
|
60628
60598
|
function isTypeAssignableTo(source, target) {
|
|
60629
60599
|
return isTypeRelatedTo(source, target, assignableRelation);
|
|
60630
60600
|
}
|
|
@@ -67721,7 +67691,7 @@ ${lanes.join("\n")}
|
|
|
67721
67691
|
const narrowedType = mapType(candidate, (c) => {
|
|
67722
67692
|
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
67723
67693
|
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
67724
|
-
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) =>
|
|
67694
|
+
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType);
|
|
67725
67695
|
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
67726
67696
|
});
|
|
67727
67697
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
@@ -71665,16 +71635,20 @@ ${lanes.join("\n")}
|
|
|
71665
71635
|
) : createTupleType([type], [8 /* Variadic */]);
|
|
71666
71636
|
}
|
|
71667
71637
|
function getSpreadArgumentType(args, index, argCount, restType, context, checkMode) {
|
|
71638
|
+
const inConstContext = isConstTypeVariable(restType);
|
|
71668
71639
|
if (index >= argCount - 1) {
|
|
71669
71640
|
const arg = args[argCount - 1];
|
|
71670
71641
|
if (isSpreadArgument(arg)) {
|
|
71671
|
-
|
|
71642
|
+
const spreadType = arg.kind === 234 /* SyntheticExpression */ ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode);
|
|
71643
|
+
if (isArrayLikeType(spreadType)) {
|
|
71644
|
+
return getMutableArrayOrTupleType(spreadType);
|
|
71645
|
+
}
|
|
71646
|
+
return createArrayType(checkIteratedTypeOrElementType(33 /* Spread */, spreadType, undefinedType, arg.kind === 227 /* SpreadElement */ ? arg.expression : arg), inConstContext);
|
|
71672
71647
|
}
|
|
71673
71648
|
}
|
|
71674
71649
|
const types = [];
|
|
71675
71650
|
const flags = [];
|
|
71676
71651
|
const names = [];
|
|
71677
|
-
const inConstContext = isConstTypeVariable(restType);
|
|
71678
71652
|
for (let i = index; i < argCount; i++) {
|
|
71679
71653
|
const arg = args[i];
|
|
71680
71654
|
if (isSpreadArgument(arg)) {
|
|
@@ -137211,6 +137185,7 @@ ${lanes.join("\n")}
|
|
|
137211
137185
|
}
|
|
137212
137186
|
function registerCodeFix(reg) {
|
|
137213
137187
|
for (const error of reg.errorCodes) {
|
|
137188
|
+
errorCodeToFixesArray = void 0;
|
|
137214
137189
|
errorCodeToFixes.add(String(error), reg);
|
|
137215
137190
|
}
|
|
137216
137191
|
if (reg.fixIds) {
|
|
@@ -137221,7 +137196,7 @@ ${lanes.join("\n")}
|
|
|
137221
137196
|
}
|
|
137222
137197
|
}
|
|
137223
137198
|
function getSupportedErrorCodes() {
|
|
137224
|
-
return arrayFrom(errorCodeToFixes.keys());
|
|
137199
|
+
return errorCodeToFixesArray != null ? errorCodeToFixesArray : errorCodeToFixesArray = arrayFrom(errorCodeToFixes.keys());
|
|
137225
137200
|
}
|
|
137226
137201
|
function removeFixIdIfFixAllUnavailable(registration, diagnostics) {
|
|
137227
137202
|
const { errorCodes: errorCodes64 } = registration;
|
|
@@ -137270,7 +137245,7 @@ ${lanes.join("\n")}
|
|
|
137270
137245
|
...computeSuggestionDiagnostics(sourceFile, program, cancellationToken)
|
|
137271
137246
|
];
|
|
137272
137247
|
}
|
|
137273
|
-
var errorCodeToFixes, fixIdToRegistration;
|
|
137248
|
+
var errorCodeToFixes, fixIdToRegistration, errorCodeToFixesArray;
|
|
137274
137249
|
var init_codeFixProvider = __esm({
|
|
137275
137250
|
"src/services/codeFixProvider.ts"() {
|
|
137276
137251
|
"use strict";
|
|
@@ -150532,6 +150507,8 @@ ${lanes.join("\n")}
|
|
|
150532
150507
|
break;
|
|
150533
150508
|
case 41 /* AsteriskToken */:
|
|
150534
150509
|
return isMethodDeclaration(parent2) ? tryCast(parent2.parent, isObjectLiteralExpression) : void 0;
|
|
150510
|
+
case 132 /* AsyncKeyword */:
|
|
150511
|
+
return tryCast(parent2.parent, isObjectLiteralExpression);
|
|
150535
150512
|
case 79 /* Identifier */:
|
|
150536
150513
|
return contextToken.text === "async" && isShorthandPropertyAssignment(contextToken.parent) ? contextToken.parent.parent : void 0;
|
|
150537
150514
|
}
|
|
@@ -155696,7 +155673,7 @@ ${lanes.join("\n")}
|
|
|
155696
155673
|
const shouldSort = mode === "SortAndCombine" /* SortAndCombine */ || mode === "All" /* All */;
|
|
155697
155674
|
const shouldCombine = shouldSort;
|
|
155698
155675
|
const shouldRemove = mode === "RemoveUnused" /* RemoveUnused */ || mode === "All" /* All */;
|
|
155699
|
-
const topLevelImportGroupDecls =
|
|
155676
|
+
const topLevelImportGroupDecls = groupByNewlineContiguous(sourceFile, sourceFile.statements.filter(isImportDeclaration));
|
|
155700
155677
|
const comparer = getOrganizeImportsComparerWithDetection(preferences, shouldSort ? () => detectSortingWorker(topLevelImportGroupDecls, preferences) === 2 /* CaseInsensitive */ : void 0);
|
|
155701
155678
|
const processImportsOfSameModuleSpecifier = (importGroup) => {
|
|
155702
155679
|
if (shouldRemove)
|
|
@@ -155709,13 +155686,12 @@ ${lanes.join("\n")}
|
|
|
155709
155686
|
};
|
|
155710
155687
|
topLevelImportGroupDecls.forEach((importGroupDecl) => organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier));
|
|
155711
155688
|
if (mode !== "RemoveUnused" /* RemoveUnused */) {
|
|
155712
|
-
|
|
155713
|
-
organizeImportsWorker(topLevelExportDecls, (group2) => coalesceExportsWorker(group2, comparer));
|
|
155689
|
+
getTopLevelExportGroups(sourceFile).forEach((exportGroupDecl) => organizeImportsWorker(exportGroupDecl, (group2) => coalesceExportsWorker(group2, comparer)));
|
|
155714
155690
|
}
|
|
155715
155691
|
for (const ambientModule of sourceFile.statements.filter(isAmbientModule)) {
|
|
155716
155692
|
if (!ambientModule.body)
|
|
155717
155693
|
continue;
|
|
155718
|
-
const ambientModuleImportGroupDecls =
|
|
155694
|
+
const ambientModuleImportGroupDecls = groupByNewlineContiguous(sourceFile, ambientModule.body.statements.filter(isImportDeclaration));
|
|
155719
155695
|
ambientModuleImportGroupDecls.forEach((importGroupDecl) => organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier));
|
|
155720
155696
|
if (mode !== "RemoveUnused" /* RemoveUnused */) {
|
|
155721
155697
|
const ambientModuleExportDecls = ambientModule.body.statements.filter(isExportDeclaration);
|
|
@@ -155730,7 +155706,7 @@ ${lanes.join("\n")}
|
|
|
155730
155706
|
suppressLeadingTrivia(oldImportDecls[0]);
|
|
155731
155707
|
const oldImportGroups = shouldCombine ? group(oldImportDecls, (importDecl) => getExternalModuleName2(importDecl.moduleSpecifier)) : [oldImportDecls];
|
|
155732
155708
|
const sortedImportGroups = shouldSort ? stableSort(oldImportGroups, (group1, group2) => compareModuleSpecifiersWorker(group1[0].moduleSpecifier, group2[0].moduleSpecifier, comparer)) : oldImportGroups;
|
|
155733
|
-
const newImportDecls = flatMap(sortedImportGroups, (importGroup) => getExternalModuleName2(importGroup[0].moduleSpecifier) ? coalesce(importGroup) : importGroup);
|
|
155709
|
+
const newImportDecls = flatMap(sortedImportGroups, (importGroup) => getExternalModuleName2(importGroup[0].moduleSpecifier) || importGroup[0].moduleSpecifier === void 0 ? coalesce(importGroup) : importGroup);
|
|
155734
155710
|
if (newImportDecls.length === 0) {
|
|
155735
155711
|
changeTracker.deleteNodes(
|
|
155736
155712
|
sourceFile,
|
|
@@ -155757,29 +155733,29 @@ ${lanes.join("\n")}
|
|
|
155757
155733
|
}
|
|
155758
155734
|
}
|
|
155759
155735
|
}
|
|
155760
|
-
function
|
|
155736
|
+
function groupByNewlineContiguous(sourceFile, decls) {
|
|
155761
155737
|
const scanner2 = createScanner(
|
|
155762
155738
|
sourceFile.languageVersion,
|
|
155763
155739
|
/*skipTrivia*/
|
|
155764
155740
|
false,
|
|
155765
155741
|
sourceFile.languageVariant
|
|
155766
155742
|
);
|
|
155767
|
-
const
|
|
155743
|
+
const group2 = [];
|
|
155768
155744
|
let groupIndex = 0;
|
|
155769
|
-
for (const
|
|
155770
|
-
if (
|
|
155745
|
+
for (const decl of decls) {
|
|
155746
|
+
if (group2[groupIndex] && isNewGroup(sourceFile, decl, scanner2)) {
|
|
155771
155747
|
groupIndex++;
|
|
155772
155748
|
}
|
|
155773
|
-
if (!
|
|
155774
|
-
|
|
155749
|
+
if (!group2[groupIndex]) {
|
|
155750
|
+
group2[groupIndex] = [];
|
|
155775
155751
|
}
|
|
155776
|
-
|
|
155752
|
+
group2[groupIndex].push(decl);
|
|
155777
155753
|
}
|
|
155778
|
-
return
|
|
155754
|
+
return group2;
|
|
155779
155755
|
}
|
|
155780
|
-
function isNewGroup(sourceFile,
|
|
155781
|
-
const startPos =
|
|
155782
|
-
const endPos =
|
|
155756
|
+
function isNewGroup(sourceFile, decl, scanner2) {
|
|
155757
|
+
const startPos = decl.getFullStart();
|
|
155758
|
+
const endPos = decl.getStart();
|
|
155783
155759
|
scanner2.setText(sourceFile.text, startPos, endPos - startPos);
|
|
155784
155760
|
let numberOfNewLines = 0;
|
|
155785
155761
|
while (scanner2.getTokenPos() < endPos) {
|
|
@@ -156060,7 +156036,7 @@ ${lanes.join("\n")}
|
|
|
156060
156036
|
}
|
|
156061
156037
|
function detectSorting(sourceFile, preferences) {
|
|
156062
156038
|
return detectSortingWorker(
|
|
156063
|
-
|
|
156039
|
+
groupByNewlineContiguous(sourceFile, sourceFile.statements.filter(isImportDeclaration)),
|
|
156064
156040
|
preferences
|
|
156065
156041
|
);
|
|
156066
156042
|
}
|
|
@@ -156227,6 +156203,33 @@ ${lanes.join("\n")}
|
|
|
156227
156203
|
const ignoreCase = typeof preferences.organizeImportsIgnoreCase === "boolean" ? preferences.organizeImportsIgnoreCase : (_a2 = detectIgnoreCase == null ? void 0 : detectIgnoreCase()) != null ? _a2 : false;
|
|
156228
156204
|
return getOrganizeImportsComparer(preferences, ignoreCase);
|
|
156229
156205
|
}
|
|
156206
|
+
function getTopLevelExportGroups(sourceFile) {
|
|
156207
|
+
const topLevelExportGroups = [];
|
|
156208
|
+
const statements = sourceFile.statements;
|
|
156209
|
+
const len = length(statements);
|
|
156210
|
+
let i = 0;
|
|
156211
|
+
let groupIndex = 0;
|
|
156212
|
+
while (i < len) {
|
|
156213
|
+
if (isExportDeclaration(statements[i])) {
|
|
156214
|
+
if (topLevelExportGroups[groupIndex] === void 0) {
|
|
156215
|
+
topLevelExportGroups[groupIndex] = [];
|
|
156216
|
+
}
|
|
156217
|
+
const exportDecl = statements[i];
|
|
156218
|
+
if (exportDecl.moduleSpecifier) {
|
|
156219
|
+
topLevelExportGroups[groupIndex].push(exportDecl);
|
|
156220
|
+
i++;
|
|
156221
|
+
} else {
|
|
156222
|
+
while (i < len && isExportDeclaration(statements[i])) {
|
|
156223
|
+
topLevelExportGroups[groupIndex].push(statements[i++]);
|
|
156224
|
+
}
|
|
156225
|
+
groupIndex++;
|
|
156226
|
+
}
|
|
156227
|
+
} else {
|
|
156228
|
+
i++;
|
|
156229
|
+
}
|
|
156230
|
+
}
|
|
156231
|
+
return flatMap(topLevelExportGroups, (exportGroupDecls) => groupByNewlineContiguous(sourceFile, exportGroupDecls));
|
|
156232
|
+
}
|
|
156230
156233
|
var ImportSpecifierSortingCache, detectImportSpecifierSorting;
|
|
156231
156234
|
var init_organizeImports = __esm({
|
|
156232
156235
|
"src/services/organizeImports.ts"() {
|
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.1";
|
|
57
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
57
|
+
var version = `${versionMajorMinor}.0-dev.20230304`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -2212,41 +2212,8 @@ function tryGetWebPerformanceHooks() {
|
|
|
2212
2212
|
function tryGetNodePerformanceHooks() {
|
|
2213
2213
|
if (isNodeLikeSystem()) {
|
|
2214
2214
|
try {
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
if (hasRequiredAPI(nodePerformance, PerformanceObserver2)) {
|
|
2218
|
-
performance2 = nodePerformance;
|
|
2219
|
-
const version2 = new Version(process.versions.node);
|
|
2220
|
-
const range = new VersionRange("<12.16.3 || 13 <13.13");
|
|
2221
|
-
if (range.test(version2)) {
|
|
2222
|
-
performance2 = {
|
|
2223
|
-
get timeOrigin() {
|
|
2224
|
-
return nodePerformance.timeOrigin;
|
|
2225
|
-
},
|
|
2226
|
-
now() {
|
|
2227
|
-
return nodePerformance.now();
|
|
2228
|
-
},
|
|
2229
|
-
mark(name) {
|
|
2230
|
-
return nodePerformance.mark(name);
|
|
2231
|
-
},
|
|
2232
|
-
measure(name, start = "nodeStart", end) {
|
|
2233
|
-
if (end === void 0) {
|
|
2234
|
-
end = "__performance.measure-fix__";
|
|
2235
|
-
nodePerformance.mark(end);
|
|
2236
|
-
}
|
|
2237
|
-
nodePerformance.measure(name, start, end);
|
|
2238
|
-
if (end === "__performance.measure-fix__") {
|
|
2239
|
-
nodePerformance.clearMarks("__performance.measure-fix__");
|
|
2240
|
-
}
|
|
2241
|
-
},
|
|
2242
|
-
clearMarks(name) {
|
|
2243
|
-
return nodePerformance.clearMarks(name);
|
|
2244
|
-
},
|
|
2245
|
-
clearMeasures(name) {
|
|
2246
|
-
return nodePerformance.clearMeasures(name);
|
|
2247
|
-
}
|
|
2248
|
-
};
|
|
2249
|
-
}
|
|
2215
|
+
const { performance: performance2, PerformanceObserver: PerformanceObserver2 } = require("perf_hooks");
|
|
2216
|
+
if (hasRequiredAPI(performance2, PerformanceObserver2)) {
|
|
2250
2217
|
return {
|
|
2251
2218
|
// By default, only write native events when generating a cpu profile or using the v8 profiler.
|
|
2252
2219
|
shouldWriteNativeEvents: false,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.1.0-dev.
|
|
5
|
+
"version": "5.1.0-dev.20230304",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|