typescript 4.8.0-dev.20220809 → 4.9.0-dev.20220811
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/lib.es2015.reflect.d.ts +25 -2
- package/lib/lib.es5.d.ts +13 -3
- package/lib/tsc.js +190 -118
- package/lib/tsserver.js +269 -157
- package/lib/tsserverlibrary.d.ts +1 -1
- package/lib/tsserverlibrary.js +269 -352
- package/lib/typescript.d.ts +1 -1
- package/lib/typescript.js +269 -352
- package/lib/typescriptServices.d.ts +1 -1
- package/lib/typescriptServices.js +269 -352
- package/lib/typingsInstaller.js +208 -128
- package/package.json +1 -1
package/lib/tsserverlibrary.js
CHANGED
|
@@ -100,210 +100,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
100
100
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
101
101
|
});
|
|
102
102
|
};
|
|
103
|
-
/* @internal */
|
|
104
|
-
var ts;
|
|
105
|
-
(function (ts) {
|
|
106
|
-
function createMapData() {
|
|
107
|
-
var sentinel = {};
|
|
108
|
-
sentinel.prev = sentinel;
|
|
109
|
-
return { head: sentinel, tail: sentinel, size: 0 };
|
|
110
|
-
}
|
|
111
|
-
function createMapEntry(key, value) {
|
|
112
|
-
return { key: key, value: value, next: undefined, prev: undefined };
|
|
113
|
-
}
|
|
114
|
-
function sameValueZero(x, y) {
|
|
115
|
-
// Treats -0 === 0 and NaN === NaN
|
|
116
|
-
return x === y || x !== x && y !== y;
|
|
117
|
-
}
|
|
118
|
-
function getPrev(entry) {
|
|
119
|
-
var prev = entry.prev;
|
|
120
|
-
// Entries without a 'prev' have been removed from the map.
|
|
121
|
-
// An entry whose 'prev' points to itself is the head of the list and is invalid here.
|
|
122
|
-
if (!prev || prev === entry)
|
|
123
|
-
throw new Error("Illegal state");
|
|
124
|
-
return prev;
|
|
125
|
-
}
|
|
126
|
-
function getNext(entry) {
|
|
127
|
-
while (entry) {
|
|
128
|
-
// Entries without a 'prev' have been removed from the map. Their 'next'
|
|
129
|
-
// pointer should point to the previous entry prior to deletion and
|
|
130
|
-
// that entry should be skipped to resume iteration.
|
|
131
|
-
var skipNext = !entry.prev;
|
|
132
|
-
entry = entry.next;
|
|
133
|
-
if (skipNext) {
|
|
134
|
-
continue;
|
|
135
|
-
}
|
|
136
|
-
return entry;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
function getEntry(data, key) {
|
|
140
|
-
// We walk backwards from 'tail' to prioritize recently added entries.
|
|
141
|
-
// We skip 'head' because it is an empty entry used to track iteration start.
|
|
142
|
-
for (var entry = data.tail; entry !== data.head; entry = getPrev(entry)) {
|
|
143
|
-
if (sameValueZero(entry.key, key)) {
|
|
144
|
-
return entry;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
function addOrUpdateEntry(data, key, value) {
|
|
149
|
-
var existing = getEntry(data, key);
|
|
150
|
-
if (existing) {
|
|
151
|
-
existing.value = value;
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
var entry = createMapEntry(key, value);
|
|
155
|
-
entry.prev = data.tail;
|
|
156
|
-
data.tail.next = entry;
|
|
157
|
-
data.tail = entry;
|
|
158
|
-
data.size++;
|
|
159
|
-
return entry;
|
|
160
|
-
}
|
|
161
|
-
function deleteEntry(data, key) {
|
|
162
|
-
// We walk backwards from 'tail' to prioritize recently added entries.
|
|
163
|
-
// We skip 'head' because it is an empty entry used to track iteration start.
|
|
164
|
-
for (var entry = data.tail; entry !== data.head; entry = getPrev(entry)) {
|
|
165
|
-
// all entries in the map should have a 'prev' pointer.
|
|
166
|
-
if (entry.prev === undefined)
|
|
167
|
-
throw new Error("Illegal state");
|
|
168
|
-
if (sameValueZero(entry.key, key)) {
|
|
169
|
-
if (entry.next) {
|
|
170
|
-
entry.next.prev = entry.prev;
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
// an entry in the map without a 'next' pointer must be the 'tail'.
|
|
174
|
-
if (data.tail !== entry)
|
|
175
|
-
throw new Error("Illegal state");
|
|
176
|
-
data.tail = entry.prev;
|
|
177
|
-
}
|
|
178
|
-
entry.prev.next = entry.next;
|
|
179
|
-
entry.next = entry.prev;
|
|
180
|
-
entry.prev = undefined;
|
|
181
|
-
data.size--;
|
|
182
|
-
return entry;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
function clearEntries(data) {
|
|
187
|
-
var node = data.tail;
|
|
188
|
-
while (node !== data.head) {
|
|
189
|
-
var prev = getPrev(node);
|
|
190
|
-
node.next = data.head;
|
|
191
|
-
node.prev = undefined;
|
|
192
|
-
node = prev;
|
|
193
|
-
}
|
|
194
|
-
data.head.next = undefined;
|
|
195
|
-
data.tail = data.head;
|
|
196
|
-
data.size = 0;
|
|
197
|
-
}
|
|
198
|
-
function forEachEntry(data, action) {
|
|
199
|
-
var entry = data.head;
|
|
200
|
-
while (entry) {
|
|
201
|
-
entry = getNext(entry);
|
|
202
|
-
if (entry) {
|
|
203
|
-
action(entry.value, entry.key);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
function forEachIteration(iterator, action) {
|
|
208
|
-
if (iterator) {
|
|
209
|
-
for (var step = iterator.next(); !step.done; step = iterator.next()) {
|
|
210
|
-
action(step.value);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
function createIteratorData(data, selector) {
|
|
215
|
-
return { current: data.head, selector: selector };
|
|
216
|
-
}
|
|
217
|
-
function iteratorNext(data) {
|
|
218
|
-
// Navigate to the next entry.
|
|
219
|
-
data.current = getNext(data.current);
|
|
220
|
-
if (data.current) {
|
|
221
|
-
return { value: data.selector(data.current.key, data.current.value), done: false };
|
|
222
|
-
}
|
|
223
|
-
else {
|
|
224
|
-
return { value: undefined, done: true };
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
/* @internal */
|
|
228
|
-
var ShimCollections;
|
|
229
|
-
(function (ShimCollections) {
|
|
230
|
-
function createMapShim(getIterator) {
|
|
231
|
-
var MapIterator = /** @class */ (function () {
|
|
232
|
-
function MapIterator(data, selector) {
|
|
233
|
-
this._data = createIteratorData(data, selector);
|
|
234
|
-
}
|
|
235
|
-
MapIterator.prototype.next = function () { return iteratorNext(this._data); };
|
|
236
|
-
return MapIterator;
|
|
237
|
-
}());
|
|
238
|
-
return /** @class */ (function () {
|
|
239
|
-
function Map(iterable) {
|
|
240
|
-
var _this = this;
|
|
241
|
-
this._mapData = createMapData();
|
|
242
|
-
forEachIteration(getIterator(iterable), function (_a) {
|
|
243
|
-
var key = _a[0], value = _a[1];
|
|
244
|
-
return _this.set(key, value);
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
Object.defineProperty(Map.prototype, "size", {
|
|
248
|
-
get: function () { return this._mapData.size; },
|
|
249
|
-
enumerable: false,
|
|
250
|
-
configurable: true
|
|
251
|
-
});
|
|
252
|
-
Map.prototype.get = function (key) { var _a; return (_a = getEntry(this._mapData, key)) === null || _a === void 0 ? void 0 : _a.value; };
|
|
253
|
-
Map.prototype.set = function (key, value) { return addOrUpdateEntry(this._mapData, key, value), this; };
|
|
254
|
-
Map.prototype.has = function (key) { return !!getEntry(this._mapData, key); };
|
|
255
|
-
Map.prototype.delete = function (key) { return !!deleteEntry(this._mapData, key); };
|
|
256
|
-
Map.prototype.clear = function () { clearEntries(this._mapData); };
|
|
257
|
-
Map.prototype.keys = function () { return new MapIterator(this._mapData, function (key, _value) { return key; }); };
|
|
258
|
-
Map.prototype.values = function () { return new MapIterator(this._mapData, function (_key, value) { return value; }); };
|
|
259
|
-
Map.prototype.entries = function () { return new MapIterator(this._mapData, function (key, value) { return [key, value]; }); };
|
|
260
|
-
Map.prototype.forEach = function (action) { forEachEntry(this._mapData, action); };
|
|
261
|
-
return Map;
|
|
262
|
-
}());
|
|
263
|
-
}
|
|
264
|
-
ShimCollections.createMapShim = createMapShim;
|
|
265
|
-
function createSetShim(getIterator) {
|
|
266
|
-
var SetIterator = /** @class */ (function () {
|
|
267
|
-
function SetIterator(data, selector) {
|
|
268
|
-
this._data = createIteratorData(data, selector);
|
|
269
|
-
}
|
|
270
|
-
SetIterator.prototype.next = function () { return iteratorNext(this._data); };
|
|
271
|
-
return SetIterator;
|
|
272
|
-
}());
|
|
273
|
-
return /** @class */ (function () {
|
|
274
|
-
function Set(iterable) {
|
|
275
|
-
var _this = this;
|
|
276
|
-
this._mapData = createMapData();
|
|
277
|
-
forEachIteration(getIterator(iterable), function (value) { return _this.add(value); });
|
|
278
|
-
}
|
|
279
|
-
Object.defineProperty(Set.prototype, "size", {
|
|
280
|
-
get: function () { return this._mapData.size; },
|
|
281
|
-
enumerable: false,
|
|
282
|
-
configurable: true
|
|
283
|
-
});
|
|
284
|
-
Set.prototype.add = function (value) { return addOrUpdateEntry(this._mapData, value, value), this; };
|
|
285
|
-
Set.prototype.has = function (value) { return !!getEntry(this._mapData, value); };
|
|
286
|
-
Set.prototype.delete = function (value) { return !!deleteEntry(this._mapData, value); };
|
|
287
|
-
Set.prototype.clear = function () { clearEntries(this._mapData); };
|
|
288
|
-
Set.prototype.keys = function () { return new SetIterator(this._mapData, function (key, _value) { return key; }); };
|
|
289
|
-
Set.prototype.values = function () { return new SetIterator(this._mapData, function (_key, value) { return value; }); };
|
|
290
|
-
Set.prototype.entries = function () { return new SetIterator(this._mapData, function (key, value) { return [key, value]; }); };
|
|
291
|
-
Set.prototype.forEach = function (action) { forEachEntry(this._mapData, action); };
|
|
292
|
-
return Set;
|
|
293
|
-
}());
|
|
294
|
-
}
|
|
295
|
-
ShimCollections.createSetShim = createSetShim;
|
|
296
|
-
})(ShimCollections = ts.ShimCollections || (ts.ShimCollections = {}));
|
|
297
|
-
})(ts || (ts = {}));
|
|
298
103
|
var ts;
|
|
299
104
|
(function (ts) {
|
|
300
105
|
// WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values.
|
|
301
106
|
// If changing the text in this section, be sure to test `configurePrerelease` too.
|
|
302
|
-
ts.versionMajorMinor = "4.
|
|
107
|
+
ts.versionMajorMinor = "4.9";
|
|
303
108
|
// The following is baselined as a literal template type without intervention
|
|
304
109
|
/** The version of the TypeScript compiler release */
|
|
305
110
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
306
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
111
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220811";
|
|
307
112
|
/* @internal */
|
|
308
113
|
var Comparison;
|
|
309
114
|
(function (Comparison) {
|
|
@@ -325,7 +130,11 @@ var ts;
|
|
|
325
130
|
// Internet Explorer's Map doesn't support iteration, so don't use it.
|
|
326
131
|
var gMap = globals === null || globals === void 0 ? void 0 : globals.Map;
|
|
327
132
|
// eslint-disable-next-line no-in-operator
|
|
328
|
-
|
|
133
|
+
var constructor = typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined;
|
|
134
|
+
if (!constructor) {
|
|
135
|
+
throw new Error("No compatible Map implementation found.");
|
|
136
|
+
}
|
|
137
|
+
return constructor;
|
|
329
138
|
}
|
|
330
139
|
NativeCollections.tryGetNativeMap = tryGetNativeMap;
|
|
331
140
|
/**
|
|
@@ -335,23 +144,18 @@ var ts;
|
|
|
335
144
|
// Internet Explorer's Set doesn't support iteration, so don't use it.
|
|
336
145
|
var gSet = globals === null || globals === void 0 ? void 0 : globals.Set;
|
|
337
146
|
// eslint-disable-next-line no-in-operator
|
|
338
|
-
|
|
147
|
+
var constructor = typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined;
|
|
148
|
+
if (!constructor) {
|
|
149
|
+
throw new Error("No compatible Set implementation found.");
|
|
150
|
+
}
|
|
151
|
+
return constructor;
|
|
339
152
|
}
|
|
340
153
|
NativeCollections.tryGetNativeSet = tryGetNativeSet;
|
|
341
154
|
})(NativeCollections || (NativeCollections = {}));
|
|
342
155
|
/* @internal */
|
|
343
|
-
ts.Map =
|
|
156
|
+
ts.Map = NativeCollections.tryGetNativeMap();
|
|
344
157
|
/* @internal */
|
|
345
|
-
ts.Set =
|
|
346
|
-
/* @internal */
|
|
347
|
-
function getCollectionImplementation(name, nativeFactory, shimFactory) {
|
|
348
|
-
var _a;
|
|
349
|
-
// NOTE: ts.ShimCollections will be defined for typescriptServices.js but not for tsc.js, so we must test for it.
|
|
350
|
-
var constructor = (_a = NativeCollections[nativeFactory]()) !== null && _a !== void 0 ? _a : ts.ShimCollections === null || ts.ShimCollections === void 0 ? void 0 : ts.ShimCollections[shimFactory](ts.getIterator);
|
|
351
|
-
if (constructor)
|
|
352
|
-
return constructor;
|
|
353
|
-
throw new Error("TypeScript requires an environment that provides a compatible native " + name + " implementation.");
|
|
354
|
-
}
|
|
158
|
+
ts.Set = NativeCollections.tryGetNativeSet();
|
|
355
159
|
})(ts || (ts = {}));
|
|
356
160
|
/* @internal */
|
|
357
161
|
var ts;
|
|
@@ -1067,15 +871,18 @@ var ts;
|
|
|
1067
871
|
function insertSorted(array, insert, compare, allowDuplicates) {
|
|
1068
872
|
if (array.length === 0) {
|
|
1069
873
|
array.push(insert);
|
|
1070
|
-
return;
|
|
874
|
+
return true;
|
|
1071
875
|
}
|
|
1072
876
|
var insertIndex = binarySearch(array, insert, identity, compare);
|
|
1073
877
|
if (insertIndex < 0) {
|
|
1074
878
|
array.splice(~insertIndex, 0, insert);
|
|
879
|
+
return true;
|
|
1075
880
|
}
|
|
1076
|
-
|
|
881
|
+
if (allowDuplicates) {
|
|
1077
882
|
array.splice(insertIndex, 0, insert);
|
|
883
|
+
return true;
|
|
1078
884
|
}
|
|
885
|
+
return false;
|
|
1079
886
|
}
|
|
1080
887
|
ts.insertSorted = insertSorted;
|
|
1081
888
|
function sortAndDeduplicate(array, comparer, equalityComparer) {
|
|
@@ -8036,12 +7843,9 @@ var ts;
|
|
|
8036
7843
|
* Normalize path separators, converting `\` into `/`.
|
|
8037
7844
|
*/
|
|
8038
7845
|
function normalizeSlashes(path) {
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
}
|
|
8043
|
-
backslashRegExp.lastIndex = index; // prime regex with known position
|
|
8044
|
-
return path.replace(backslashRegExp, ts.directorySeparator);
|
|
7846
|
+
return path.indexOf("\\") !== -1
|
|
7847
|
+
? path.replace(backslashRegExp, ts.directorySeparator)
|
|
7848
|
+
: path;
|
|
8045
7849
|
}
|
|
8046
7850
|
ts.normalizeSlashes = normalizeSlashes;
|
|
8047
7851
|
/**
|
|
@@ -9742,6 +9546,7 @@ var ts;
|
|
|
9742
9546
|
Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6398, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."),
|
|
9743
9547
|
Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes were not emitted"),
|
|
9744
9548
|
Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs to update timestamps of output files that are older than input files"),
|
|
9549
|
+
Project_0_is_out_of_date_because_there_was_error_reading_file_1: diag(6401, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401", "Project '{0}' is out of date because there was error reading file '{1}'"),
|
|
9745
9550
|
The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
|
|
9746
9551
|
The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
|
|
9747
9552
|
The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
|
|
@@ -19585,21 +19390,17 @@ var ts;
|
|
|
19585
19390
|
return getStringFromExpandedCharCodes(expandedCharCodes);
|
|
19586
19391
|
}
|
|
19587
19392
|
ts.base64decode = base64decode;
|
|
19393
|
+
function readJsonOrUndefined(path, hostOrText) {
|
|
19394
|
+
var jsonText = ts.isString(hostOrText) ? hostOrText : hostOrText.readFile(path);
|
|
19395
|
+
if (!jsonText)
|
|
19396
|
+
return undefined;
|
|
19397
|
+
// gracefully handle if readFile fails or returns not JSON
|
|
19398
|
+
var result = ts.parseConfigFileTextToJson(path, jsonText);
|
|
19399
|
+
return !result.error ? result.config : undefined;
|
|
19400
|
+
}
|
|
19401
|
+
ts.readJsonOrUndefined = readJsonOrUndefined;
|
|
19588
19402
|
function readJson(path, host) {
|
|
19589
|
-
|
|
19590
|
-
var jsonText = host.readFile(path);
|
|
19591
|
-
if (!jsonText)
|
|
19592
|
-
return {};
|
|
19593
|
-
var result = ts.parseConfigFileTextToJson(path, jsonText);
|
|
19594
|
-
if (result.error) {
|
|
19595
|
-
return {};
|
|
19596
|
-
}
|
|
19597
|
-
return result.config;
|
|
19598
|
-
}
|
|
19599
|
-
catch (e) {
|
|
19600
|
-
// gracefully handle if readFile fails or returns not JSON
|
|
19601
|
-
return {};
|
|
19602
|
-
}
|
|
19403
|
+
return readJsonOrUndefined(path, host) || {};
|
|
19603
19404
|
}
|
|
19604
19405
|
ts.readJson = readJson;
|
|
19605
19406
|
function directoryProbablyExists(directoryName, host) {
|
|
@@ -27950,9 +27751,10 @@ var ts;
|
|
|
27950
27751
|
};
|
|
27951
27752
|
var buildInfo_1;
|
|
27952
27753
|
var getAndCacheBuildInfo_1 = function (getText) {
|
|
27754
|
+
var _a;
|
|
27953
27755
|
if (buildInfo_1 === undefined) {
|
|
27954
27756
|
var result = getText();
|
|
27955
|
-
buildInfo_1 = result !== undefined ? ts.getBuildInfo(result) : false;
|
|
27757
|
+
buildInfo_1 = result !== undefined ? (_a = ts.getBuildInfo(node.buildInfoPath, result)) !== null && _a !== void 0 ? _a : false : false;
|
|
27956
27758
|
}
|
|
27957
27759
|
return buildInfo_1 || undefined;
|
|
27958
27760
|
};
|
|
@@ -46012,6 +45814,9 @@ var ts;
|
|
|
46012
45814
|
case 203 /* BindingElement */:
|
|
46013
45815
|
bindBindingElementFlow(node);
|
|
46014
45816
|
break;
|
|
45817
|
+
case 164 /* Parameter */:
|
|
45818
|
+
bindParameterFlow(node);
|
|
45819
|
+
break;
|
|
46015
45820
|
case 205 /* ObjectLiteralExpression */:
|
|
46016
45821
|
case 204 /* ArrayLiteralExpression */:
|
|
46017
45822
|
case 296 /* PropertyAssignment */:
|
|
@@ -46752,20 +46557,38 @@ var ts;
|
|
|
46752
46557
|
}
|
|
46753
46558
|
}
|
|
46754
46559
|
function bindBindingElementFlow(node) {
|
|
46755
|
-
|
|
46756
|
-
|
|
46757
|
-
|
|
46758
|
-
|
|
46759
|
-
|
|
46760
|
-
|
|
46761
|
-
|
|
46762
|
-
|
|
46763
|
-
|
|
46764
|
-
|
|
46560
|
+
// When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per:
|
|
46561
|
+
// - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization
|
|
46562
|
+
// - `BindingElement: BindingPattern Initializer?`
|
|
46563
|
+
// - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization
|
|
46564
|
+
// - `BindingElement: BindingPattern Initializer?`
|
|
46565
|
+
bind(node.dotDotDotToken);
|
|
46566
|
+
bind(node.propertyName);
|
|
46567
|
+
bindInitializer(node.initializer);
|
|
46568
|
+
bind(node.name);
|
|
46569
|
+
}
|
|
46570
|
+
function bindParameterFlow(node) {
|
|
46571
|
+
bindEach(node.modifiers);
|
|
46572
|
+
bind(node.dotDotDotToken);
|
|
46573
|
+
bind(node.questionToken);
|
|
46574
|
+
bind(node.type);
|
|
46575
|
+
bindInitializer(node.initializer);
|
|
46576
|
+
bind(node.name);
|
|
46577
|
+
}
|
|
46578
|
+
// a BindingElement/Parameter does not have side effects if initializers are not evaluated and used. (see GH#49759)
|
|
46579
|
+
function bindInitializer(node) {
|
|
46580
|
+
if (!node) {
|
|
46581
|
+
return;
|
|
46765
46582
|
}
|
|
46766
|
-
|
|
46767
|
-
|
|
46583
|
+
var entryFlow = currentFlow;
|
|
46584
|
+
bind(node);
|
|
46585
|
+
if (entryFlow === unreachableFlow || entryFlow === currentFlow) {
|
|
46586
|
+
return;
|
|
46768
46587
|
}
|
|
46588
|
+
var exitFlow = createBranchLabel();
|
|
46589
|
+
addAntecedent(exitFlow, entryFlow);
|
|
46590
|
+
addAntecedent(exitFlow, currentFlow);
|
|
46591
|
+
currentFlow = finishFlowLabel(exitFlow);
|
|
46769
46592
|
}
|
|
46770
46593
|
function bindJSDocTypeAlias(node) {
|
|
46771
46594
|
bind(node.tagName);
|
|
@@ -49936,7 +49759,7 @@ var ts;
|
|
|
49936
49759
|
if (unidirectional === void 0) { unidirectional = false; }
|
|
49937
49760
|
source.forEach(function (sourceSymbol, id) {
|
|
49938
49761
|
var targetSymbol = target.get(id);
|
|
49939
|
-
target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol);
|
|
49762
|
+
target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol));
|
|
49940
49763
|
});
|
|
49941
49764
|
}
|
|
49942
49765
|
function mergeModuleAugmentation(moduleName) {
|
|
@@ -56727,11 +56550,9 @@ var ts;
|
|
|
56727
56550
|
return getReturnTypeOfSignature(getterSignature);
|
|
56728
56551
|
}
|
|
56729
56552
|
}
|
|
56730
|
-
|
|
56731
|
-
|
|
56732
|
-
|
|
56733
|
-
return type_1;
|
|
56734
|
-
}
|
|
56553
|
+
var parameterTypeOfTypeTag = getParameterTypeOfTypeTag(func, declaration);
|
|
56554
|
+
if (parameterTypeOfTypeTag)
|
|
56555
|
+
return parameterTypeOfTypeTag;
|
|
56735
56556
|
// Use contextual parameter type if one is available
|
|
56736
56557
|
var type = declaration.symbol.escapedName === "this" /* This */ ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration);
|
|
56737
56558
|
if (type) {
|
|
@@ -57307,9 +57128,9 @@ var ts;
|
|
|
57307
57128
|
if (typeNode === undefined) {
|
|
57308
57129
|
return useUnknownInCatchVariables ? unknownType : anyType;
|
|
57309
57130
|
}
|
|
57310
|
-
var
|
|
57131
|
+
var type_1 = getTypeOfNode(typeNode);
|
|
57311
57132
|
// an errorType will make `checkTryStatement` issue an error
|
|
57312
|
-
return isTypeAny(
|
|
57133
|
+
return isTypeAny(type_1) || type_1 === unknownType ? type_1 : errorType;
|
|
57313
57134
|
}
|
|
57314
57135
|
// Handle export default expressions
|
|
57315
57136
|
if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) {
|
|
@@ -57519,11 +57340,11 @@ var ts;
|
|
|
57519
57340
|
return errorType;
|
|
57520
57341
|
}
|
|
57521
57342
|
var exportEquals = getMergedSymbol(symbol.exports.get("export=" /* ExportEquals */));
|
|
57522
|
-
var
|
|
57343
|
+
var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
|
|
57523
57344
|
if (!popTypeResolution()) {
|
|
57524
57345
|
return reportCircularityError(symbol);
|
|
57525
57346
|
}
|
|
57526
|
-
return
|
|
57347
|
+
return type_2;
|
|
57527
57348
|
}
|
|
57528
57349
|
}
|
|
57529
57350
|
var type = createObjectType(16 /* Anonymous */, symbol);
|
|
@@ -59746,10 +59567,10 @@ var ts;
|
|
|
59746
59567
|
var baseTypes = [];
|
|
59747
59568
|
var different = false;
|
|
59748
59569
|
for (var _i = 0, types_7 = types; _i < types_7.length; _i++) {
|
|
59749
|
-
var
|
|
59750
|
-
var baseType = getBaseConstraint(
|
|
59570
|
+
var type_3 = types_7[_i];
|
|
59571
|
+
var baseType = getBaseConstraint(type_3);
|
|
59751
59572
|
if (baseType) {
|
|
59752
|
-
if (baseType !==
|
|
59573
|
+
if (baseType !== type_3) {
|
|
59753
59574
|
different = true;
|
|
59754
59575
|
}
|
|
59755
59576
|
baseTypes.push(baseType);
|
|
@@ -60540,7 +60361,12 @@ var ts;
|
|
|
60540
60361
|
continue;
|
|
60541
60362
|
}
|
|
60542
60363
|
}
|
|
60543
|
-
|
|
60364
|
+
// If this is a function or method declaration, get the signature from the @type tag for the sake of optional parameters.
|
|
60365
|
+
// Exclude contextually-typed kinds because we already apply the @type tag to the context, plus applying it here to the initializer would supress checks that the two are compatible.
|
|
60366
|
+
result.push((!ts.isFunctionExpressionOrArrowFunction(decl) &&
|
|
60367
|
+
!ts.isObjectLiteralMethod(decl) &&
|
|
60368
|
+
getSignatureOfTypeTag(decl)) ||
|
|
60369
|
+
getSignatureFromDeclaration(decl));
|
|
60544
60370
|
}
|
|
60545
60371
|
return result;
|
|
60546
60372
|
}
|
|
@@ -60571,7 +60397,7 @@ var ts;
|
|
|
60571
60397
|
else {
|
|
60572
60398
|
var type = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration);
|
|
60573
60399
|
var jsdocPredicate = void 0;
|
|
60574
|
-
if (!type
|
|
60400
|
+
if (!type) {
|
|
60575
60401
|
var jsdocSignature = getSignatureOfTypeTag(signature.declaration);
|
|
60576
60402
|
if (jsdocSignature && signature !== jsdocSignature) {
|
|
60577
60403
|
jsdocPredicate = getTypePredicateOfSignature(jsdocSignature);
|
|
@@ -64597,15 +64423,14 @@ var ts;
|
|
|
64597
64423
|
return false;
|
|
64598
64424
|
}
|
|
64599
64425
|
function isContextSensitiveFunctionLikeDeclaration(node) {
|
|
64600
|
-
return
|
|
64601
|
-
(ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node));
|
|
64426
|
+
return ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node);
|
|
64602
64427
|
}
|
|
64603
64428
|
function hasContextSensitiveReturnExpression(node) {
|
|
64604
64429
|
// TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value.
|
|
64605
64430
|
return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 235 /* Block */ && isContextSensitive(node.body);
|
|
64606
64431
|
}
|
|
64607
64432
|
function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
|
|
64608
|
-
return (ts.
|
|
64433
|
+
return (ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) &&
|
|
64609
64434
|
isContextSensitiveFunctionLikeDeclaration(func);
|
|
64610
64435
|
}
|
|
64611
64436
|
function getTypeWithoutSignatures(type) {
|
|
@@ -73663,9 +73488,11 @@ var ts;
|
|
|
73663
73488
|
case 1 /* ExportsProperty */:
|
|
73664
73489
|
case 6 /* Prototype */:
|
|
73665
73490
|
case 3 /* PrototypeProperty */:
|
|
73666
|
-
var valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration;
|
|
73667
|
-
// falls through
|
|
73668
73491
|
case 2 /* ModuleExports */:
|
|
73492
|
+
var valueDeclaration = void 0;
|
|
73493
|
+
if (kind !== 2 /* ModuleExports */) {
|
|
73494
|
+
valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration;
|
|
73495
|
+
}
|
|
73669
73496
|
valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration);
|
|
73670
73497
|
var annotated = valueDeclaration && ts.getEffectiveTypeAnnotationNode(valueDeclaration);
|
|
73671
73498
|
return annotated ? getTypeFromTypeNode(annotated) : undefined;
|
|
@@ -74143,9 +73970,18 @@ var ts;
|
|
|
74143
73970
|
if (!isErrorType(intrinsicClassAttribs)) {
|
|
74144
73971
|
var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol);
|
|
74145
73972
|
var hostClassType = getReturnTypeOfSignature(sig);
|
|
74146
|
-
|
|
74147
|
-
|
|
74148
|
-
|
|
73973
|
+
var libraryManagedAttributeType = void 0;
|
|
73974
|
+
if (typeParams && typeParams.length === 1) {
|
|
73975
|
+
var inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context));
|
|
73976
|
+
libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs));
|
|
73977
|
+
}
|
|
73978
|
+
else if (typeParams)
|
|
73979
|
+
libraryManagedAttributeType = undefined;
|
|
73980
|
+
else
|
|
73981
|
+
libraryManagedAttributeType = intrinsicClassAttribs;
|
|
73982
|
+
if (libraryManagedAttributeType) {
|
|
73983
|
+
apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType);
|
|
73984
|
+
}
|
|
74149
73985
|
}
|
|
74150
73986
|
var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context);
|
|
74151
73987
|
if (!isErrorType(intrinsicAttribs)) {
|
|
@@ -77972,12 +77808,15 @@ var ts;
|
|
|
77972
77808
|
return false;
|
|
77973
77809
|
}
|
|
77974
77810
|
var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node :
|
|
77975
|
-
ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
|
|
77811
|
+
(ts.isVariableDeclaration(node) || ts.isPropertyAssignment(node)) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
|
|
77976
77812
|
undefined;
|
|
77977
77813
|
if (func) {
|
|
77978
|
-
// If the node has a @class tag, treat it like a constructor.
|
|
77814
|
+
// If the node has a @class or @constructor tag, treat it like a constructor.
|
|
77979
77815
|
if (ts.getJSDocClassTag(node))
|
|
77980
77816
|
return true;
|
|
77817
|
+
// If the node is a property of an object literal.
|
|
77818
|
+
if (ts.isPropertyAssignment(ts.walkUpParenthesizedExpressions(func.parent)))
|
|
77819
|
+
return false;
|
|
77981
77820
|
// If the symbol of the node has members, treat it like a constructor.
|
|
77982
77821
|
var symbol = getSymbolOfNode(func);
|
|
77983
77822
|
return !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.members) === null || _a === void 0 ? void 0 : _a.size);
|
|
@@ -78225,8 +78064,8 @@ var ts;
|
|
|
78225
78064
|
if (hasDefaultOnly && type && !isErrorType(type)) {
|
|
78226
78065
|
var synthType = type;
|
|
78227
78066
|
if (!synthType.defaultOnlyType) {
|
|
78228
|
-
var
|
|
78229
|
-
synthType.defaultOnlyType =
|
|
78067
|
+
var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol);
|
|
78068
|
+
synthType.defaultOnlyType = type_4;
|
|
78230
78069
|
}
|
|
78231
78070
|
return synthType.defaultOnlyType;
|
|
78232
78071
|
}
|
|
@@ -87563,6 +87402,12 @@ var ts;
|
|
|
87563
87402
|
return resolveJSDocMemberName(name, /*ignoreErrors*/ false, getSymbolOfNode(container));
|
|
87564
87403
|
}
|
|
87565
87404
|
}
|
|
87405
|
+
if (result && isJSDoc_1) {
|
|
87406
|
+
var container = ts.getJSDocHost(name);
|
|
87407
|
+
if (container && ts.isEnumMember(container) && container === result.valueDeclaration) {
|
|
87408
|
+
return resolveEntityName(name, meaning, /*ignoreErrors*/ true, /* dontResolveAlias */ true, ts.getSourceFileOfNode(container)) || result;
|
|
87409
|
+
}
|
|
87410
|
+
}
|
|
87566
87411
|
return result;
|
|
87567
87412
|
}
|
|
87568
87413
|
else if (ts.isPrivateIdentifier(name)) {
|
|
@@ -107724,6 +107569,13 @@ var ts;
|
|
|
107724
107569
|
ts.Debug.assert(importVariableName !== undefined);
|
|
107725
107570
|
// save import into the local
|
|
107726
107571
|
statements.push(factory.createExpressionStatement(factory.createAssignment(importVariableName, parameterName)));
|
|
107572
|
+
if (ts.hasSyntacticModifier(entry, 1 /* Export */)) {
|
|
107573
|
+
statements.push(factory.createExpressionStatement(factory.createCallExpression(exportFunction,
|
|
107574
|
+
/*typeArguments*/ undefined, [
|
|
107575
|
+
factory.createStringLiteral(ts.idText(importVariableName)),
|
|
107576
|
+
parameterName,
|
|
107577
|
+
])));
|
|
107578
|
+
}
|
|
107727
107579
|
break;
|
|
107728
107580
|
case 272 /* ExportDeclaration */:
|
|
107729
107581
|
ts.Debug.assert(importVariableName !== undefined);
|
|
@@ -110566,8 +110418,12 @@ var ts;
|
|
|
110566
110418
|
}
|
|
110567
110419
|
var previousNeedsDeclare = needsDeclare;
|
|
110568
110420
|
switch (input.kind) {
|
|
110569
|
-
case 259 /* TypeAliasDeclaration */:
|
|
110570
|
-
|
|
110421
|
+
case 259 /* TypeAliasDeclaration */: {
|
|
110422
|
+
needsDeclare = false;
|
|
110423
|
+
var clean = cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode)));
|
|
110424
|
+
needsDeclare = previousNeedsDeclare;
|
|
110425
|
+
return clean;
|
|
110426
|
+
}
|
|
110571
110427
|
case 258 /* InterfaceDeclaration */: {
|
|
110572
110428
|
return cleanup(factory.updateInterfaceDeclaration(input, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree)));
|
|
110573
110429
|
}
|
|
@@ -112071,8 +111927,8 @@ var ts;
|
|
|
112071
111927
|
}
|
|
112072
111928
|
ts.getBuildInfoText = getBuildInfoText;
|
|
112073
111929
|
/*@internal*/
|
|
112074
|
-
function getBuildInfo(buildInfoText) {
|
|
112075
|
-
return
|
|
111930
|
+
function getBuildInfo(buildInfoFile, buildInfoText) {
|
|
111931
|
+
return ts.readJsonOrUndefined(buildInfoFile, buildInfoText);
|
|
112076
111932
|
}
|
|
112077
111933
|
ts.getBuildInfo = getBuildInfo;
|
|
112078
111934
|
/*@internal*/
|
|
@@ -112150,17 +112006,16 @@ var ts;
|
|
|
112150
112006
|
var buildInfo;
|
|
112151
112007
|
if (host.getBuildInfo) {
|
|
112152
112008
|
// If host directly provides buildinfo we can get it directly. This allows host to cache the buildinfo
|
|
112153
|
-
|
|
112154
|
-
if (!hostBuildInfo)
|
|
112155
|
-
return buildInfoPath;
|
|
112156
|
-
buildInfo = hostBuildInfo;
|
|
112009
|
+
buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
|
|
112157
112010
|
}
|
|
112158
112011
|
else {
|
|
112159
112012
|
var buildInfoText = host.readFile(buildInfoPath);
|
|
112160
112013
|
if (!buildInfoText)
|
|
112161
112014
|
return buildInfoPath;
|
|
112162
|
-
buildInfo = getBuildInfo(buildInfoText);
|
|
112015
|
+
buildInfo = getBuildInfo(buildInfoPath, buildInfoText);
|
|
112163
112016
|
}
|
|
112017
|
+
if (!buildInfo)
|
|
112018
|
+
return buildInfoPath;
|
|
112164
112019
|
if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
|
|
112165
112020
|
return buildInfoPath;
|
|
112166
112021
|
var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
|
|
@@ -116818,7 +116673,16 @@ var ts;
|
|
|
116818
116673
|
return cachedReadDirectoryResult.get(ts.ensureTrailingDirectorySeparator(rootDirPath));
|
|
116819
116674
|
}
|
|
116820
116675
|
function getCachedFileSystemEntriesForBaseDir(path) {
|
|
116821
|
-
|
|
116676
|
+
var entries = getCachedFileSystemEntries(ts.getDirectoryPath(path));
|
|
116677
|
+
if (!entries) {
|
|
116678
|
+
return entries;
|
|
116679
|
+
}
|
|
116680
|
+
// If we're looking for the base directory, we're definitely going to search the entries
|
|
116681
|
+
if (!entries.sortedAndCanonicalizedFiles) {
|
|
116682
|
+
entries.sortedAndCanonicalizedFiles = entries.files.map(getCanonicalFileName).sort();
|
|
116683
|
+
entries.sortedAndCanonicalizedDirectories = entries.directories.map(getCanonicalFileName).sort();
|
|
116684
|
+
}
|
|
116685
|
+
return entries;
|
|
116822
116686
|
}
|
|
116823
116687
|
function getBaseNameOfFileName(fileName) {
|
|
116824
116688
|
return ts.getBaseFileName(ts.normalizePath(fileName));
|
|
@@ -116861,21 +116725,10 @@ var ts;
|
|
|
116861
116725
|
return undefined;
|
|
116862
116726
|
}
|
|
116863
116727
|
}
|
|
116864
|
-
function fileNameEqual(name1, name2) {
|
|
116865
|
-
return getCanonicalFileName(name1) === getCanonicalFileName(name2);
|
|
116866
|
-
}
|
|
116867
116728
|
function hasEntry(entries, name) {
|
|
116868
|
-
|
|
116869
|
-
|
|
116870
|
-
|
|
116871
|
-
if (hasEntry(entries, baseName)) {
|
|
116872
|
-
if (!isValid) {
|
|
116873
|
-
return ts.filterMutate(entries, function (entry) { return !fileNameEqual(entry, baseName); });
|
|
116874
|
-
}
|
|
116875
|
-
}
|
|
116876
|
-
else if (isValid) {
|
|
116877
|
-
return entries.push(baseName);
|
|
116878
|
-
}
|
|
116729
|
+
// Case-sensitive comparison since already canonicalized
|
|
116730
|
+
var index = ts.binarySearch(entries, name, ts.identity, ts.compareStringsCaseSensitive);
|
|
116731
|
+
return index >= 0;
|
|
116879
116732
|
}
|
|
116880
116733
|
function writeFile(fileName, data, writeByteOrderMark) {
|
|
116881
116734
|
var path = toPath(fileName);
|
|
@@ -116888,7 +116741,7 @@ var ts;
|
|
|
116888
116741
|
function fileExists(fileName) {
|
|
116889
116742
|
var path = toPath(fileName);
|
|
116890
116743
|
var result = getCachedFileSystemEntriesForBaseDir(path);
|
|
116891
|
-
return result && hasEntry(result.
|
|
116744
|
+
return result && hasEntry(result.sortedAndCanonicalizedFiles, getCanonicalFileName(getBaseNameOfFileName(fileName))) ||
|
|
116892
116745
|
host.fileExists(fileName);
|
|
116893
116746
|
}
|
|
116894
116747
|
function directoryExists(dirPath) {
|
|
@@ -116898,9 +116751,14 @@ var ts;
|
|
|
116898
116751
|
function createDirectory(dirPath) {
|
|
116899
116752
|
var path = toPath(dirPath);
|
|
116900
116753
|
var result = getCachedFileSystemEntriesForBaseDir(path);
|
|
116901
|
-
var baseFileName = getBaseNameOfFileName(dirPath);
|
|
116902
116754
|
if (result) {
|
|
116903
|
-
|
|
116755
|
+
var baseName = getBaseNameOfFileName(dirPath);
|
|
116756
|
+
var canonicalizedBaseName = getCanonicalFileName(baseName);
|
|
116757
|
+
var canonicalizedDirectories = result.sortedAndCanonicalizedDirectories;
|
|
116758
|
+
// Case-sensitive comparison since already canonicalized
|
|
116759
|
+
if (ts.insertSorted(canonicalizedDirectories, canonicalizedBaseName, ts.compareStringsCaseSensitive)) {
|
|
116760
|
+
result.directories.push(baseName);
|
|
116761
|
+
}
|
|
116904
116762
|
}
|
|
116905
116763
|
host.createDirectory(dirPath);
|
|
116906
116764
|
}
|
|
@@ -116969,7 +116827,7 @@ var ts;
|
|
|
116969
116827
|
fileExists: host.fileExists(fileOrDirectoryPath),
|
|
116970
116828
|
directoryExists: host.directoryExists(fileOrDirectoryPath)
|
|
116971
116829
|
};
|
|
116972
|
-
if (fsQueryResult.directoryExists || hasEntry(parentResult.
|
|
116830
|
+
if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) {
|
|
116973
116831
|
// Folder added or removed, clear the cache instead of updating the folder and its structure
|
|
116974
116832
|
clearCache();
|
|
116975
116833
|
}
|
|
@@ -116989,7 +116847,23 @@ var ts;
|
|
|
116989
116847
|
}
|
|
116990
116848
|
}
|
|
116991
116849
|
function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists) {
|
|
116992
|
-
|
|
116850
|
+
var canonicalizedFiles = parentResult.sortedAndCanonicalizedFiles;
|
|
116851
|
+
var canonicalizedBaseName = getCanonicalFileName(baseName);
|
|
116852
|
+
if (fileExists) {
|
|
116853
|
+
// Case-sensitive comparison since already canonicalized
|
|
116854
|
+
if (ts.insertSorted(canonicalizedFiles, canonicalizedBaseName, ts.compareStringsCaseSensitive)) {
|
|
116855
|
+
parentResult.files.push(baseName);
|
|
116856
|
+
}
|
|
116857
|
+
}
|
|
116858
|
+
else {
|
|
116859
|
+
// Case-sensitive comparison since already canonicalized
|
|
116860
|
+
var sortedIndex = ts.binarySearch(canonicalizedFiles, canonicalizedBaseName, ts.identity, ts.compareStringsCaseSensitive);
|
|
116861
|
+
if (sortedIndex >= 0) {
|
|
116862
|
+
canonicalizedFiles.splice(sortedIndex, 1);
|
|
116863
|
+
var unsortedIndex = parentResult.files.findIndex(function (entry) { return getCanonicalFileName(entry) === canonicalizedBaseName; });
|
|
116864
|
+
parentResult.files.splice(unsortedIndex, 1);
|
|
116865
|
+
}
|
|
116866
|
+
}
|
|
116993
116867
|
}
|
|
116994
116868
|
function clearCache() {
|
|
116995
116869
|
cachedReadDirectoryResult.clear();
|
|
@@ -125227,18 +125101,14 @@ var ts;
|
|
|
125227
125101
|
if (host.getBuildInfo) {
|
|
125228
125102
|
// host provides buildinfo, get it from there. This allows host to cache it
|
|
125229
125103
|
buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
|
|
125230
|
-
if (!buildInfo)
|
|
125231
|
-
return undefined;
|
|
125232
125104
|
}
|
|
125233
125105
|
else {
|
|
125234
125106
|
var content = host.readFile(buildInfoPath);
|
|
125235
125107
|
if (!content)
|
|
125236
125108
|
return undefined;
|
|
125237
|
-
buildInfo = ts.getBuildInfo(content);
|
|
125109
|
+
buildInfo = ts.getBuildInfo(buildInfoPath, content);
|
|
125238
125110
|
}
|
|
125239
|
-
if (buildInfo.version !== ts.version)
|
|
125240
|
-
return undefined;
|
|
125241
|
-
if (!buildInfo.program)
|
|
125111
|
+
if (!buildInfo || buildInfo.version !== ts.version || !buildInfo.program)
|
|
125242
125112
|
return undefined;
|
|
125243
125113
|
return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
|
|
125244
125114
|
}
|
|
@@ -125460,7 +125330,8 @@ var ts;
|
|
|
125460
125330
|
}
|
|
125461
125331
|
// All resolutions are invalid if user provided resolutions
|
|
125462
125332
|
var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution);
|
|
125463
|
-
|
|
125333
|
+
var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile;
|
|
125334
|
+
if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
125464
125335
|
if (hasChangedConfigFileParsingErrors) {
|
|
125465
125336
|
if (reportFileChangeDetectedOnCreateProgram) {
|
|
125466
125337
|
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
@@ -125479,6 +125350,11 @@ var ts;
|
|
|
125479
125350
|
if (host.afterProgramCreate && program !== builderProgram) {
|
|
125480
125351
|
host.afterProgramCreate(builderProgram);
|
|
125481
125352
|
}
|
|
125353
|
+
compilerHost.readFile = originalReadFile;
|
|
125354
|
+
compilerHost.fileExists = originalFileExists;
|
|
125355
|
+
compilerHost.directoryExists = originalDirectoryExists;
|
|
125356
|
+
compilerHost.createDirectory = originalCreateDirectory;
|
|
125357
|
+
compilerHost.writeFile = originalWriteFile;
|
|
125482
125358
|
return builderProgram;
|
|
125483
125359
|
}
|
|
125484
125360
|
function createNewProgram(hasInvalidatedResolution) {
|
|
@@ -125956,19 +125832,20 @@ var ts;
|
|
|
125956
125832
|
*/
|
|
125957
125833
|
UpToDateStatusType[UpToDateStatusType["OutOfDateWithPrepend"] = 3] = "OutOfDateWithPrepend";
|
|
125958
125834
|
UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
|
|
125959
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125960
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125961
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125962
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125963
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125964
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125965
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125966
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125835
|
+
UpToDateStatusType[UpToDateStatusType["ErrorReadingFile"] = 5] = "ErrorReadingFile";
|
|
125836
|
+
UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 6] = "OutOfDateWithSelf";
|
|
125837
|
+
UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 7] = "OutOfDateWithUpstream";
|
|
125838
|
+
UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 8] = "OutOfDateBuildInfo";
|
|
125839
|
+
UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 9] = "UpstreamOutOfDate";
|
|
125840
|
+
UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 10] = "UpstreamBlocked";
|
|
125841
|
+
UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 11] = "ComputingUpstream";
|
|
125842
|
+
UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 12] = "TsVersionOutputOfDate";
|
|
125843
|
+
UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 13] = "UpToDateWithInputFileText";
|
|
125967
125844
|
/**
|
|
125968
125845
|
* Projects with no outputs (i.e. "solution" files)
|
|
125969
125846
|
*/
|
|
125970
|
-
UpToDateStatusType[UpToDateStatusType["ContainerOnly"] =
|
|
125971
|
-
UpToDateStatusType[UpToDateStatusType["ForceBuild"] =
|
|
125847
|
+
UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 14] = "ContainerOnly";
|
|
125848
|
+
UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 15] = "ForceBuild";
|
|
125972
125849
|
})(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
|
|
125973
125850
|
function resolveConfigFileProjectName(project) {
|
|
125974
125851
|
if (ts.fileExtensionIs(project, ".json" /* Json */)) {
|
|
@@ -126670,13 +126547,13 @@ var ts;
|
|
|
126670
126547
|
var emitterDiagnostics = ts.createDiagnosticCollection();
|
|
126671
126548
|
var emittedOutputs = new ts.Map();
|
|
126672
126549
|
var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
|
|
126673
|
-
var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
|
|
126550
|
+
var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo || undefined;
|
|
126674
126551
|
outputFiles.forEach(function (_a) {
|
|
126675
126552
|
var _b, _c;
|
|
126676
126553
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
|
|
126677
126554
|
emittedOutputs.set(toPath(state, name), name);
|
|
126678
126555
|
if (buildInfo) {
|
|
126679
|
-
if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) {
|
|
126556
|
+
if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo === null || existingBuildInfo === void 0 ? void 0 : existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) {
|
|
126680
126557
|
resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
|
|
126681
126558
|
}
|
|
126682
126559
|
setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags);
|
|
@@ -126969,8 +126846,7 @@ var ts;
|
|
|
126969
126846
|
return existing.buildInfo || undefined;
|
|
126970
126847
|
}
|
|
126971
126848
|
var value = state.readFileWithCache(buildInfoPath);
|
|
126972
|
-
var buildInfo = value ? ts.getBuildInfo(value) : undefined;
|
|
126973
|
-
ts.Debug.assert(modifiedTime || !buildInfo);
|
|
126849
|
+
var buildInfo = value ? ts.getBuildInfo(buildInfoPath, value) : undefined;
|
|
126974
126850
|
state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
|
|
126975
126851
|
return buildInfo;
|
|
126976
126852
|
}
|
|
@@ -127055,7 +126931,14 @@ var ts;
|
|
|
127055
126931
|
missingOutputFileName: buildInfoPath
|
|
127056
126932
|
};
|
|
127057
126933
|
}
|
|
127058
|
-
var buildInfo =
|
|
126934
|
+
var buildInfo = getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime);
|
|
126935
|
+
if (!buildInfo) {
|
|
126936
|
+
// Error reading buildInfo
|
|
126937
|
+
return {
|
|
126938
|
+
type: ts.UpToDateStatusType.ErrorReadingFile,
|
|
126939
|
+
fileName: buildInfoPath
|
|
126940
|
+
};
|
|
126941
|
+
}
|
|
127059
126942
|
if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
|
|
127060
126943
|
return {
|
|
127061
126944
|
type: ts.UpToDateStatusType.TsVersionOutputOfDate,
|
|
@@ -127713,6 +127596,8 @@ var ts;
|
|
|
127713
127596
|
return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_1_is_older_than_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerProjectName));
|
|
127714
127597
|
case ts.UpToDateStatusType.OutputMissing:
|
|
127715
127598
|
return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(state, configFileName), relName(state, status.missingOutputFileName));
|
|
127599
|
+
case ts.UpToDateStatusType.ErrorReadingFile:
|
|
127600
|
+
return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_there_was_error_reading_file_1, relName(state, configFileName), relName(state, status.fileName));
|
|
127716
127601
|
case ts.UpToDateStatusType.OutOfDateBuildInfo:
|
|
127717
127602
|
return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted, relName(state, configFileName), relName(state, status.buildInfoFile));
|
|
127718
127603
|
case ts.UpToDateStatusType.UpToDate:
|
|
@@ -157166,6 +157051,15 @@ var ts;
|
|
|
157166
157051
|
ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code,
|
|
157167
157052
|
ts.Diagnostics.Cannot_find_name_0.code
|
|
157168
157053
|
];
|
|
157054
|
+
var InfoKind;
|
|
157055
|
+
(function (InfoKind) {
|
|
157056
|
+
InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration";
|
|
157057
|
+
InfoKind[InfoKind["Enum"] = 1] = "Enum";
|
|
157058
|
+
InfoKind[InfoKind["Function"] = 2] = "Function";
|
|
157059
|
+
InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral";
|
|
157060
|
+
InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes";
|
|
157061
|
+
InfoKind[InfoKind["Signature"] = 5] = "Signature";
|
|
157062
|
+
})(InfoKind || (InfoKind = {}));
|
|
157169
157063
|
codefix.registerCodeFix({
|
|
157170
157064
|
errorCodes: errorCodes,
|
|
157171
157065
|
getCodeActions: function (context) {
|
|
@@ -157174,19 +157068,19 @@ var ts;
|
|
|
157174
157068
|
if (!info) {
|
|
157175
157069
|
return undefined;
|
|
157176
157070
|
}
|
|
157177
|
-
if (info.kind ===
|
|
157071
|
+
if (info.kind === InfoKind.ObjectLiteral) {
|
|
157178
157072
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addObjectLiteralProperties(t, context, info); });
|
|
157179
157073
|
return [codefix.createCodeFixAction(fixMissingProperties, changes, ts.Diagnostics.Add_missing_properties, fixMissingProperties, ts.Diagnostics.Add_all_missing_properties)];
|
|
157180
157074
|
}
|
|
157181
|
-
if (info.kind ===
|
|
157075
|
+
if (info.kind === InfoKind.JsxAttributes) {
|
|
157182
157076
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addJsxAttributes(t, context, info); });
|
|
157183
157077
|
return [codefix.createCodeFixAction(fixMissingAttributes, changes, ts.Diagnostics.Add_missing_attributes, fixMissingAttributes, ts.Diagnostics.Add_all_missing_attributes)];
|
|
157184
157078
|
}
|
|
157185
|
-
if (info.kind ===
|
|
157079
|
+
if (info.kind === InfoKind.Function || info.kind === InfoKind.Signature) {
|
|
157186
157080
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addFunctionDeclaration(t, context, info); });
|
|
157187
157081
|
return [codefix.createCodeFixAction(fixMissingFunctionDeclaration, changes, [ts.Diagnostics.Add_missing_function_declaration_0, info.token.text], fixMissingFunctionDeclaration, ts.Diagnostics.Add_all_missing_function_declarations)];
|
|
157188
157082
|
}
|
|
157189
|
-
if (info.kind ===
|
|
157083
|
+
if (info.kind === InfoKind.Enum) {
|
|
157190
157084
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addEnumMemberDeclaration(t, context.program.getTypeChecker(), info); });
|
|
157191
157085
|
return [codefix.createCodeFixAction(fixMissingMember, changes, [ts.Diagnostics.Add_missing_enum_member_0, info.token.text], fixMissingMember, ts.Diagnostics.Add_all_missing_members)];
|
|
157192
157086
|
}
|
|
@@ -157204,20 +157098,20 @@ var ts;
|
|
|
157204
157098
|
if (!info || !ts.addToSeen(seen, ts.getNodeId(info.parentDeclaration) + "#" + info.token.text)) {
|
|
157205
157099
|
return;
|
|
157206
157100
|
}
|
|
157207
|
-
if (fixId === fixMissingFunctionDeclaration && info.kind ===
|
|
157101
|
+
if (fixId === fixMissingFunctionDeclaration && (info.kind === InfoKind.Function || info.kind === InfoKind.Signature)) {
|
|
157208
157102
|
addFunctionDeclaration(changes, context, info);
|
|
157209
157103
|
}
|
|
157210
|
-
else if (fixId === fixMissingProperties && info.kind ===
|
|
157104
|
+
else if (fixId === fixMissingProperties && info.kind === InfoKind.ObjectLiteral) {
|
|
157211
157105
|
addObjectLiteralProperties(changes, context, info);
|
|
157212
157106
|
}
|
|
157213
|
-
else if (fixId === fixMissingAttributes && info.kind ===
|
|
157107
|
+
else if (fixId === fixMissingAttributes && info.kind === InfoKind.JsxAttributes) {
|
|
157214
157108
|
addJsxAttributes(changes, context, info);
|
|
157215
157109
|
}
|
|
157216
157110
|
else {
|
|
157217
|
-
if (info.kind ===
|
|
157111
|
+
if (info.kind === InfoKind.Enum) {
|
|
157218
157112
|
addEnumMemberDeclaration(changes, checker, info);
|
|
157219
157113
|
}
|
|
157220
|
-
if (info.kind ===
|
|
157114
|
+
if (info.kind === InfoKind.TypeLikeDeclaration) {
|
|
157221
157115
|
var parentDeclaration = info.parentDeclaration, token_1 = info.token;
|
|
157222
157116
|
var infos = ts.getOrUpdate(typeDeclToMembers, parentDeclaration, function () { return []; });
|
|
157223
157117
|
if (!infos.some(function (i) { return i.token.text === token_1.text; })) {
|
|
@@ -157261,14 +157155,6 @@ var ts;
|
|
|
157261
157155
|
}));
|
|
157262
157156
|
},
|
|
157263
157157
|
});
|
|
157264
|
-
var InfoKind;
|
|
157265
|
-
(function (InfoKind) {
|
|
157266
|
-
InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration";
|
|
157267
|
-
InfoKind[InfoKind["Enum"] = 1] = "Enum";
|
|
157268
|
-
InfoKind[InfoKind["Function"] = 2] = "Function";
|
|
157269
|
-
InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral";
|
|
157270
|
-
InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes";
|
|
157271
|
-
})(InfoKind || (InfoKind = {}));
|
|
157272
157158
|
function getInfo(sourceFile, tokenPos, errorCode, checker, program) {
|
|
157273
157159
|
// The identifier of the missing property. eg:
|
|
157274
157160
|
// this.missing = 1;
|
|
@@ -157290,7 +157176,7 @@ var ts;
|
|
|
157290
157176
|
var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent), checker.getParameterType(signature, argIndex), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false));
|
|
157291
157177
|
if (!ts.length(properties))
|
|
157292
157178
|
return undefined;
|
|
157293
|
-
return { kind:
|
|
157179
|
+
return { kind: InfoKind.ObjectLiteral, token: param.name, properties: properties, parentDeclaration: parent };
|
|
157294
157180
|
}
|
|
157295
157181
|
if (!ts.isMemberName(token))
|
|
157296
157182
|
return undefined;
|
|
@@ -157298,17 +157184,26 @@ var ts;
|
|
|
157298
157184
|
var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent.initializer), checker.getTypeAtLocation(token), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false));
|
|
157299
157185
|
if (!ts.length(properties))
|
|
157300
157186
|
return undefined;
|
|
157301
|
-
return { kind:
|
|
157187
|
+
return { kind: InfoKind.ObjectLiteral, token: token, properties: properties, parentDeclaration: parent.initializer };
|
|
157302
157188
|
}
|
|
157303
157189
|
if (ts.isIdentifier(token) && ts.isJsxOpeningLikeElement(token.parent)) {
|
|
157304
157190
|
var target = ts.getEmitScriptTarget(program.getCompilerOptions());
|
|
157305
157191
|
var attributes = getUnmatchedAttributes(checker, target, token.parent);
|
|
157306
157192
|
if (!ts.length(attributes))
|
|
157307
157193
|
return undefined;
|
|
157308
|
-
return { kind:
|
|
157194
|
+
return { kind: InfoKind.JsxAttributes, token: token, attributes: attributes, parentDeclaration: token.parent };
|
|
157309
157195
|
}
|
|
157310
|
-
if (ts.isIdentifier(token)
|
|
157311
|
-
|
|
157196
|
+
if (ts.isIdentifier(token)) {
|
|
157197
|
+
var type = checker.getContextualType(token);
|
|
157198
|
+
if (type && ts.getObjectFlags(type) & 16 /* Anonymous */) {
|
|
157199
|
+
var signature = ts.firstOrUndefined(checker.getSignaturesOfType(type, 0 /* Call */));
|
|
157200
|
+
if (signature === undefined)
|
|
157201
|
+
return undefined;
|
|
157202
|
+
return { kind: InfoKind.Signature, token: token, signature: signature, sourceFile: sourceFile, parentDeclaration: findScope(token) };
|
|
157203
|
+
}
|
|
157204
|
+
if (ts.isCallExpression(parent) && parent.expression === token) {
|
|
157205
|
+
return { kind: InfoKind.Function, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* None */, parentDeclaration: findScope(token) };
|
|
157206
|
+
}
|
|
157312
157207
|
}
|
|
157313
157208
|
if (!ts.isPropertyAccessExpression(parent))
|
|
157314
157209
|
return undefined;
|
|
@@ -157320,13 +157215,13 @@ var ts;
|
|
|
157320
157215
|
var moduleDeclaration = ts.find(symbol.declarations, ts.isModuleDeclaration);
|
|
157321
157216
|
var moduleDeclarationSourceFile = moduleDeclaration === null || moduleDeclaration === void 0 ? void 0 : moduleDeclaration.getSourceFile();
|
|
157322
157217
|
if (moduleDeclaration && moduleDeclarationSourceFile && !isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) {
|
|
157323
|
-
return { kind:
|
|
157218
|
+
return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* Export */, parentDeclaration: moduleDeclaration };
|
|
157324
157219
|
}
|
|
157325
157220
|
var moduleSourceFile = ts.find(symbol.declarations, ts.isSourceFile);
|
|
157326
157221
|
if (sourceFile.commonJsModuleIndicator)
|
|
157327
157222
|
return undefined;
|
|
157328
157223
|
if (moduleSourceFile && !isSourceFileFromLibrary(program, moduleSourceFile)) {
|
|
157329
|
-
return { kind:
|
|
157224
|
+
return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* Export */, parentDeclaration: moduleSourceFile };
|
|
157330
157225
|
}
|
|
157331
157226
|
}
|
|
157332
157227
|
var classDeclaration = ts.find(symbol.declarations, ts.isClassLike);
|
|
@@ -157344,11 +157239,11 @@ var ts;
|
|
|
157344
157239
|
(makeStatic ? 32 /* Static */ : 0 /* None */) | (ts.startsWithUnderscore(token.text) ? 8 /* Private */ : 0 /* None */);
|
|
157345
157240
|
var isJSFile = ts.isSourceFileJS(declSourceFile);
|
|
157346
157241
|
var call = ts.tryCast(parent.parent, ts.isCallExpression);
|
|
157347
|
-
return { kind:
|
|
157242
|
+
return { kind: InfoKind.TypeLikeDeclaration, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile };
|
|
157348
157243
|
}
|
|
157349
157244
|
var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration);
|
|
157350
157245
|
if (enumDeclaration && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
|
|
157351
|
-
return { kind:
|
|
157246
|
+
return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration };
|
|
157352
157247
|
}
|
|
157353
157248
|
return undefined;
|
|
157354
157249
|
}
|
|
@@ -157524,9 +157419,17 @@ var ts;
|
|
|
157524
157419
|
});
|
|
157525
157420
|
}
|
|
157526
157421
|
function addFunctionDeclaration(changes, context, info) {
|
|
157422
|
+
var quotePreference = ts.getQuotePreference(context.sourceFile, context.preferences);
|
|
157527
157423
|
var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host);
|
|
157528
|
-
var functionDeclaration =
|
|
157529
|
-
|
|
157424
|
+
var functionDeclaration = info.kind === InfoKind.Function
|
|
157425
|
+
? codefix.createSignatureDeclarationFromCallExpression(256 /* FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration)
|
|
157426
|
+
: codefix.createSignatureDeclarationFromSignature(256 /* FunctionDeclaration */, context, quotePreference, info.signature, codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), info.token, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ undefined, importAdder);
|
|
157427
|
+
if (functionDeclaration === undefined) {
|
|
157428
|
+
ts.Debug.fail("fixMissingFunctionDeclaration codefix got unexpected error.");
|
|
157429
|
+
}
|
|
157430
|
+
ts.isReturnStatement(info.parentDeclaration)
|
|
157431
|
+
? changes.insertNodeBefore(info.sourceFile, info.parentDeclaration, functionDeclaration, /*blankLineBetween*/ true)
|
|
157432
|
+
: changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration);
|
|
157530
157433
|
importAdder.writeFixes(changes);
|
|
157531
157434
|
}
|
|
157532
157435
|
function addJsxAttributes(changes, context, info) {
|
|
@@ -157684,6 +157587,14 @@ var ts;
|
|
|
157684
157587
|
}
|
|
157685
157588
|
return ts.createPropertyNameNodeForIdentifierOrLiteral(symbol.name, target, quotePreference === 0 /* Single */);
|
|
157686
157589
|
}
|
|
157590
|
+
function findScope(node) {
|
|
157591
|
+
if (ts.findAncestor(node, ts.isJsxExpression)) {
|
|
157592
|
+
var returnStatement = ts.findAncestor(node.parent, ts.isReturnStatement);
|
|
157593
|
+
if (returnStatement)
|
|
157594
|
+
return returnStatement;
|
|
157595
|
+
}
|
|
157596
|
+
return ts.getSourceFileOfNode(node);
|
|
157597
|
+
}
|
|
157687
157598
|
})(codefix = ts.codefix || (ts.codefix = {}));
|
|
157688
157599
|
})(ts || (ts = {}));
|
|
157689
157600
|
/* @internal */
|
|
@@ -160373,6 +160284,9 @@ var ts;
|
|
|
160373
160284
|
if (ts.isMethodDeclaration(signatureDeclaration)) {
|
|
160374
160285
|
return ts.factory.updateMethodDeclaration(signatureDeclaration, modifiers, asteriskToken, name !== null && name !== void 0 ? name : ts.factory.createIdentifier(""), questionToken, typeParameters, parameters, type, body);
|
|
160375
160286
|
}
|
|
160287
|
+
if (ts.isFunctionDeclaration(signatureDeclaration)) {
|
|
160288
|
+
return ts.factory.updateFunctionDeclaration(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, ts.tryCast(name, ts.isIdentifier), typeParameters, parameters, type, body !== null && body !== void 0 ? body : signatureDeclaration.body);
|
|
160289
|
+
}
|
|
160376
160290
|
return undefined;
|
|
160377
160291
|
}
|
|
160378
160292
|
codefix.createSignatureDeclarationFromSignature = createSignatureDeclarationFromSignature;
|
|
@@ -167675,6 +167589,10 @@ var ts;
|
|
|
167675
167589
|
getCurrentDirectory: compilerHost.getCurrentDirectory,
|
|
167676
167590
|
onUnRecoverableConfigFileDiagnostic: ts.noop,
|
|
167677
167591
|
};
|
|
167592
|
+
// The call to isProgramUptoDate below may refer back to documentRegistryBucketKey;
|
|
167593
|
+
// calculate this early so it's not undefined if downleveled to a var (or, if emitted
|
|
167594
|
+
// as a const variable without downleveling, doesn't crash).
|
|
167595
|
+
var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
|
|
167678
167596
|
// If the program is already up-to-date, we can reuse it
|
|
167679
167597
|
if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
167680
167598
|
return;
|
|
@@ -167684,7 +167602,6 @@ var ts;
|
|
|
167684
167602
|
// instance. If we cancel midway through, we may end up in an inconsistent state where
|
|
167685
167603
|
// the program points to old source files that have been invalidated because of
|
|
167686
167604
|
// incremental parsing.
|
|
167687
|
-
var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
|
|
167688
167605
|
var options = {
|
|
167689
167606
|
rootNames: rootFileNames,
|
|
167690
167607
|
options: newSettings,
|