typescript 5.1.0-dev.20230330 → 5.1.0-dev.20230331
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 +11 -17
- package/lib/tsserver.js +46 -39
- package/lib/tsserverlibrary.js +46 -39
- package/lib/typescript.js +36 -29
- package/lib/typingsInstaller.js +7 -8
- 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.1";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20230331`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -4076,7 +4076,7 @@ function createDynamicPriorityPollingWatchFile(host) {
|
|
|
4076
4076
|
queue.pollScheduled = false;
|
|
4077
4077
|
return queue;
|
|
4078
4078
|
}
|
|
4079
|
-
function pollPollingIntervalQueue(queue) {
|
|
4079
|
+
function pollPollingIntervalQueue(_timeoutType, queue) {
|
|
4080
4080
|
queue.pollIndex = pollQueue(queue, queue.pollingInterval, queue.pollIndex, pollingChunkSize[queue.pollingInterval]);
|
|
4081
4081
|
if (queue.length) {
|
|
4082
4082
|
scheduleNextPoll(queue.pollingInterval);
|
|
@@ -4085,7 +4085,7 @@ function createDynamicPriorityPollingWatchFile(host) {
|
|
|
4085
4085
|
queue.pollScheduled = false;
|
|
4086
4086
|
}
|
|
4087
4087
|
}
|
|
4088
|
-
function pollLowPollingIntervalQueue(queue) {
|
|
4088
|
+
function pollLowPollingIntervalQueue(_timeoutType, queue) {
|
|
4089
4089
|
pollQueue(
|
|
4090
4090
|
changedFilesInLastPoll,
|
|
4091
4091
|
250 /* Low */,
|
|
@@ -4093,7 +4093,7 @@ function createDynamicPriorityPollingWatchFile(host) {
|
|
|
4093
4093
|
0,
|
|
4094
4094
|
changedFilesInLastPoll.length
|
|
4095
4095
|
);
|
|
4096
|
-
pollPollingIntervalQueue(queue);
|
|
4096
|
+
pollPollingIntervalQueue(_timeoutType, queue);
|
|
4097
4097
|
if (!queue.pollScheduled && changedFilesInLastPoll.length) {
|
|
4098
4098
|
scheduleNextPoll(250 /* Low */);
|
|
4099
4099
|
}
|
|
@@ -4150,7 +4150,7 @@ function createDynamicPriorityPollingWatchFile(host) {
|
|
|
4150
4150
|
}
|
|
4151
4151
|
}
|
|
4152
4152
|
function scheduleNextPoll(pollingInterval) {
|
|
4153
|
-
pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval));
|
|
4153
|
+
pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingInterval === 250 /* Low */ ? "pollLowPollingIntervalQueue" : "pollPollingIntervalQueue", pollingIntervalQueue(pollingInterval));
|
|
4154
4154
|
}
|
|
4155
4155
|
}
|
|
4156
4156
|
function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) {
|
|
@@ -4229,7 +4229,7 @@ function createFixedChunkSizePollingWatchFile(host) {
|
|
|
4229
4229
|
function scheduleNextPoll() {
|
|
4230
4230
|
if (!watchedFiles.length || pollScheduled)
|
|
4231
4231
|
return;
|
|
4232
|
-
pollScheduled = host.setTimeout(pollQueue, 2e3 /* High
|
|
4232
|
+
pollScheduled = host.setTimeout(pollQueue, 2e3 /* High */, "pollQueue");
|
|
4233
4233
|
}
|
|
4234
4234
|
}
|
|
4235
4235
|
function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) {
|
|
@@ -4397,7 +4397,7 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
4397
4397
|
clearTimeout2(timerToUpdateChildWatches);
|
|
4398
4398
|
timerToUpdateChildWatches = void 0;
|
|
4399
4399
|
}
|
|
4400
|
-
timerToUpdateChildWatches = setTimeout2(onTimerToUpdateChildWatches, 1e3);
|
|
4400
|
+
timerToUpdateChildWatches = setTimeout2(onTimerToUpdateChildWatches, 1e3, "timerToUpdateChildWatches");
|
|
4401
4401
|
}
|
|
4402
4402
|
function onTimerToUpdateChildWatches() {
|
|
4403
4403
|
timerToUpdateChildWatches = void 0;
|
|
@@ -6216,7 +6216,6 @@ var Diagnostics = {
|
|
|
6216
6216
|
Constructors_for_derived_classes_must_contain_a_super_call: diag(2377, 1 /* Error */, "Constructors_for_derived_classes_must_contain_a_super_call_2377", "Constructors for derived classes must contain a 'super' call."),
|
|
6217
6217
|
A_get_accessor_must_return_a_value: diag(2378, 1 /* Error */, "A_get_accessor_must_return_a_value_2378", "A 'get' accessor must return a value."),
|
|
6218
6218
|
Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties: diag(2379, 1 /* Error */, "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_tr_2379", "Argument of type '{0}' is not assignable to parameter of type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties."),
|
|
6219
|
-
The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type: diag(2380, 1 /* Error */, "The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type_2380", "The return type of a 'get' accessor must be assignable to its 'set' accessor type"),
|
|
6220
6219
|
Overload_signatures_must_all_be_exported_or_non_exported: diag(2383, 1 /* Error */, "Overload_signatures_must_all_be_exported_or_non_exported_2383", "Overload signatures must all be exported or non-exported."),
|
|
6221
6220
|
Overload_signatures_must_all_be_ambient_or_non_ambient: diag(2384, 1 /* Error */, "Overload_signatures_must_all_be_ambient_or_non_ambient_2384", "Overload signatures must all be ambient or non-ambient."),
|
|
6222
6221
|
Overload_signatures_must_all_be_public_private_or_protected: diag(2385, 1 /* Error */, "Overload_signatures_must_all_be_public_private_or_protected_2385", "Overload signatures must all be public, private or protected."),
|
|
@@ -74642,11 +74641,6 @@ function createTypeChecker(host) {
|
|
|
74642
74641
|
error(getter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
|
|
74643
74642
|
error(setter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
|
|
74644
74643
|
}
|
|
74645
|
-
const getterType = getAnnotatedAccessorType(getter);
|
|
74646
|
-
const setterType = getAnnotatedAccessorType(setter);
|
|
74647
|
-
if (getterType && setterType) {
|
|
74648
|
-
checkTypeAssignableTo(getterType, setterType, getter, Diagnostics.The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type);
|
|
74649
|
-
}
|
|
74650
74644
|
}
|
|
74651
74645
|
}
|
|
74652
74646
|
const returnType = getTypeOfAccessors(getSymbolOfDeclaration(node));
|
|
@@ -119924,7 +119918,7 @@ function createWatchProgram(host) {
|
|
|
119924
119918
|
}
|
|
119925
119919
|
const pending = clearInvalidateResolutionsOfFailedLookupLocations();
|
|
119926
119920
|
writeLog(`Scheduling invalidateFailedLookup${pending ? ", Cancelled earlier one" : ""}`);
|
|
119927
|
-
timerToInvalidateFailedLookupResolutions = host.setTimeout(invalidateResolutionsOfFailedLookup, 250);
|
|
119921
|
+
timerToInvalidateFailedLookupResolutions = host.setTimeout(invalidateResolutionsOfFailedLookup, 250, "timerToInvalidateFailedLookupResolutions");
|
|
119928
119922
|
}
|
|
119929
119923
|
function invalidateResolutionsOfFailedLookup() {
|
|
119930
119924
|
timerToInvalidateFailedLookupResolutions = void 0;
|
|
@@ -119940,7 +119934,7 @@ function createWatchProgram(host) {
|
|
|
119940
119934
|
host.clearTimeout(timerToUpdateProgram);
|
|
119941
119935
|
}
|
|
119942
119936
|
writeLog("Scheduling update");
|
|
119943
|
-
timerToUpdateProgram = host.setTimeout(updateProgramWithWatchStatus, 250);
|
|
119937
|
+
timerToUpdateProgram = host.setTimeout(updateProgramWithWatchStatus, 250, "timerToUpdateProgram");
|
|
119944
119938
|
}
|
|
119945
119939
|
function scheduleProgramReload() {
|
|
119946
119940
|
Debug.assert(!!configFileName);
|
|
@@ -121818,9 +121812,9 @@ function scheduleBuildInvalidatedProject(state, time, changeDetected) {
|
|
|
121818
121812
|
if (state.timerToBuildInvalidatedProject) {
|
|
121819
121813
|
hostWithWatch.clearTimeout(state.timerToBuildInvalidatedProject);
|
|
121820
121814
|
}
|
|
121821
|
-
state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected);
|
|
121815
|
+
state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, "timerToBuildInvalidatedProject", state, changeDetected);
|
|
121822
121816
|
}
|
|
121823
|
-
function buildNextInvalidatedProject(state, changeDetected) {
|
|
121817
|
+
function buildNextInvalidatedProject(_timeoutType, state, changeDetected) {
|
|
121824
121818
|
mark("SolutionBuilder::beforeBuild");
|
|
121825
121819
|
const buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected);
|
|
121826
121820
|
mark("SolutionBuilder::afterBuild");
|
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.20230331`;
|
|
2290
2290
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2291
2291
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2292
2292
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -7548,7 +7548,7 @@ function createDynamicPriorityPollingWatchFile(host) {
|
|
|
7548
7548
|
queue.pollScheduled = false;
|
|
7549
7549
|
return queue;
|
|
7550
7550
|
}
|
|
7551
|
-
function pollPollingIntervalQueue(queue) {
|
|
7551
|
+
function pollPollingIntervalQueue(_timeoutType, queue) {
|
|
7552
7552
|
queue.pollIndex = pollQueue(queue, queue.pollingInterval, queue.pollIndex, pollingChunkSize[queue.pollingInterval]);
|
|
7553
7553
|
if (queue.length) {
|
|
7554
7554
|
scheduleNextPoll(queue.pollingInterval);
|
|
@@ -7557,7 +7557,7 @@ function createDynamicPriorityPollingWatchFile(host) {
|
|
|
7557
7557
|
queue.pollScheduled = false;
|
|
7558
7558
|
}
|
|
7559
7559
|
}
|
|
7560
|
-
function pollLowPollingIntervalQueue(queue) {
|
|
7560
|
+
function pollLowPollingIntervalQueue(_timeoutType, queue) {
|
|
7561
7561
|
pollQueue(
|
|
7562
7562
|
changedFilesInLastPoll,
|
|
7563
7563
|
250 /* Low */,
|
|
@@ -7565,7 +7565,7 @@ function createDynamicPriorityPollingWatchFile(host) {
|
|
|
7565
7565
|
0,
|
|
7566
7566
|
changedFilesInLastPoll.length
|
|
7567
7567
|
);
|
|
7568
|
-
pollPollingIntervalQueue(queue);
|
|
7568
|
+
pollPollingIntervalQueue(_timeoutType, queue);
|
|
7569
7569
|
if (!queue.pollScheduled && changedFilesInLastPoll.length) {
|
|
7570
7570
|
scheduleNextPoll(250 /* Low */);
|
|
7571
7571
|
}
|
|
@@ -7622,7 +7622,7 @@ function createDynamicPriorityPollingWatchFile(host) {
|
|
|
7622
7622
|
}
|
|
7623
7623
|
}
|
|
7624
7624
|
function scheduleNextPoll(pollingInterval) {
|
|
7625
|
-
pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval));
|
|
7625
|
+
pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingInterval === 250 /* Low */ ? "pollLowPollingIntervalQueue" : "pollPollingIntervalQueue", pollingIntervalQueue(pollingInterval));
|
|
7626
7626
|
}
|
|
7627
7627
|
}
|
|
7628
7628
|
function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) {
|
|
@@ -7701,7 +7701,7 @@ function createFixedChunkSizePollingWatchFile(host) {
|
|
|
7701
7701
|
function scheduleNextPoll() {
|
|
7702
7702
|
if (!watchedFiles.length || pollScheduled)
|
|
7703
7703
|
return;
|
|
7704
|
-
pollScheduled = host.setTimeout(pollQueue, 2e3 /* High
|
|
7704
|
+
pollScheduled = host.setTimeout(pollQueue, 2e3 /* High */, "pollQueue");
|
|
7705
7705
|
}
|
|
7706
7706
|
}
|
|
7707
7707
|
function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) {
|
|
@@ -7869,7 +7869,7 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
7869
7869
|
clearTimeout2(timerToUpdateChildWatches);
|
|
7870
7870
|
timerToUpdateChildWatches = void 0;
|
|
7871
7871
|
}
|
|
7872
|
-
timerToUpdateChildWatches = setTimeout2(onTimerToUpdateChildWatches, 1e3);
|
|
7872
|
+
timerToUpdateChildWatches = setTimeout2(onTimerToUpdateChildWatches, 1e3, "timerToUpdateChildWatches");
|
|
7873
7873
|
}
|
|
7874
7874
|
function onTimerToUpdateChildWatches() {
|
|
7875
7875
|
timerToUpdateChildWatches = void 0;
|
|
@@ -9709,7 +9709,6 @@ var Diagnostics = {
|
|
|
9709
9709
|
Constructors_for_derived_classes_must_contain_a_super_call: diag(2377, 1 /* Error */, "Constructors_for_derived_classes_must_contain_a_super_call_2377", "Constructors for derived classes must contain a 'super' call."),
|
|
9710
9710
|
A_get_accessor_must_return_a_value: diag(2378, 1 /* Error */, "A_get_accessor_must_return_a_value_2378", "A 'get' accessor must return a value."),
|
|
9711
9711
|
Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties: diag(2379, 1 /* Error */, "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_tr_2379", "Argument of type '{0}' is not assignable to parameter of type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties."),
|
|
9712
|
-
The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type: diag(2380, 1 /* Error */, "The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type_2380", "The return type of a 'get' accessor must be assignable to its 'set' accessor type"),
|
|
9713
9712
|
Overload_signatures_must_all_be_exported_or_non_exported: diag(2383, 1 /* Error */, "Overload_signatures_must_all_be_exported_or_non_exported_2383", "Overload signatures must all be exported or non-exported."),
|
|
9714
9713
|
Overload_signatures_must_all_be_ambient_or_non_ambient: diag(2384, 1 /* Error */, "Overload_signatures_must_all_be_ambient_or_non_ambient_2384", "Overload signatures must all be ambient or non-ambient."),
|
|
9715
9714
|
Overload_signatures_must_all_be_public_private_or_protected: diag(2385, 1 /* Error */, "Overload_signatures_must_all_be_public_private_or_protected_2385", "Overload signatures must all be public, private or protected."),
|
|
@@ -79284,11 +79283,6 @@ function createTypeChecker(host) {
|
|
|
79284
79283
|
error(getter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
|
|
79285
79284
|
error(setter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
|
|
79286
79285
|
}
|
|
79287
|
-
const getterType = getAnnotatedAccessorType(getter);
|
|
79288
|
-
const setterType = getAnnotatedAccessorType(setter);
|
|
79289
|
-
if (getterType && setterType) {
|
|
79290
|
-
checkTypeAssignableTo(getterType, setterType, getter, Diagnostics.The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type);
|
|
79291
|
-
}
|
|
79292
79286
|
}
|
|
79293
79287
|
}
|
|
79294
79288
|
const returnType = getTypeOfAccessors(getSymbolOfDeclaration(node));
|
|
@@ -124859,7 +124853,7 @@ function createWatchProgram(host) {
|
|
|
124859
124853
|
}
|
|
124860
124854
|
const pending = clearInvalidateResolutionsOfFailedLookupLocations();
|
|
124861
124855
|
writeLog(`Scheduling invalidateFailedLookup${pending ? ", Cancelled earlier one" : ""}`);
|
|
124862
|
-
timerToInvalidateFailedLookupResolutions = host.setTimeout(invalidateResolutionsOfFailedLookup, 250);
|
|
124856
|
+
timerToInvalidateFailedLookupResolutions = host.setTimeout(invalidateResolutionsOfFailedLookup, 250, "timerToInvalidateFailedLookupResolutions");
|
|
124863
124857
|
}
|
|
124864
124858
|
function invalidateResolutionsOfFailedLookup() {
|
|
124865
124859
|
timerToInvalidateFailedLookupResolutions = void 0;
|
|
@@ -124875,7 +124869,7 @@ function createWatchProgram(host) {
|
|
|
124875
124869
|
host.clearTimeout(timerToUpdateProgram);
|
|
124876
124870
|
}
|
|
124877
124871
|
writeLog("Scheduling update");
|
|
124878
|
-
timerToUpdateProgram = host.setTimeout(updateProgramWithWatchStatus, 250);
|
|
124872
|
+
timerToUpdateProgram = host.setTimeout(updateProgramWithWatchStatus, 250, "timerToUpdateProgram");
|
|
124879
124873
|
}
|
|
124880
124874
|
function scheduleProgramReload() {
|
|
124881
124875
|
Debug.assert(!!configFileName);
|
|
@@ -126780,9 +126774,9 @@ function scheduleBuildInvalidatedProject(state, time, changeDetected) {
|
|
|
126780
126774
|
if (state.timerToBuildInvalidatedProject) {
|
|
126781
126775
|
hostWithWatch.clearTimeout(state.timerToBuildInvalidatedProject);
|
|
126782
126776
|
}
|
|
126783
|
-
state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected);
|
|
126777
|
+
state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, "timerToBuildInvalidatedProject", state, changeDetected);
|
|
126784
126778
|
}
|
|
126785
|
-
function buildNextInvalidatedProject(state, changeDetected) {
|
|
126779
|
+
function buildNextInvalidatedProject(_timeoutType, state, changeDetected) {
|
|
126786
126780
|
mark("SolutionBuilder::beforeBuild");
|
|
126787
126781
|
const buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected);
|
|
126788
126782
|
mark("SolutionBuilder::afterBuild");
|
|
@@ -142176,7 +142170,6 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
|
|
|
142176
142170
|
importClauseOrBindingPattern,
|
|
142177
142171
|
defaultImport,
|
|
142178
142172
|
arrayFrom(namedImports.entries(), ([name, addAsTypeOnly]) => ({ addAsTypeOnly, name })),
|
|
142179
|
-
compilerOptions,
|
|
142180
142173
|
preferences
|
|
142181
142174
|
);
|
|
142182
142175
|
});
|
|
@@ -142374,7 +142367,19 @@ function getAddAsTypeOnly(isValidTypeOnlyUseSite, isForNewImportDeclaration, sym
|
|
|
142374
142367
|
return 1 /* Allowed */;
|
|
142375
142368
|
}
|
|
142376
142369
|
function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker, compilerOptions) {
|
|
142377
|
-
|
|
142370
|
+
let best;
|
|
142371
|
+
for (const existingImport of existingImports) {
|
|
142372
|
+
const fix = getAddToExistingImportFix(existingImport);
|
|
142373
|
+
if (!fix)
|
|
142374
|
+
continue;
|
|
142375
|
+
const isTypeOnly = isTypeOnlyImportDeclaration(fix.importClauseOrBindingPattern);
|
|
142376
|
+
if (fix.addAsTypeOnly !== 4 /* NotAllowed */ && isTypeOnly || fix.addAsTypeOnly === 4 /* NotAllowed */ && !isTypeOnly) {
|
|
142377
|
+
return fix;
|
|
142378
|
+
}
|
|
142379
|
+
best != null ? best : best = fix;
|
|
142380
|
+
}
|
|
142381
|
+
return best;
|
|
142382
|
+
function getAddToExistingImportFix({ declaration, importKind, symbol, targetFlags }) {
|
|
142378
142383
|
if (importKind === 3 /* CommonJS */ || importKind === 2 /* Namespace */ || declaration.kind === 269 /* ImportEqualsDeclaration */) {
|
|
142379
142384
|
return void 0;
|
|
142380
142385
|
}
|
|
@@ -142382,11 +142387,13 @@ function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker
|
|
|
142382
142387
|
return (importKind === 0 /* Named */ || importKind === 1 /* Default */) && declaration.name.kind === 204 /* ObjectBindingPattern */ ? { kind: 2 /* AddToExisting */, importClauseOrBindingPattern: declaration.name, importKind, moduleSpecifier: declaration.initializer.arguments[0].text, addAsTypeOnly: 4 /* NotAllowed */ } : void 0;
|
|
142383
142388
|
}
|
|
142384
142389
|
const { importClause } = declaration;
|
|
142385
|
-
if (!importClause || !isStringLiteralLike(declaration.moduleSpecifier))
|
|
142390
|
+
if (!importClause || !isStringLiteralLike(declaration.moduleSpecifier)) {
|
|
142386
142391
|
return void 0;
|
|
142392
|
+
}
|
|
142387
142393
|
const { name, namedBindings } = importClause;
|
|
142388
|
-
if (importClause.isTypeOnly && !(importKind === 0 /* Named */ && namedBindings))
|
|
142394
|
+
if (importClause.isTypeOnly && !(importKind === 0 /* Named */ && namedBindings)) {
|
|
142389
142395
|
return void 0;
|
|
142396
|
+
}
|
|
142390
142397
|
const addAsTypeOnly = getAddAsTypeOnly(
|
|
142391
142398
|
isValidTypeOnlyUseSite,
|
|
142392
142399
|
/*isForNewImportDeclaration*/
|
|
@@ -142397,10 +142404,12 @@ function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker
|
|
|
142397
142404
|
compilerOptions
|
|
142398
142405
|
);
|
|
142399
142406
|
if (importKind === 1 /* Default */ && (name || // Cannot add a default import to a declaration that already has one
|
|
142400
|
-
addAsTypeOnly === 2 /* Required */ && namedBindings))
|
|
142407
|
+
addAsTypeOnly === 2 /* Required */ && namedBindings)) {
|
|
142401
142408
|
return void 0;
|
|
142402
|
-
|
|
142409
|
+
}
|
|
142410
|
+
if (importKind === 0 /* Named */ && (namedBindings == null ? void 0 : namedBindings.kind) === 272 /* NamespaceImport */) {
|
|
142403
142411
|
return void 0;
|
|
142412
|
+
}
|
|
142404
142413
|
return {
|
|
142405
142414
|
kind: 2 /* AddToExisting */,
|
|
142406
142415
|
importClauseOrBindingPattern: importClause,
|
|
@@ -142408,7 +142417,7 @@ function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker
|
|
|
142408
142417
|
moduleSpecifier: declaration.moduleSpecifier.text,
|
|
142409
142418
|
addAsTypeOnly
|
|
142410
142419
|
};
|
|
142411
|
-
}
|
|
142420
|
+
}
|
|
142412
142421
|
}
|
|
142413
142422
|
function createExistingImportMap(checker, importingFile, compilerOptions) {
|
|
142414
142423
|
let importMap;
|
|
@@ -142837,7 +142846,6 @@ function codeActionForFixWorker(changes, sourceFile, symbolName2, fix, includeSy
|
|
|
142837
142846
|
importClauseOrBindingPattern,
|
|
142838
142847
|
importKind === 1 /* Default */ ? { name: symbolName2, addAsTypeOnly } : void 0,
|
|
142839
142848
|
importKind === 0 /* Named */ ? [{ name: symbolName2, addAsTypeOnly }] : emptyArray,
|
|
142840
|
-
compilerOptions,
|
|
142841
142849
|
preferences
|
|
142842
142850
|
);
|
|
142843
142851
|
const moduleSpecifierWithoutQuotes = stripQuotes(moduleSpecifier);
|
|
@@ -142939,7 +142947,7 @@ function promoteFromTypeOnly(changes, aliasDeclaration, compilerOptions, sourceF
|
|
|
142939
142947
|
}
|
|
142940
142948
|
}
|
|
142941
142949
|
}
|
|
142942
|
-
function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports,
|
|
142950
|
+
function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports, preferences) {
|
|
142943
142951
|
var _a2;
|
|
142944
142952
|
if (clause.kind === 204 /* ObjectBindingPattern */) {
|
|
142945
142953
|
if (defaultImport) {
|
|
@@ -142957,7 +142965,6 @@ function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImpor
|
|
|
142957
142965
|
}
|
|
142958
142966
|
const promoteFromTypeOnly2 = clause.isTypeOnly && some([defaultImport, ...namedImports], (i) => (i == null ? void 0 : i.addAsTypeOnly) === 4 /* NotAllowed */);
|
|
142959
142967
|
const existingSpecifiers = clause.namedBindings && ((_a2 = tryCast(clause.namedBindings, isNamedImports)) == null ? void 0 : _a2.elements);
|
|
142960
|
-
const convertExistingToTypeOnly = promoteFromTypeOnly2 && importNameElisionDisabled(compilerOptions);
|
|
142961
142968
|
if (defaultImport) {
|
|
142962
142969
|
Debug.assert(!clause.name, "Cannot add a default import to an import clause that already has one");
|
|
142963
142970
|
changes.insertNodeAt(sourceFile, clause.getStart(sourceFile), factory.createIdentifier(defaultImport.name), { suffix: ", " });
|
|
@@ -142988,7 +142995,7 @@ function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImpor
|
|
|
142988
142995
|
const specifierSort = (existingSpecifiers == null ? void 0 : existingSpecifiers.length) && ts_OrganizeImports_exports.detectImportSpecifierSorting(existingSpecifiers, preferences);
|
|
142989
142996
|
if (specifierSort && !(ignoreCaseForSorting && specifierSort === 1 /* CaseSensitive */)) {
|
|
142990
142997
|
for (const spec of newSpecifiers) {
|
|
142991
|
-
const insertionIndex =
|
|
142998
|
+
const insertionIndex = promoteFromTypeOnly2 && !spec.isTypeOnly ? 0 : ts_OrganizeImports_exports.getImportSpecifierInsertionIndex(existingSpecifiers, spec, comparer);
|
|
142992
142999
|
changes.insertImportSpecifierAtIndex(sourceFile, spec, clause.namedBindings, insertionIndex);
|
|
142993
143000
|
}
|
|
142994
143001
|
} else if (existingSpecifiers == null ? void 0 : existingSpecifiers.length) {
|
|
@@ -143008,7 +143015,7 @@ function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImpor
|
|
|
143008
143015
|
}
|
|
143009
143016
|
if (promoteFromTypeOnly2) {
|
|
143010
143017
|
changes.delete(sourceFile, getTypeKeywordOfTypeOnlyImport(clause, sourceFile));
|
|
143011
|
-
if (
|
|
143018
|
+
if (existingSpecifiers) {
|
|
143012
143019
|
for (const specifier of existingSpecifiers) {
|
|
143013
143020
|
changes.insertModifierBefore(sourceFile, 155 /* TypeKeyword */, specifier);
|
|
143014
143021
|
}
|
|
@@ -170889,7 +170896,7 @@ var ThrottledOperations = class {
|
|
|
170889
170896
|
if (pendingTimeout) {
|
|
170890
170897
|
this.host.clearTimeout(pendingTimeout);
|
|
170891
170898
|
}
|
|
170892
|
-
this.pendingTimeouts.set(operationId, this.host.setTimeout(ThrottledOperations.run, delay,
|
|
170899
|
+
this.pendingTimeouts.set(operationId, this.host.setTimeout(ThrottledOperations.run, delay, operationId, this, cb));
|
|
170893
170900
|
if (this.logger) {
|
|
170894
170901
|
this.logger.info(`Scheduled: ${operationId}${pendingTimeout ? ", Cancelled earlier one" : ""}`);
|
|
170895
170902
|
}
|
|
@@ -170901,7 +170908,7 @@ var ThrottledOperations = class {
|
|
|
170901
170908
|
this.host.clearTimeout(pendingTimeout);
|
|
170902
170909
|
return this.pendingTimeouts.delete(operationId);
|
|
170903
170910
|
}
|
|
170904
|
-
static run(
|
|
170911
|
+
static run(operationId, self, cb) {
|
|
170905
170912
|
var _a2, _b;
|
|
170906
170913
|
(_a2 = perfLogger) == null ? void 0 : _a2.logStartScheduledOperation(operationId);
|
|
170907
170914
|
self.pendingTimeouts.delete(operationId);
|
|
@@ -177543,21 +177550,21 @@ var MultistepOperation = class {
|
|
|
177543
177550
|
this.setTimerHandle(void 0);
|
|
177544
177551
|
this.setImmediateId(void 0);
|
|
177545
177552
|
}
|
|
177546
|
-
immediate(action) {
|
|
177553
|
+
immediate(actionType, action) {
|
|
177547
177554
|
const requestId = this.requestId;
|
|
177548
177555
|
Debug.assert(requestId === this.operationHost.getCurrentRequestId(), "immediate: incorrect request id");
|
|
177549
177556
|
this.setImmediateId(this.operationHost.getServerHost().setImmediate(() => {
|
|
177550
177557
|
this.immediateId = void 0;
|
|
177551
177558
|
this.operationHost.executeWithRequestId(requestId, () => this.executeAction(action));
|
|
177552
|
-
}));
|
|
177559
|
+
}, actionType));
|
|
177553
177560
|
}
|
|
177554
|
-
delay(ms, action) {
|
|
177561
|
+
delay(actionType, ms, action) {
|
|
177555
177562
|
const requestId = this.requestId;
|
|
177556
177563
|
Debug.assert(requestId === this.operationHost.getCurrentRequestId(), "delay: incorrect request id");
|
|
177557
177564
|
this.setTimerHandle(this.operationHost.getServerHost().setTimeout(() => {
|
|
177558
177565
|
this.timerHandle = void 0;
|
|
177559
177566
|
this.operationHost.executeWithRequestId(requestId, () => this.executeAction(action));
|
|
177560
|
-
}, ms));
|
|
177567
|
+
}, ms, actionType));
|
|
177561
177568
|
}
|
|
177562
177569
|
executeAction(action) {
|
|
177563
177570
|
var _a2, _b, _c, _d, _e, _f;
|
|
@@ -178871,7 +178878,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
178871
178878
|
const goNext = () => {
|
|
178872
178879
|
index++;
|
|
178873
178880
|
if (checkList.length > index) {
|
|
178874
|
-
next.delay(followMs, checkOne);
|
|
178881
|
+
next.delay("checkOne", followMs, checkOne);
|
|
178875
178882
|
}
|
|
178876
178883
|
};
|
|
178877
178884
|
const checkOne = () => {
|
|
@@ -178899,7 +178906,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
178899
178906
|
goNext();
|
|
178900
178907
|
return;
|
|
178901
178908
|
}
|
|
178902
|
-
next.immediate(() => {
|
|
178909
|
+
next.immediate("semanticCheck", () => {
|
|
178903
178910
|
this.semanticCheck(fileName, project);
|
|
178904
178911
|
if (this.changeSeq !== seq) {
|
|
178905
178912
|
return;
|
|
@@ -178908,14 +178915,14 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
178908
178915
|
goNext();
|
|
178909
178916
|
return;
|
|
178910
178917
|
}
|
|
178911
|
-
next.immediate(() => {
|
|
178918
|
+
next.immediate("suggestionCheck", () => {
|
|
178912
178919
|
this.suggestionCheck(fileName, project);
|
|
178913
178920
|
goNext();
|
|
178914
178921
|
});
|
|
178915
178922
|
});
|
|
178916
178923
|
};
|
|
178917
178924
|
if (checkList.length > index && this.changeSeq === seq) {
|
|
178918
|
-
next.delay(ms, checkOne);
|
|
178925
|
+
next.delay("checkOne", ms, checkOne);
|
|
178919
178926
|
}
|
|
178920
178927
|
}
|
|
178921
178928
|
cleanProjects(caption, projects) {
|
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.20230331`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -5336,7 +5336,7 @@ ${lanes.join("\n")}
|
|
|
5336
5336
|
queue.pollScheduled = false;
|
|
5337
5337
|
return queue;
|
|
5338
5338
|
}
|
|
5339
|
-
function pollPollingIntervalQueue(queue) {
|
|
5339
|
+
function pollPollingIntervalQueue(_timeoutType, queue) {
|
|
5340
5340
|
queue.pollIndex = pollQueue(queue, queue.pollingInterval, queue.pollIndex, pollingChunkSize[queue.pollingInterval]);
|
|
5341
5341
|
if (queue.length) {
|
|
5342
5342
|
scheduleNextPoll(queue.pollingInterval);
|
|
@@ -5345,7 +5345,7 @@ ${lanes.join("\n")}
|
|
|
5345
5345
|
queue.pollScheduled = false;
|
|
5346
5346
|
}
|
|
5347
5347
|
}
|
|
5348
|
-
function pollLowPollingIntervalQueue(queue) {
|
|
5348
|
+
function pollLowPollingIntervalQueue(_timeoutType, queue) {
|
|
5349
5349
|
pollQueue(
|
|
5350
5350
|
changedFilesInLastPoll,
|
|
5351
5351
|
250 /* Low */,
|
|
@@ -5353,7 +5353,7 @@ ${lanes.join("\n")}
|
|
|
5353
5353
|
0,
|
|
5354
5354
|
changedFilesInLastPoll.length
|
|
5355
5355
|
);
|
|
5356
|
-
pollPollingIntervalQueue(queue);
|
|
5356
|
+
pollPollingIntervalQueue(_timeoutType, queue);
|
|
5357
5357
|
if (!queue.pollScheduled && changedFilesInLastPoll.length) {
|
|
5358
5358
|
scheduleNextPoll(250 /* Low */);
|
|
5359
5359
|
}
|
|
@@ -5410,7 +5410,7 @@ ${lanes.join("\n")}
|
|
|
5410
5410
|
}
|
|
5411
5411
|
}
|
|
5412
5412
|
function scheduleNextPoll(pollingInterval) {
|
|
5413
|
-
pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval));
|
|
5413
|
+
pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingInterval === 250 /* Low */ ? "pollLowPollingIntervalQueue" : "pollPollingIntervalQueue", pollingIntervalQueue(pollingInterval));
|
|
5414
5414
|
}
|
|
5415
5415
|
}
|
|
5416
5416
|
function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) {
|
|
@@ -5489,7 +5489,7 @@ ${lanes.join("\n")}
|
|
|
5489
5489
|
function scheduleNextPoll() {
|
|
5490
5490
|
if (!watchedFiles.length || pollScheduled)
|
|
5491
5491
|
return;
|
|
5492
|
-
pollScheduled = host.setTimeout(pollQueue, 2e3 /* High
|
|
5492
|
+
pollScheduled = host.setTimeout(pollQueue, 2e3 /* High */, "pollQueue");
|
|
5493
5493
|
}
|
|
5494
5494
|
}
|
|
5495
5495
|
function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) {
|
|
@@ -5655,7 +5655,7 @@ ${lanes.join("\n")}
|
|
|
5655
5655
|
clearTimeout2(timerToUpdateChildWatches);
|
|
5656
5656
|
timerToUpdateChildWatches = void 0;
|
|
5657
5657
|
}
|
|
5658
|
-
timerToUpdateChildWatches = setTimeout2(onTimerToUpdateChildWatches, 1e3);
|
|
5658
|
+
timerToUpdateChildWatches = setTimeout2(onTimerToUpdateChildWatches, 1e3, "timerToUpdateChildWatches");
|
|
5659
5659
|
}
|
|
5660
5660
|
function onTimerToUpdateChildWatches() {
|
|
5661
5661
|
timerToUpdateChildWatches = void 0;
|
|
@@ -7532,7 +7532,6 @@ ${lanes.join("\n")}
|
|
|
7532
7532
|
Constructors_for_derived_classes_must_contain_a_super_call: diag(2377, 1 /* Error */, "Constructors_for_derived_classes_must_contain_a_super_call_2377", "Constructors for derived classes must contain a 'super' call."),
|
|
7533
7533
|
A_get_accessor_must_return_a_value: diag(2378, 1 /* Error */, "A_get_accessor_must_return_a_value_2378", "A 'get' accessor must return a value."),
|
|
7534
7534
|
Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties: diag(2379, 1 /* Error */, "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_tr_2379", "Argument of type '{0}' is not assignable to parameter of type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties."),
|
|
7535
|
-
The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type: diag(2380, 1 /* Error */, "The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type_2380", "The return type of a 'get' accessor must be assignable to its 'set' accessor type"),
|
|
7536
7535
|
Overload_signatures_must_all_be_exported_or_non_exported: diag(2383, 1 /* Error */, "Overload_signatures_must_all_be_exported_or_non_exported_2383", "Overload signatures must all be exported or non-exported."),
|
|
7537
7536
|
Overload_signatures_must_all_be_ambient_or_non_ambient: diag(2384, 1 /* Error */, "Overload_signatures_must_all_be_ambient_or_non_ambient_2384", "Overload signatures must all be ambient or non-ambient."),
|
|
7538
7537
|
Overload_signatures_must_all_be_public_private_or_protected: diag(2385, 1 /* Error */, "Overload_signatures_must_all_be_public_private_or_protected_2385", "Overload signatures must all be public, private or protected."),
|
|
@@ -77092,11 +77091,6 @@ ${lanes.join("\n")}
|
|
|
77092
77091
|
error(getter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
|
|
77093
77092
|
error(setter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
|
|
77094
77093
|
}
|
|
77095
|
-
const getterType = getAnnotatedAccessorType(getter);
|
|
77096
|
-
const setterType = getAnnotatedAccessorType(setter);
|
|
77097
|
-
if (getterType && setterType) {
|
|
77098
|
-
checkTypeAssignableTo(getterType, setterType, getter, Diagnostics.The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type);
|
|
77099
|
-
}
|
|
77100
77094
|
}
|
|
77101
77095
|
}
|
|
77102
77096
|
const returnType = getTypeOfAccessors(getSymbolOfDeclaration(node));
|
|
@@ -123043,7 +123037,7 @@ ${lanes.join("\n")}
|
|
|
123043
123037
|
}
|
|
123044
123038
|
const pending = clearInvalidateResolutionsOfFailedLookupLocations();
|
|
123045
123039
|
writeLog(`Scheduling invalidateFailedLookup${pending ? ", Cancelled earlier one" : ""}`);
|
|
123046
|
-
timerToInvalidateFailedLookupResolutions = host.setTimeout(invalidateResolutionsOfFailedLookup, 250);
|
|
123040
|
+
timerToInvalidateFailedLookupResolutions = host.setTimeout(invalidateResolutionsOfFailedLookup, 250, "timerToInvalidateFailedLookupResolutions");
|
|
123047
123041
|
}
|
|
123048
123042
|
function invalidateResolutionsOfFailedLookup() {
|
|
123049
123043
|
timerToInvalidateFailedLookupResolutions = void 0;
|
|
@@ -123059,7 +123053,7 @@ ${lanes.join("\n")}
|
|
|
123059
123053
|
host.clearTimeout(timerToUpdateProgram);
|
|
123060
123054
|
}
|
|
123061
123055
|
writeLog("Scheduling update");
|
|
123062
|
-
timerToUpdateProgram = host.setTimeout(updateProgramWithWatchStatus, 250);
|
|
123056
|
+
timerToUpdateProgram = host.setTimeout(updateProgramWithWatchStatus, 250, "timerToUpdateProgram");
|
|
123063
123057
|
}
|
|
123064
123058
|
function scheduleProgramReload() {
|
|
123065
123059
|
Debug.assert(!!configFileName);
|
|
@@ -124969,9 +124963,9 @@ ${lanes.join("\n")}
|
|
|
124969
124963
|
if (state.timerToBuildInvalidatedProject) {
|
|
124970
124964
|
hostWithWatch.clearTimeout(state.timerToBuildInvalidatedProject);
|
|
124971
124965
|
}
|
|
124972
|
-
state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected);
|
|
124966
|
+
state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, "timerToBuildInvalidatedProject", state, changeDetected);
|
|
124973
124967
|
}
|
|
124974
|
-
function buildNextInvalidatedProject(state, changeDetected) {
|
|
124968
|
+
function buildNextInvalidatedProject(_timeoutType, state, changeDetected) {
|
|
124975
124969
|
mark("SolutionBuilder::beforeBuild");
|
|
124976
124970
|
const buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected);
|
|
124977
124971
|
mark("SolutionBuilder::afterBuild");
|
|
@@ -140727,7 +140721,6 @@ ${lanes.join("\n")}
|
|
|
140727
140721
|
importClauseOrBindingPattern,
|
|
140728
140722
|
defaultImport,
|
|
140729
140723
|
arrayFrom(namedImports.entries(), ([name, addAsTypeOnly]) => ({ addAsTypeOnly, name })),
|
|
140730
|
-
compilerOptions,
|
|
140731
140724
|
preferences
|
|
140732
140725
|
);
|
|
140733
140726
|
});
|
|
@@ -140925,7 +140918,19 @@ ${lanes.join("\n")}
|
|
|
140925
140918
|
return 1 /* Allowed */;
|
|
140926
140919
|
}
|
|
140927
140920
|
function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker, compilerOptions) {
|
|
140928
|
-
|
|
140921
|
+
let best;
|
|
140922
|
+
for (const existingImport of existingImports) {
|
|
140923
|
+
const fix = getAddToExistingImportFix(existingImport);
|
|
140924
|
+
if (!fix)
|
|
140925
|
+
continue;
|
|
140926
|
+
const isTypeOnly = isTypeOnlyImportDeclaration(fix.importClauseOrBindingPattern);
|
|
140927
|
+
if (fix.addAsTypeOnly !== 4 /* NotAllowed */ && isTypeOnly || fix.addAsTypeOnly === 4 /* NotAllowed */ && !isTypeOnly) {
|
|
140928
|
+
return fix;
|
|
140929
|
+
}
|
|
140930
|
+
best != null ? best : best = fix;
|
|
140931
|
+
}
|
|
140932
|
+
return best;
|
|
140933
|
+
function getAddToExistingImportFix({ declaration, importKind, symbol, targetFlags }) {
|
|
140929
140934
|
if (importKind === 3 /* CommonJS */ || importKind === 2 /* Namespace */ || declaration.kind === 269 /* ImportEqualsDeclaration */) {
|
|
140930
140935
|
return void 0;
|
|
140931
140936
|
}
|
|
@@ -140933,11 +140938,13 @@ ${lanes.join("\n")}
|
|
|
140933
140938
|
return (importKind === 0 /* Named */ || importKind === 1 /* Default */) && declaration.name.kind === 204 /* ObjectBindingPattern */ ? { kind: 2 /* AddToExisting */, importClauseOrBindingPattern: declaration.name, importKind, moduleSpecifier: declaration.initializer.arguments[0].text, addAsTypeOnly: 4 /* NotAllowed */ } : void 0;
|
|
140934
140939
|
}
|
|
140935
140940
|
const { importClause } = declaration;
|
|
140936
|
-
if (!importClause || !isStringLiteralLike(declaration.moduleSpecifier))
|
|
140941
|
+
if (!importClause || !isStringLiteralLike(declaration.moduleSpecifier)) {
|
|
140937
140942
|
return void 0;
|
|
140943
|
+
}
|
|
140938
140944
|
const { name, namedBindings } = importClause;
|
|
140939
|
-
if (importClause.isTypeOnly && !(importKind === 0 /* Named */ && namedBindings))
|
|
140945
|
+
if (importClause.isTypeOnly && !(importKind === 0 /* Named */ && namedBindings)) {
|
|
140940
140946
|
return void 0;
|
|
140947
|
+
}
|
|
140941
140948
|
const addAsTypeOnly = getAddAsTypeOnly(
|
|
140942
140949
|
isValidTypeOnlyUseSite,
|
|
140943
140950
|
/*isForNewImportDeclaration*/
|
|
@@ -140948,10 +140955,12 @@ ${lanes.join("\n")}
|
|
|
140948
140955
|
compilerOptions
|
|
140949
140956
|
);
|
|
140950
140957
|
if (importKind === 1 /* Default */ && (name || // Cannot add a default import to a declaration that already has one
|
|
140951
|
-
addAsTypeOnly === 2 /* Required */ && namedBindings))
|
|
140958
|
+
addAsTypeOnly === 2 /* Required */ && namedBindings)) {
|
|
140952
140959
|
return void 0;
|
|
140953
|
-
|
|
140960
|
+
}
|
|
140961
|
+
if (importKind === 0 /* Named */ && (namedBindings == null ? void 0 : namedBindings.kind) === 272 /* NamespaceImport */) {
|
|
140954
140962
|
return void 0;
|
|
140963
|
+
}
|
|
140955
140964
|
return {
|
|
140956
140965
|
kind: 2 /* AddToExisting */,
|
|
140957
140966
|
importClauseOrBindingPattern: importClause,
|
|
@@ -140959,7 +140968,7 @@ ${lanes.join("\n")}
|
|
|
140959
140968
|
moduleSpecifier: declaration.moduleSpecifier.text,
|
|
140960
140969
|
addAsTypeOnly
|
|
140961
140970
|
};
|
|
140962
|
-
}
|
|
140971
|
+
}
|
|
140963
140972
|
}
|
|
140964
140973
|
function createExistingImportMap(checker, importingFile, compilerOptions) {
|
|
140965
140974
|
let importMap;
|
|
@@ -141388,7 +141397,6 @@ ${lanes.join("\n")}
|
|
|
141388
141397
|
importClauseOrBindingPattern,
|
|
141389
141398
|
importKind === 1 /* Default */ ? { name: symbolName2, addAsTypeOnly } : void 0,
|
|
141390
141399
|
importKind === 0 /* Named */ ? [{ name: symbolName2, addAsTypeOnly }] : emptyArray,
|
|
141391
|
-
compilerOptions,
|
|
141392
141400
|
preferences
|
|
141393
141401
|
);
|
|
141394
141402
|
const moduleSpecifierWithoutQuotes = stripQuotes(moduleSpecifier);
|
|
@@ -141490,7 +141498,7 @@ ${lanes.join("\n")}
|
|
|
141490
141498
|
}
|
|
141491
141499
|
}
|
|
141492
141500
|
}
|
|
141493
|
-
function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports,
|
|
141501
|
+
function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports, preferences) {
|
|
141494
141502
|
var _a2;
|
|
141495
141503
|
if (clause.kind === 204 /* ObjectBindingPattern */) {
|
|
141496
141504
|
if (defaultImport) {
|
|
@@ -141508,7 +141516,6 @@ ${lanes.join("\n")}
|
|
|
141508
141516
|
}
|
|
141509
141517
|
const promoteFromTypeOnly2 = clause.isTypeOnly && some([defaultImport, ...namedImports], (i) => (i == null ? void 0 : i.addAsTypeOnly) === 4 /* NotAllowed */);
|
|
141510
141518
|
const existingSpecifiers = clause.namedBindings && ((_a2 = tryCast(clause.namedBindings, isNamedImports)) == null ? void 0 : _a2.elements);
|
|
141511
|
-
const convertExistingToTypeOnly = promoteFromTypeOnly2 && importNameElisionDisabled(compilerOptions);
|
|
141512
141519
|
if (defaultImport) {
|
|
141513
141520
|
Debug.assert(!clause.name, "Cannot add a default import to an import clause that already has one");
|
|
141514
141521
|
changes.insertNodeAt(sourceFile, clause.getStart(sourceFile), factory.createIdentifier(defaultImport.name), { suffix: ", " });
|
|
@@ -141539,7 +141546,7 @@ ${lanes.join("\n")}
|
|
|
141539
141546
|
const specifierSort = (existingSpecifiers == null ? void 0 : existingSpecifiers.length) && ts_OrganizeImports_exports.detectImportSpecifierSorting(existingSpecifiers, preferences);
|
|
141540
141547
|
if (specifierSort && !(ignoreCaseForSorting && specifierSort === 1 /* CaseSensitive */)) {
|
|
141541
141548
|
for (const spec of newSpecifiers) {
|
|
141542
|
-
const insertionIndex =
|
|
141549
|
+
const insertionIndex = promoteFromTypeOnly2 && !spec.isTypeOnly ? 0 : ts_OrganizeImports_exports.getImportSpecifierInsertionIndex(existingSpecifiers, spec, comparer);
|
|
141543
141550
|
changes.insertImportSpecifierAtIndex(sourceFile, spec, clause.namedBindings, insertionIndex);
|
|
141544
141551
|
}
|
|
141545
141552
|
} else if (existingSpecifiers == null ? void 0 : existingSpecifiers.length) {
|
|
@@ -141559,7 +141566,7 @@ ${lanes.join("\n")}
|
|
|
141559
141566
|
}
|
|
141560
141567
|
if (promoteFromTypeOnly2) {
|
|
141561
141568
|
changes.delete(sourceFile, getTypeKeywordOfTypeOnlyImport(clause, sourceFile));
|
|
141562
|
-
if (
|
|
141569
|
+
if (existingSpecifiers) {
|
|
141563
141570
|
for (const specifier of existingSpecifiers) {
|
|
141564
141571
|
changes.insertModifierBefore(sourceFile, 155 /* TypeKeyword */, specifier);
|
|
141565
141572
|
}
|
|
@@ -168202,7 +168209,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168202
168209
|
if (pendingTimeout) {
|
|
168203
168210
|
this.host.clearTimeout(pendingTimeout);
|
|
168204
168211
|
}
|
|
168205
|
-
this.pendingTimeouts.set(operationId, this.host.setTimeout(ThrottledOperations.run, delay,
|
|
168212
|
+
this.pendingTimeouts.set(operationId, this.host.setTimeout(ThrottledOperations.run, delay, operationId, this, cb));
|
|
168206
168213
|
if (this.logger) {
|
|
168207
168214
|
this.logger.info(`Scheduled: ${operationId}${pendingTimeout ? ", Cancelled earlier one" : ""}`);
|
|
168208
168215
|
}
|
|
@@ -168214,7 +168221,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168214
168221
|
this.host.clearTimeout(pendingTimeout);
|
|
168215
168222
|
return this.pendingTimeouts.delete(operationId);
|
|
168216
168223
|
}
|
|
168217
|
-
static run(
|
|
168224
|
+
static run(operationId, self, cb) {
|
|
168218
168225
|
var _a2, _b;
|
|
168219
168226
|
(_a2 = perfLogger) == null ? void 0 : _a2.logStartScheduledOperation(operationId);
|
|
168220
168227
|
self.pendingTimeouts.delete(operationId);
|
|
@@ -175238,21 +175245,21 @@ ${json}${newLine}`;
|
|
|
175238
175245
|
this.setTimerHandle(void 0);
|
|
175239
175246
|
this.setImmediateId(void 0);
|
|
175240
175247
|
}
|
|
175241
|
-
immediate(action) {
|
|
175248
|
+
immediate(actionType, action) {
|
|
175242
175249
|
const requestId = this.requestId;
|
|
175243
175250
|
Debug.assert(requestId === this.operationHost.getCurrentRequestId(), "immediate: incorrect request id");
|
|
175244
175251
|
this.setImmediateId(this.operationHost.getServerHost().setImmediate(() => {
|
|
175245
175252
|
this.immediateId = void 0;
|
|
175246
175253
|
this.operationHost.executeWithRequestId(requestId, () => this.executeAction(action));
|
|
175247
|
-
}));
|
|
175254
|
+
}, actionType));
|
|
175248
175255
|
}
|
|
175249
|
-
delay(ms, action) {
|
|
175256
|
+
delay(actionType, ms, action) {
|
|
175250
175257
|
const requestId = this.requestId;
|
|
175251
175258
|
Debug.assert(requestId === this.operationHost.getCurrentRequestId(), "delay: incorrect request id");
|
|
175252
175259
|
this.setTimerHandle(this.operationHost.getServerHost().setTimeout(() => {
|
|
175253
175260
|
this.timerHandle = void 0;
|
|
175254
175261
|
this.operationHost.executeWithRequestId(requestId, () => this.executeAction(action));
|
|
175255
|
-
}, ms));
|
|
175262
|
+
}, ms, actionType));
|
|
175256
175263
|
}
|
|
175257
175264
|
executeAction(action) {
|
|
175258
175265
|
var _a2, _b, _c, _d, _e, _f;
|
|
@@ -176289,7 +176296,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
176289
176296
|
const goNext = () => {
|
|
176290
176297
|
index++;
|
|
176291
176298
|
if (checkList.length > index) {
|
|
176292
|
-
next.delay(followMs, checkOne);
|
|
176299
|
+
next.delay("checkOne", followMs, checkOne);
|
|
176293
176300
|
}
|
|
176294
176301
|
};
|
|
176295
176302
|
const checkOne = () => {
|
|
@@ -176317,7 +176324,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
176317
176324
|
goNext();
|
|
176318
176325
|
return;
|
|
176319
176326
|
}
|
|
176320
|
-
next.immediate(() => {
|
|
176327
|
+
next.immediate("semanticCheck", () => {
|
|
176321
176328
|
this.semanticCheck(fileName, project);
|
|
176322
176329
|
if (this.changeSeq !== seq) {
|
|
176323
176330
|
return;
|
|
@@ -176326,14 +176333,14 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
176326
176333
|
goNext();
|
|
176327
176334
|
return;
|
|
176328
176335
|
}
|
|
176329
|
-
next.immediate(() => {
|
|
176336
|
+
next.immediate("suggestionCheck", () => {
|
|
176330
176337
|
this.suggestionCheck(fileName, project);
|
|
176331
176338
|
goNext();
|
|
176332
176339
|
});
|
|
176333
176340
|
});
|
|
176334
176341
|
};
|
|
176335
176342
|
if (checkList.length > index && this.changeSeq === seq) {
|
|
176336
|
-
next.delay(ms, checkOne);
|
|
176343
|
+
next.delay("checkOne", ms, checkOne);
|
|
176337
176344
|
}
|
|
176338
176345
|
}
|
|
176339
176346
|
cleanProjects(caption, projects) {
|
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.20230331`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -5336,7 +5336,7 @@ ${lanes.join("\n")}
|
|
|
5336
5336
|
queue.pollScheduled = false;
|
|
5337
5337
|
return queue;
|
|
5338
5338
|
}
|
|
5339
|
-
function pollPollingIntervalQueue(queue) {
|
|
5339
|
+
function pollPollingIntervalQueue(_timeoutType, queue) {
|
|
5340
5340
|
queue.pollIndex = pollQueue(queue, queue.pollingInterval, queue.pollIndex, pollingChunkSize[queue.pollingInterval]);
|
|
5341
5341
|
if (queue.length) {
|
|
5342
5342
|
scheduleNextPoll(queue.pollingInterval);
|
|
@@ -5345,7 +5345,7 @@ ${lanes.join("\n")}
|
|
|
5345
5345
|
queue.pollScheduled = false;
|
|
5346
5346
|
}
|
|
5347
5347
|
}
|
|
5348
|
-
function pollLowPollingIntervalQueue(queue) {
|
|
5348
|
+
function pollLowPollingIntervalQueue(_timeoutType, queue) {
|
|
5349
5349
|
pollQueue(
|
|
5350
5350
|
changedFilesInLastPoll,
|
|
5351
5351
|
250 /* Low */,
|
|
@@ -5353,7 +5353,7 @@ ${lanes.join("\n")}
|
|
|
5353
5353
|
0,
|
|
5354
5354
|
changedFilesInLastPoll.length
|
|
5355
5355
|
);
|
|
5356
|
-
pollPollingIntervalQueue(queue);
|
|
5356
|
+
pollPollingIntervalQueue(_timeoutType, queue);
|
|
5357
5357
|
if (!queue.pollScheduled && changedFilesInLastPoll.length) {
|
|
5358
5358
|
scheduleNextPoll(250 /* Low */);
|
|
5359
5359
|
}
|
|
@@ -5410,7 +5410,7 @@ ${lanes.join("\n")}
|
|
|
5410
5410
|
}
|
|
5411
5411
|
}
|
|
5412
5412
|
function scheduleNextPoll(pollingInterval) {
|
|
5413
|
-
pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval));
|
|
5413
|
+
pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingInterval === 250 /* Low */ ? "pollLowPollingIntervalQueue" : "pollPollingIntervalQueue", pollingIntervalQueue(pollingInterval));
|
|
5414
5414
|
}
|
|
5415
5415
|
}
|
|
5416
5416
|
function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) {
|
|
@@ -5489,7 +5489,7 @@ ${lanes.join("\n")}
|
|
|
5489
5489
|
function scheduleNextPoll() {
|
|
5490
5490
|
if (!watchedFiles.length || pollScheduled)
|
|
5491
5491
|
return;
|
|
5492
|
-
pollScheduled = host.setTimeout(pollQueue, 2e3 /* High
|
|
5492
|
+
pollScheduled = host.setTimeout(pollQueue, 2e3 /* High */, "pollQueue");
|
|
5493
5493
|
}
|
|
5494
5494
|
}
|
|
5495
5495
|
function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) {
|
|
@@ -5655,7 +5655,7 @@ ${lanes.join("\n")}
|
|
|
5655
5655
|
clearTimeout2(timerToUpdateChildWatches);
|
|
5656
5656
|
timerToUpdateChildWatches = void 0;
|
|
5657
5657
|
}
|
|
5658
|
-
timerToUpdateChildWatches = setTimeout2(onTimerToUpdateChildWatches, 1e3);
|
|
5658
|
+
timerToUpdateChildWatches = setTimeout2(onTimerToUpdateChildWatches, 1e3, "timerToUpdateChildWatches");
|
|
5659
5659
|
}
|
|
5660
5660
|
function onTimerToUpdateChildWatches() {
|
|
5661
5661
|
timerToUpdateChildWatches = void 0;
|
|
@@ -7532,7 +7532,6 @@ ${lanes.join("\n")}
|
|
|
7532
7532
|
Constructors_for_derived_classes_must_contain_a_super_call: diag(2377, 1 /* Error */, "Constructors_for_derived_classes_must_contain_a_super_call_2377", "Constructors for derived classes must contain a 'super' call."),
|
|
7533
7533
|
A_get_accessor_must_return_a_value: diag(2378, 1 /* Error */, "A_get_accessor_must_return_a_value_2378", "A 'get' accessor must return a value."),
|
|
7534
7534
|
Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties: diag(2379, 1 /* Error */, "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_tr_2379", "Argument of type '{0}' is not assignable to parameter of type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties."),
|
|
7535
|
-
The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type: diag(2380, 1 /* Error */, "The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type_2380", "The return type of a 'get' accessor must be assignable to its 'set' accessor type"),
|
|
7536
7535
|
Overload_signatures_must_all_be_exported_or_non_exported: diag(2383, 1 /* Error */, "Overload_signatures_must_all_be_exported_or_non_exported_2383", "Overload signatures must all be exported or non-exported."),
|
|
7537
7536
|
Overload_signatures_must_all_be_ambient_or_non_ambient: diag(2384, 1 /* Error */, "Overload_signatures_must_all_be_ambient_or_non_ambient_2384", "Overload signatures must all be ambient or non-ambient."),
|
|
7538
7537
|
Overload_signatures_must_all_be_public_private_or_protected: diag(2385, 1 /* Error */, "Overload_signatures_must_all_be_public_private_or_protected_2385", "Overload signatures must all be public, private or protected."),
|
|
@@ -77092,11 +77091,6 @@ ${lanes.join("\n")}
|
|
|
77092
77091
|
error(getter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
|
|
77093
77092
|
error(setter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
|
|
77094
77093
|
}
|
|
77095
|
-
const getterType = getAnnotatedAccessorType(getter);
|
|
77096
|
-
const setterType = getAnnotatedAccessorType(setter);
|
|
77097
|
-
if (getterType && setterType) {
|
|
77098
|
-
checkTypeAssignableTo(getterType, setterType, getter, Diagnostics.The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type);
|
|
77099
|
-
}
|
|
77100
77094
|
}
|
|
77101
77095
|
}
|
|
77102
77096
|
const returnType = getTypeOfAccessors(getSymbolOfDeclaration(node));
|
|
@@ -123043,7 +123037,7 @@ ${lanes.join("\n")}
|
|
|
123043
123037
|
}
|
|
123044
123038
|
const pending = clearInvalidateResolutionsOfFailedLookupLocations();
|
|
123045
123039
|
writeLog(`Scheduling invalidateFailedLookup${pending ? ", Cancelled earlier one" : ""}`);
|
|
123046
|
-
timerToInvalidateFailedLookupResolutions = host.setTimeout(invalidateResolutionsOfFailedLookup, 250);
|
|
123040
|
+
timerToInvalidateFailedLookupResolutions = host.setTimeout(invalidateResolutionsOfFailedLookup, 250, "timerToInvalidateFailedLookupResolutions");
|
|
123047
123041
|
}
|
|
123048
123042
|
function invalidateResolutionsOfFailedLookup() {
|
|
123049
123043
|
timerToInvalidateFailedLookupResolutions = void 0;
|
|
@@ -123059,7 +123053,7 @@ ${lanes.join("\n")}
|
|
|
123059
123053
|
host.clearTimeout(timerToUpdateProgram);
|
|
123060
123054
|
}
|
|
123061
123055
|
writeLog("Scheduling update");
|
|
123062
|
-
timerToUpdateProgram = host.setTimeout(updateProgramWithWatchStatus, 250);
|
|
123056
|
+
timerToUpdateProgram = host.setTimeout(updateProgramWithWatchStatus, 250, "timerToUpdateProgram");
|
|
123063
123057
|
}
|
|
123064
123058
|
function scheduleProgramReload() {
|
|
123065
123059
|
Debug.assert(!!configFileName);
|
|
@@ -124969,9 +124963,9 @@ ${lanes.join("\n")}
|
|
|
124969
124963
|
if (state.timerToBuildInvalidatedProject) {
|
|
124970
124964
|
hostWithWatch.clearTimeout(state.timerToBuildInvalidatedProject);
|
|
124971
124965
|
}
|
|
124972
|
-
state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected);
|
|
124966
|
+
state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, "timerToBuildInvalidatedProject", state, changeDetected);
|
|
124973
124967
|
}
|
|
124974
|
-
function buildNextInvalidatedProject(state, changeDetected) {
|
|
124968
|
+
function buildNextInvalidatedProject(_timeoutType, state, changeDetected) {
|
|
124975
124969
|
mark("SolutionBuilder::beforeBuild");
|
|
124976
124970
|
const buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected);
|
|
124977
124971
|
mark("SolutionBuilder::afterBuild");
|
|
@@ -140741,7 +140735,6 @@ ${lanes.join("\n")}
|
|
|
140741
140735
|
importClauseOrBindingPattern,
|
|
140742
140736
|
defaultImport,
|
|
140743
140737
|
arrayFrom(namedImports.entries(), ([name, addAsTypeOnly]) => ({ addAsTypeOnly, name })),
|
|
140744
|
-
compilerOptions,
|
|
140745
140738
|
preferences
|
|
140746
140739
|
);
|
|
140747
140740
|
});
|
|
@@ -140939,7 +140932,19 @@ ${lanes.join("\n")}
|
|
|
140939
140932
|
return 1 /* Allowed */;
|
|
140940
140933
|
}
|
|
140941
140934
|
function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker, compilerOptions) {
|
|
140942
|
-
|
|
140935
|
+
let best;
|
|
140936
|
+
for (const existingImport of existingImports) {
|
|
140937
|
+
const fix = getAddToExistingImportFix(existingImport);
|
|
140938
|
+
if (!fix)
|
|
140939
|
+
continue;
|
|
140940
|
+
const isTypeOnly = isTypeOnlyImportDeclaration(fix.importClauseOrBindingPattern);
|
|
140941
|
+
if (fix.addAsTypeOnly !== 4 /* NotAllowed */ && isTypeOnly || fix.addAsTypeOnly === 4 /* NotAllowed */ && !isTypeOnly) {
|
|
140942
|
+
return fix;
|
|
140943
|
+
}
|
|
140944
|
+
best != null ? best : best = fix;
|
|
140945
|
+
}
|
|
140946
|
+
return best;
|
|
140947
|
+
function getAddToExistingImportFix({ declaration, importKind, symbol, targetFlags }) {
|
|
140943
140948
|
if (importKind === 3 /* CommonJS */ || importKind === 2 /* Namespace */ || declaration.kind === 269 /* ImportEqualsDeclaration */) {
|
|
140944
140949
|
return void 0;
|
|
140945
140950
|
}
|
|
@@ -140947,11 +140952,13 @@ ${lanes.join("\n")}
|
|
|
140947
140952
|
return (importKind === 0 /* Named */ || importKind === 1 /* Default */) && declaration.name.kind === 204 /* ObjectBindingPattern */ ? { kind: 2 /* AddToExisting */, importClauseOrBindingPattern: declaration.name, importKind, moduleSpecifier: declaration.initializer.arguments[0].text, addAsTypeOnly: 4 /* NotAllowed */ } : void 0;
|
|
140948
140953
|
}
|
|
140949
140954
|
const { importClause } = declaration;
|
|
140950
|
-
if (!importClause || !isStringLiteralLike(declaration.moduleSpecifier))
|
|
140955
|
+
if (!importClause || !isStringLiteralLike(declaration.moduleSpecifier)) {
|
|
140951
140956
|
return void 0;
|
|
140957
|
+
}
|
|
140952
140958
|
const { name, namedBindings } = importClause;
|
|
140953
|
-
if (importClause.isTypeOnly && !(importKind === 0 /* Named */ && namedBindings))
|
|
140959
|
+
if (importClause.isTypeOnly && !(importKind === 0 /* Named */ && namedBindings)) {
|
|
140954
140960
|
return void 0;
|
|
140961
|
+
}
|
|
140955
140962
|
const addAsTypeOnly = getAddAsTypeOnly(
|
|
140956
140963
|
isValidTypeOnlyUseSite,
|
|
140957
140964
|
/*isForNewImportDeclaration*/
|
|
@@ -140962,10 +140969,12 @@ ${lanes.join("\n")}
|
|
|
140962
140969
|
compilerOptions
|
|
140963
140970
|
);
|
|
140964
140971
|
if (importKind === 1 /* Default */ && (name || // Cannot add a default import to a declaration that already has one
|
|
140965
|
-
addAsTypeOnly === 2 /* Required */ && namedBindings))
|
|
140972
|
+
addAsTypeOnly === 2 /* Required */ && namedBindings)) {
|
|
140966
140973
|
return void 0;
|
|
140967
|
-
|
|
140974
|
+
}
|
|
140975
|
+
if (importKind === 0 /* Named */ && (namedBindings == null ? void 0 : namedBindings.kind) === 272 /* NamespaceImport */) {
|
|
140968
140976
|
return void 0;
|
|
140977
|
+
}
|
|
140969
140978
|
return {
|
|
140970
140979
|
kind: 2 /* AddToExisting */,
|
|
140971
140980
|
importClauseOrBindingPattern: importClause,
|
|
@@ -140973,7 +140982,7 @@ ${lanes.join("\n")}
|
|
|
140973
140982
|
moduleSpecifier: declaration.moduleSpecifier.text,
|
|
140974
140983
|
addAsTypeOnly
|
|
140975
140984
|
};
|
|
140976
|
-
}
|
|
140985
|
+
}
|
|
140977
140986
|
}
|
|
140978
140987
|
function createExistingImportMap(checker, importingFile, compilerOptions) {
|
|
140979
140988
|
let importMap;
|
|
@@ -141402,7 +141411,6 @@ ${lanes.join("\n")}
|
|
|
141402
141411
|
importClauseOrBindingPattern,
|
|
141403
141412
|
importKind === 1 /* Default */ ? { name: symbolName2, addAsTypeOnly } : void 0,
|
|
141404
141413
|
importKind === 0 /* Named */ ? [{ name: symbolName2, addAsTypeOnly }] : emptyArray,
|
|
141405
|
-
compilerOptions,
|
|
141406
141414
|
preferences
|
|
141407
141415
|
);
|
|
141408
141416
|
const moduleSpecifierWithoutQuotes = stripQuotes(moduleSpecifier);
|
|
@@ -141504,7 +141512,7 @@ ${lanes.join("\n")}
|
|
|
141504
141512
|
}
|
|
141505
141513
|
}
|
|
141506
141514
|
}
|
|
141507
|
-
function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports,
|
|
141515
|
+
function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports, preferences) {
|
|
141508
141516
|
var _a2;
|
|
141509
141517
|
if (clause.kind === 204 /* ObjectBindingPattern */) {
|
|
141510
141518
|
if (defaultImport) {
|
|
@@ -141522,7 +141530,6 @@ ${lanes.join("\n")}
|
|
|
141522
141530
|
}
|
|
141523
141531
|
const promoteFromTypeOnly2 = clause.isTypeOnly && some([defaultImport, ...namedImports], (i) => (i == null ? void 0 : i.addAsTypeOnly) === 4 /* NotAllowed */);
|
|
141524
141532
|
const existingSpecifiers = clause.namedBindings && ((_a2 = tryCast(clause.namedBindings, isNamedImports)) == null ? void 0 : _a2.elements);
|
|
141525
|
-
const convertExistingToTypeOnly = promoteFromTypeOnly2 && importNameElisionDisabled(compilerOptions);
|
|
141526
141533
|
if (defaultImport) {
|
|
141527
141534
|
Debug.assert(!clause.name, "Cannot add a default import to an import clause that already has one");
|
|
141528
141535
|
changes.insertNodeAt(sourceFile, clause.getStart(sourceFile), factory.createIdentifier(defaultImport.name), { suffix: ", " });
|
|
@@ -141553,7 +141560,7 @@ ${lanes.join("\n")}
|
|
|
141553
141560
|
const specifierSort = (existingSpecifiers == null ? void 0 : existingSpecifiers.length) && ts_OrganizeImports_exports.detectImportSpecifierSorting(existingSpecifiers, preferences);
|
|
141554
141561
|
if (specifierSort && !(ignoreCaseForSorting && specifierSort === 1 /* CaseSensitive */)) {
|
|
141555
141562
|
for (const spec of newSpecifiers) {
|
|
141556
|
-
const insertionIndex =
|
|
141563
|
+
const insertionIndex = promoteFromTypeOnly2 && !spec.isTypeOnly ? 0 : ts_OrganizeImports_exports.getImportSpecifierInsertionIndex(existingSpecifiers, spec, comparer);
|
|
141557
141564
|
changes.insertImportSpecifierAtIndex(sourceFile, spec, clause.namedBindings, insertionIndex);
|
|
141558
141565
|
}
|
|
141559
141566
|
} else if (existingSpecifiers == null ? void 0 : existingSpecifiers.length) {
|
|
@@ -141573,7 +141580,7 @@ ${lanes.join("\n")}
|
|
|
141573
141580
|
}
|
|
141574
141581
|
if (promoteFromTypeOnly2) {
|
|
141575
141582
|
changes.delete(sourceFile, getTypeKeywordOfTypeOnlyImport(clause, sourceFile));
|
|
141576
|
-
if (
|
|
141583
|
+
if (existingSpecifiers) {
|
|
141577
141584
|
for (const specifier of existingSpecifiers) {
|
|
141578
141585
|
changes.insertModifierBefore(sourceFile, 155 /* TypeKeyword */, specifier);
|
|
141579
141586
|
}
|
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.20230331`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -3488,7 +3488,7 @@ function createDynamicPriorityPollingWatchFile(host) {
|
|
|
3488
3488
|
queue.pollScheduled = false;
|
|
3489
3489
|
return queue;
|
|
3490
3490
|
}
|
|
3491
|
-
function pollPollingIntervalQueue(queue) {
|
|
3491
|
+
function pollPollingIntervalQueue(_timeoutType, queue) {
|
|
3492
3492
|
queue.pollIndex = pollQueue(queue, queue.pollingInterval, queue.pollIndex, pollingChunkSize[queue.pollingInterval]);
|
|
3493
3493
|
if (queue.length) {
|
|
3494
3494
|
scheduleNextPoll(queue.pollingInterval);
|
|
@@ -3497,7 +3497,7 @@ function createDynamicPriorityPollingWatchFile(host) {
|
|
|
3497
3497
|
queue.pollScheduled = false;
|
|
3498
3498
|
}
|
|
3499
3499
|
}
|
|
3500
|
-
function pollLowPollingIntervalQueue(queue) {
|
|
3500
|
+
function pollLowPollingIntervalQueue(_timeoutType, queue) {
|
|
3501
3501
|
pollQueue(
|
|
3502
3502
|
changedFilesInLastPoll,
|
|
3503
3503
|
250 /* Low */,
|
|
@@ -3505,7 +3505,7 @@ function createDynamicPriorityPollingWatchFile(host) {
|
|
|
3505
3505
|
0,
|
|
3506
3506
|
changedFilesInLastPoll.length
|
|
3507
3507
|
);
|
|
3508
|
-
pollPollingIntervalQueue(queue);
|
|
3508
|
+
pollPollingIntervalQueue(_timeoutType, queue);
|
|
3509
3509
|
if (!queue.pollScheduled && changedFilesInLastPoll.length) {
|
|
3510
3510
|
scheduleNextPoll(250 /* Low */);
|
|
3511
3511
|
}
|
|
@@ -3562,7 +3562,7 @@ function createDynamicPriorityPollingWatchFile(host) {
|
|
|
3562
3562
|
}
|
|
3563
3563
|
}
|
|
3564
3564
|
function scheduleNextPoll(pollingInterval) {
|
|
3565
|
-
pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval));
|
|
3565
|
+
pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingInterval === 250 /* Low */ ? "pollLowPollingIntervalQueue" : "pollPollingIntervalQueue", pollingIntervalQueue(pollingInterval));
|
|
3566
3566
|
}
|
|
3567
3567
|
}
|
|
3568
3568
|
function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) {
|
|
@@ -3641,7 +3641,7 @@ function createFixedChunkSizePollingWatchFile(host) {
|
|
|
3641
3641
|
function scheduleNextPoll() {
|
|
3642
3642
|
if (!watchedFiles.length || pollScheduled)
|
|
3643
3643
|
return;
|
|
3644
|
-
pollScheduled = host.setTimeout(pollQueue, 2e3 /* High
|
|
3644
|
+
pollScheduled = host.setTimeout(pollQueue, 2e3 /* High */, "pollQueue");
|
|
3645
3645
|
}
|
|
3646
3646
|
}
|
|
3647
3647
|
function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) {
|
|
@@ -3809,7 +3809,7 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
3809
3809
|
clearTimeout2(timerToUpdateChildWatches);
|
|
3810
3810
|
timerToUpdateChildWatches = void 0;
|
|
3811
3811
|
}
|
|
3812
|
-
timerToUpdateChildWatches = setTimeout2(onTimerToUpdateChildWatches, 1e3);
|
|
3812
|
+
timerToUpdateChildWatches = setTimeout2(onTimerToUpdateChildWatches, 1e3, "timerToUpdateChildWatches");
|
|
3813
3813
|
}
|
|
3814
3814
|
function onTimerToUpdateChildWatches() {
|
|
3815
3815
|
timerToUpdateChildWatches = void 0;
|
|
@@ -5596,7 +5596,6 @@ var Diagnostics = {
|
|
|
5596
5596
|
Constructors_for_derived_classes_must_contain_a_super_call: diag(2377, 1 /* Error */, "Constructors_for_derived_classes_must_contain_a_super_call_2377", "Constructors for derived classes must contain a 'super' call."),
|
|
5597
5597
|
A_get_accessor_must_return_a_value: diag(2378, 1 /* Error */, "A_get_accessor_must_return_a_value_2378", "A 'get' accessor must return a value."),
|
|
5598
5598
|
Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties: diag(2379, 1 /* Error */, "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_tr_2379", "Argument of type '{0}' is not assignable to parameter of type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties."),
|
|
5599
|
-
The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type: diag(2380, 1 /* Error */, "The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type_2380", "The return type of a 'get' accessor must be assignable to its 'set' accessor type"),
|
|
5600
5599
|
Overload_signatures_must_all_be_exported_or_non_exported: diag(2383, 1 /* Error */, "Overload_signatures_must_all_be_exported_or_non_exported_2383", "Overload signatures must all be exported or non-exported."),
|
|
5601
5600
|
Overload_signatures_must_all_be_ambient_or_non_ambient: diag(2384, 1 /* Error */, "Overload_signatures_must_all_be_ambient_or_non_ambient_2384", "Overload signatures must all be ambient or non-ambient."),
|
|
5602
5601
|
Overload_signatures_must_all_be_public_private_or_protected: diag(2385, 1 /* Error */, "Overload_signatures_must_all_be_public_private_or_protected_2385", "Overload signatures must all be public, private or protected."),
|
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.20230331",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"node": "14.21.1",
|
|
114
114
|
"npm": "8.19.3"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "13c374a868c926f6a907666a5599992c1351b773"
|
|
117
117
|
}
|