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
|
@@ -91,210 +91,15 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
91
91
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
92
92
|
};
|
|
93
93
|
})();
|
|
94
|
-
/* @internal */
|
|
95
|
-
var ts;
|
|
96
|
-
(function (ts) {
|
|
97
|
-
function createMapData() {
|
|
98
|
-
var sentinel = {};
|
|
99
|
-
sentinel.prev = sentinel;
|
|
100
|
-
return { head: sentinel, tail: sentinel, size: 0 };
|
|
101
|
-
}
|
|
102
|
-
function createMapEntry(key, value) {
|
|
103
|
-
return { key: key, value: value, next: undefined, prev: undefined };
|
|
104
|
-
}
|
|
105
|
-
function sameValueZero(x, y) {
|
|
106
|
-
// Treats -0 === 0 and NaN === NaN
|
|
107
|
-
return x === y || x !== x && y !== y;
|
|
108
|
-
}
|
|
109
|
-
function getPrev(entry) {
|
|
110
|
-
var prev = entry.prev;
|
|
111
|
-
// Entries without a 'prev' have been removed from the map.
|
|
112
|
-
// An entry whose 'prev' points to itself is the head of the list and is invalid here.
|
|
113
|
-
if (!prev || prev === entry)
|
|
114
|
-
throw new Error("Illegal state");
|
|
115
|
-
return prev;
|
|
116
|
-
}
|
|
117
|
-
function getNext(entry) {
|
|
118
|
-
while (entry) {
|
|
119
|
-
// Entries without a 'prev' have been removed from the map. Their 'next'
|
|
120
|
-
// pointer should point to the previous entry prior to deletion and
|
|
121
|
-
// that entry should be skipped to resume iteration.
|
|
122
|
-
var skipNext = !entry.prev;
|
|
123
|
-
entry = entry.next;
|
|
124
|
-
if (skipNext) {
|
|
125
|
-
continue;
|
|
126
|
-
}
|
|
127
|
-
return entry;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
function getEntry(data, key) {
|
|
131
|
-
// We walk backwards from 'tail' to prioritize recently added entries.
|
|
132
|
-
// We skip 'head' because it is an empty entry used to track iteration start.
|
|
133
|
-
for (var entry = data.tail; entry !== data.head; entry = getPrev(entry)) {
|
|
134
|
-
if (sameValueZero(entry.key, key)) {
|
|
135
|
-
return entry;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
function addOrUpdateEntry(data, key, value) {
|
|
140
|
-
var existing = getEntry(data, key);
|
|
141
|
-
if (existing) {
|
|
142
|
-
existing.value = value;
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
var entry = createMapEntry(key, value);
|
|
146
|
-
entry.prev = data.tail;
|
|
147
|
-
data.tail.next = entry;
|
|
148
|
-
data.tail = entry;
|
|
149
|
-
data.size++;
|
|
150
|
-
return entry;
|
|
151
|
-
}
|
|
152
|
-
function deleteEntry(data, key) {
|
|
153
|
-
// We walk backwards from 'tail' to prioritize recently added entries.
|
|
154
|
-
// We skip 'head' because it is an empty entry used to track iteration start.
|
|
155
|
-
for (var entry = data.tail; entry !== data.head; entry = getPrev(entry)) {
|
|
156
|
-
// all entries in the map should have a 'prev' pointer.
|
|
157
|
-
if (entry.prev === undefined)
|
|
158
|
-
throw new Error("Illegal state");
|
|
159
|
-
if (sameValueZero(entry.key, key)) {
|
|
160
|
-
if (entry.next) {
|
|
161
|
-
entry.next.prev = entry.prev;
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
// an entry in the map without a 'next' pointer must be the 'tail'.
|
|
165
|
-
if (data.tail !== entry)
|
|
166
|
-
throw new Error("Illegal state");
|
|
167
|
-
data.tail = entry.prev;
|
|
168
|
-
}
|
|
169
|
-
entry.prev.next = entry.next;
|
|
170
|
-
entry.next = entry.prev;
|
|
171
|
-
entry.prev = undefined;
|
|
172
|
-
data.size--;
|
|
173
|
-
return entry;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
function clearEntries(data) {
|
|
178
|
-
var node = data.tail;
|
|
179
|
-
while (node !== data.head) {
|
|
180
|
-
var prev = getPrev(node);
|
|
181
|
-
node.next = data.head;
|
|
182
|
-
node.prev = undefined;
|
|
183
|
-
node = prev;
|
|
184
|
-
}
|
|
185
|
-
data.head.next = undefined;
|
|
186
|
-
data.tail = data.head;
|
|
187
|
-
data.size = 0;
|
|
188
|
-
}
|
|
189
|
-
function forEachEntry(data, action) {
|
|
190
|
-
var entry = data.head;
|
|
191
|
-
while (entry) {
|
|
192
|
-
entry = getNext(entry);
|
|
193
|
-
if (entry) {
|
|
194
|
-
action(entry.value, entry.key);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
function forEachIteration(iterator, action) {
|
|
199
|
-
if (iterator) {
|
|
200
|
-
for (var step = iterator.next(); !step.done; step = iterator.next()) {
|
|
201
|
-
action(step.value);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
function createIteratorData(data, selector) {
|
|
206
|
-
return { current: data.head, selector: selector };
|
|
207
|
-
}
|
|
208
|
-
function iteratorNext(data) {
|
|
209
|
-
// Navigate to the next entry.
|
|
210
|
-
data.current = getNext(data.current);
|
|
211
|
-
if (data.current) {
|
|
212
|
-
return { value: data.selector(data.current.key, data.current.value), done: false };
|
|
213
|
-
}
|
|
214
|
-
else {
|
|
215
|
-
return { value: undefined, done: true };
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
/* @internal */
|
|
219
|
-
var ShimCollections;
|
|
220
|
-
(function (ShimCollections) {
|
|
221
|
-
function createMapShim(getIterator) {
|
|
222
|
-
var MapIterator = /** @class */ (function () {
|
|
223
|
-
function MapIterator(data, selector) {
|
|
224
|
-
this._data = createIteratorData(data, selector);
|
|
225
|
-
}
|
|
226
|
-
MapIterator.prototype.next = function () { return iteratorNext(this._data); };
|
|
227
|
-
return MapIterator;
|
|
228
|
-
}());
|
|
229
|
-
return /** @class */ (function () {
|
|
230
|
-
function Map(iterable) {
|
|
231
|
-
var _this = this;
|
|
232
|
-
this._mapData = createMapData();
|
|
233
|
-
forEachIteration(getIterator(iterable), function (_a) {
|
|
234
|
-
var key = _a[0], value = _a[1];
|
|
235
|
-
return _this.set(key, value);
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
Object.defineProperty(Map.prototype, "size", {
|
|
239
|
-
get: function () { return this._mapData.size; },
|
|
240
|
-
enumerable: false,
|
|
241
|
-
configurable: true
|
|
242
|
-
});
|
|
243
|
-
Map.prototype.get = function (key) { var _a; return (_a = getEntry(this._mapData, key)) === null || _a === void 0 ? void 0 : _a.value; };
|
|
244
|
-
Map.prototype.set = function (key, value) { return addOrUpdateEntry(this._mapData, key, value), this; };
|
|
245
|
-
Map.prototype.has = function (key) { return !!getEntry(this._mapData, key); };
|
|
246
|
-
Map.prototype.delete = function (key) { return !!deleteEntry(this._mapData, key); };
|
|
247
|
-
Map.prototype.clear = function () { clearEntries(this._mapData); };
|
|
248
|
-
Map.prototype.keys = function () { return new MapIterator(this._mapData, function (key, _value) { return key; }); };
|
|
249
|
-
Map.prototype.values = function () { return new MapIterator(this._mapData, function (_key, value) { return value; }); };
|
|
250
|
-
Map.prototype.entries = function () { return new MapIterator(this._mapData, function (key, value) { return [key, value]; }); };
|
|
251
|
-
Map.prototype.forEach = function (action) { forEachEntry(this._mapData, action); };
|
|
252
|
-
return Map;
|
|
253
|
-
}());
|
|
254
|
-
}
|
|
255
|
-
ShimCollections.createMapShim = createMapShim;
|
|
256
|
-
function createSetShim(getIterator) {
|
|
257
|
-
var SetIterator = /** @class */ (function () {
|
|
258
|
-
function SetIterator(data, selector) {
|
|
259
|
-
this._data = createIteratorData(data, selector);
|
|
260
|
-
}
|
|
261
|
-
SetIterator.prototype.next = function () { return iteratorNext(this._data); };
|
|
262
|
-
return SetIterator;
|
|
263
|
-
}());
|
|
264
|
-
return /** @class */ (function () {
|
|
265
|
-
function Set(iterable) {
|
|
266
|
-
var _this = this;
|
|
267
|
-
this._mapData = createMapData();
|
|
268
|
-
forEachIteration(getIterator(iterable), function (value) { return _this.add(value); });
|
|
269
|
-
}
|
|
270
|
-
Object.defineProperty(Set.prototype, "size", {
|
|
271
|
-
get: function () { return this._mapData.size; },
|
|
272
|
-
enumerable: false,
|
|
273
|
-
configurable: true
|
|
274
|
-
});
|
|
275
|
-
Set.prototype.add = function (value) { return addOrUpdateEntry(this._mapData, value, value), this; };
|
|
276
|
-
Set.prototype.has = function (value) { return !!getEntry(this._mapData, value); };
|
|
277
|
-
Set.prototype.delete = function (value) { return !!deleteEntry(this._mapData, value); };
|
|
278
|
-
Set.prototype.clear = function () { clearEntries(this._mapData); };
|
|
279
|
-
Set.prototype.keys = function () { return new SetIterator(this._mapData, function (key, _value) { return key; }); };
|
|
280
|
-
Set.prototype.values = function () { return new SetIterator(this._mapData, function (_key, value) { return value; }); };
|
|
281
|
-
Set.prototype.entries = function () { return new SetIterator(this._mapData, function (key, value) { return [key, value]; }); };
|
|
282
|
-
Set.prototype.forEach = function (action) { forEachEntry(this._mapData, action); };
|
|
283
|
-
return Set;
|
|
284
|
-
}());
|
|
285
|
-
}
|
|
286
|
-
ShimCollections.createSetShim = createSetShim;
|
|
287
|
-
})(ShimCollections = ts.ShimCollections || (ts.ShimCollections = {}));
|
|
288
|
-
})(ts || (ts = {}));
|
|
289
94
|
var ts;
|
|
290
95
|
(function (ts) {
|
|
291
96
|
// WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values.
|
|
292
97
|
// If changing the text in this section, be sure to test `configurePrerelease` too.
|
|
293
|
-
ts.versionMajorMinor = "4.
|
|
98
|
+
ts.versionMajorMinor = "4.9";
|
|
294
99
|
// The following is baselined as a literal template type without intervention
|
|
295
100
|
/** The version of the TypeScript compiler release */
|
|
296
101
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
102
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220811";
|
|
298
103
|
/* @internal */
|
|
299
104
|
var Comparison;
|
|
300
105
|
(function (Comparison) {
|
|
@@ -316,7 +121,11 @@ var ts;
|
|
|
316
121
|
// Internet Explorer's Map doesn't support iteration, so don't use it.
|
|
317
122
|
var gMap = globals === null || globals === void 0 ? void 0 : globals.Map;
|
|
318
123
|
// eslint-disable-next-line no-in-operator
|
|
319
|
-
|
|
124
|
+
var constructor = typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined;
|
|
125
|
+
if (!constructor) {
|
|
126
|
+
throw new Error("No compatible Map implementation found.");
|
|
127
|
+
}
|
|
128
|
+
return constructor;
|
|
320
129
|
}
|
|
321
130
|
NativeCollections.tryGetNativeMap = tryGetNativeMap;
|
|
322
131
|
/**
|
|
@@ -326,23 +135,18 @@ var ts;
|
|
|
326
135
|
// Internet Explorer's Set doesn't support iteration, so don't use it.
|
|
327
136
|
var gSet = globals === null || globals === void 0 ? void 0 : globals.Set;
|
|
328
137
|
// eslint-disable-next-line no-in-operator
|
|
329
|
-
|
|
138
|
+
var constructor = typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined;
|
|
139
|
+
if (!constructor) {
|
|
140
|
+
throw new Error("No compatible Set implementation found.");
|
|
141
|
+
}
|
|
142
|
+
return constructor;
|
|
330
143
|
}
|
|
331
144
|
NativeCollections.tryGetNativeSet = tryGetNativeSet;
|
|
332
145
|
})(NativeCollections || (NativeCollections = {}));
|
|
333
146
|
/* @internal */
|
|
334
|
-
ts.Map =
|
|
147
|
+
ts.Map = NativeCollections.tryGetNativeMap();
|
|
335
148
|
/* @internal */
|
|
336
|
-
ts.Set =
|
|
337
|
-
/* @internal */
|
|
338
|
-
function getCollectionImplementation(name, nativeFactory, shimFactory) {
|
|
339
|
-
var _a;
|
|
340
|
-
// NOTE: ts.ShimCollections will be defined for typescriptServices.js but not for tsc.js, so we must test for it.
|
|
341
|
-
var constructor = (_a = NativeCollections[nativeFactory]()) !== null && _a !== void 0 ? _a : ts.ShimCollections === null || ts.ShimCollections === void 0 ? void 0 : ts.ShimCollections[shimFactory](ts.getIterator);
|
|
342
|
-
if (constructor)
|
|
343
|
-
return constructor;
|
|
344
|
-
throw new Error("TypeScript requires an environment that provides a compatible native " + name + " implementation.");
|
|
345
|
-
}
|
|
149
|
+
ts.Set = NativeCollections.tryGetNativeSet();
|
|
346
150
|
})(ts || (ts = {}));
|
|
347
151
|
/* @internal */
|
|
348
152
|
var ts;
|
|
@@ -1058,15 +862,18 @@ var ts;
|
|
|
1058
862
|
function insertSorted(array, insert, compare, allowDuplicates) {
|
|
1059
863
|
if (array.length === 0) {
|
|
1060
864
|
array.push(insert);
|
|
1061
|
-
return;
|
|
865
|
+
return true;
|
|
1062
866
|
}
|
|
1063
867
|
var insertIndex = binarySearch(array, insert, identity, compare);
|
|
1064
868
|
if (insertIndex < 0) {
|
|
1065
869
|
array.splice(~insertIndex, 0, insert);
|
|
870
|
+
return true;
|
|
1066
871
|
}
|
|
1067
|
-
|
|
872
|
+
if (allowDuplicates) {
|
|
1068
873
|
array.splice(insertIndex, 0, insert);
|
|
874
|
+
return true;
|
|
1069
875
|
}
|
|
876
|
+
return false;
|
|
1070
877
|
}
|
|
1071
878
|
ts.insertSorted = insertSorted;
|
|
1072
879
|
function sortAndDeduplicate(array, comparer, equalityComparer) {
|
|
@@ -8027,12 +7834,9 @@ var ts;
|
|
|
8027
7834
|
* Normalize path separators, converting `\` into `/`.
|
|
8028
7835
|
*/
|
|
8029
7836
|
function normalizeSlashes(path) {
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
}
|
|
8034
|
-
backslashRegExp.lastIndex = index; // prime regex with known position
|
|
8035
|
-
return path.replace(backslashRegExp, ts.directorySeparator);
|
|
7837
|
+
return path.indexOf("\\") !== -1
|
|
7838
|
+
? path.replace(backslashRegExp, ts.directorySeparator)
|
|
7839
|
+
: path;
|
|
8036
7840
|
}
|
|
8037
7841
|
ts.normalizeSlashes = normalizeSlashes;
|
|
8038
7842
|
/**
|
|
@@ -9733,6 +9537,7 @@ var ts;
|
|
|
9733
9537
|
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."),
|
|
9734
9538
|
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"),
|
|
9735
9539
|
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"),
|
|
9540
|
+
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}'"),
|
|
9736
9541
|
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}'"),
|
|
9737
9542
|
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."),
|
|
9738
9543
|
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."),
|
|
@@ -19576,21 +19381,17 @@ var ts;
|
|
|
19576
19381
|
return getStringFromExpandedCharCodes(expandedCharCodes);
|
|
19577
19382
|
}
|
|
19578
19383
|
ts.base64decode = base64decode;
|
|
19384
|
+
function readJsonOrUndefined(path, hostOrText) {
|
|
19385
|
+
var jsonText = ts.isString(hostOrText) ? hostOrText : hostOrText.readFile(path);
|
|
19386
|
+
if (!jsonText)
|
|
19387
|
+
return undefined;
|
|
19388
|
+
// gracefully handle if readFile fails or returns not JSON
|
|
19389
|
+
var result = ts.parseConfigFileTextToJson(path, jsonText);
|
|
19390
|
+
return !result.error ? result.config : undefined;
|
|
19391
|
+
}
|
|
19392
|
+
ts.readJsonOrUndefined = readJsonOrUndefined;
|
|
19579
19393
|
function readJson(path, host) {
|
|
19580
|
-
|
|
19581
|
-
var jsonText = host.readFile(path);
|
|
19582
|
-
if (!jsonText)
|
|
19583
|
-
return {};
|
|
19584
|
-
var result = ts.parseConfigFileTextToJson(path, jsonText);
|
|
19585
|
-
if (result.error) {
|
|
19586
|
-
return {};
|
|
19587
|
-
}
|
|
19588
|
-
return result.config;
|
|
19589
|
-
}
|
|
19590
|
-
catch (e) {
|
|
19591
|
-
// gracefully handle if readFile fails or returns not JSON
|
|
19592
|
-
return {};
|
|
19593
|
-
}
|
|
19394
|
+
return readJsonOrUndefined(path, host) || {};
|
|
19594
19395
|
}
|
|
19595
19396
|
ts.readJson = readJson;
|
|
19596
19397
|
function directoryProbablyExists(directoryName, host) {
|
|
@@ -27941,9 +27742,10 @@ var ts;
|
|
|
27941
27742
|
};
|
|
27942
27743
|
var buildInfo_1;
|
|
27943
27744
|
var getAndCacheBuildInfo_1 = function (getText) {
|
|
27745
|
+
var _a;
|
|
27944
27746
|
if (buildInfo_1 === undefined) {
|
|
27945
27747
|
var result = getText();
|
|
27946
|
-
buildInfo_1 = result !== undefined ? ts.getBuildInfo(result) : false;
|
|
27748
|
+
buildInfo_1 = result !== undefined ? (_a = ts.getBuildInfo(node.buildInfoPath, result)) !== null && _a !== void 0 ? _a : false : false;
|
|
27947
27749
|
}
|
|
27948
27750
|
return buildInfo_1 || undefined;
|
|
27949
27751
|
};
|
|
@@ -46003,6 +45805,9 @@ var ts;
|
|
|
46003
45805
|
case 203 /* BindingElement */:
|
|
46004
45806
|
bindBindingElementFlow(node);
|
|
46005
45807
|
break;
|
|
45808
|
+
case 164 /* Parameter */:
|
|
45809
|
+
bindParameterFlow(node);
|
|
45810
|
+
break;
|
|
46006
45811
|
case 205 /* ObjectLiteralExpression */:
|
|
46007
45812
|
case 204 /* ArrayLiteralExpression */:
|
|
46008
45813
|
case 296 /* PropertyAssignment */:
|
|
@@ -46743,20 +46548,38 @@ var ts;
|
|
|
46743
46548
|
}
|
|
46744
46549
|
}
|
|
46745
46550
|
function bindBindingElementFlow(node) {
|
|
46746
|
-
|
|
46747
|
-
|
|
46748
|
-
|
|
46749
|
-
|
|
46750
|
-
|
|
46751
|
-
|
|
46752
|
-
|
|
46753
|
-
|
|
46754
|
-
|
|
46755
|
-
|
|
46551
|
+
// When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per:
|
|
46552
|
+
// - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization
|
|
46553
|
+
// - `BindingElement: BindingPattern Initializer?`
|
|
46554
|
+
// - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization
|
|
46555
|
+
// - `BindingElement: BindingPattern Initializer?`
|
|
46556
|
+
bind(node.dotDotDotToken);
|
|
46557
|
+
bind(node.propertyName);
|
|
46558
|
+
bindInitializer(node.initializer);
|
|
46559
|
+
bind(node.name);
|
|
46560
|
+
}
|
|
46561
|
+
function bindParameterFlow(node) {
|
|
46562
|
+
bindEach(node.modifiers);
|
|
46563
|
+
bind(node.dotDotDotToken);
|
|
46564
|
+
bind(node.questionToken);
|
|
46565
|
+
bind(node.type);
|
|
46566
|
+
bindInitializer(node.initializer);
|
|
46567
|
+
bind(node.name);
|
|
46568
|
+
}
|
|
46569
|
+
// a BindingElement/Parameter does not have side effects if initializers are not evaluated and used. (see GH#49759)
|
|
46570
|
+
function bindInitializer(node) {
|
|
46571
|
+
if (!node) {
|
|
46572
|
+
return;
|
|
46756
46573
|
}
|
|
46757
|
-
|
|
46758
|
-
|
|
46574
|
+
var entryFlow = currentFlow;
|
|
46575
|
+
bind(node);
|
|
46576
|
+
if (entryFlow === unreachableFlow || entryFlow === currentFlow) {
|
|
46577
|
+
return;
|
|
46759
46578
|
}
|
|
46579
|
+
var exitFlow = createBranchLabel();
|
|
46580
|
+
addAntecedent(exitFlow, entryFlow);
|
|
46581
|
+
addAntecedent(exitFlow, currentFlow);
|
|
46582
|
+
currentFlow = finishFlowLabel(exitFlow);
|
|
46760
46583
|
}
|
|
46761
46584
|
function bindJSDocTypeAlias(node) {
|
|
46762
46585
|
bind(node.tagName);
|
|
@@ -49927,7 +49750,7 @@ var ts;
|
|
|
49927
49750
|
if (unidirectional === void 0) { unidirectional = false; }
|
|
49928
49751
|
source.forEach(function (sourceSymbol, id) {
|
|
49929
49752
|
var targetSymbol = target.get(id);
|
|
49930
|
-
target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol);
|
|
49753
|
+
target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol));
|
|
49931
49754
|
});
|
|
49932
49755
|
}
|
|
49933
49756
|
function mergeModuleAugmentation(moduleName) {
|
|
@@ -56718,11 +56541,9 @@ var ts;
|
|
|
56718
56541
|
return getReturnTypeOfSignature(getterSignature);
|
|
56719
56542
|
}
|
|
56720
56543
|
}
|
|
56721
|
-
|
|
56722
|
-
|
|
56723
|
-
|
|
56724
|
-
return type_1;
|
|
56725
|
-
}
|
|
56544
|
+
var parameterTypeOfTypeTag = getParameterTypeOfTypeTag(func, declaration);
|
|
56545
|
+
if (parameterTypeOfTypeTag)
|
|
56546
|
+
return parameterTypeOfTypeTag;
|
|
56726
56547
|
// Use contextual parameter type if one is available
|
|
56727
56548
|
var type = declaration.symbol.escapedName === "this" /* This */ ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration);
|
|
56728
56549
|
if (type) {
|
|
@@ -57298,9 +57119,9 @@ var ts;
|
|
|
57298
57119
|
if (typeNode === undefined) {
|
|
57299
57120
|
return useUnknownInCatchVariables ? unknownType : anyType;
|
|
57300
57121
|
}
|
|
57301
|
-
var
|
|
57122
|
+
var type_1 = getTypeOfNode(typeNode);
|
|
57302
57123
|
// an errorType will make `checkTryStatement` issue an error
|
|
57303
|
-
return isTypeAny(
|
|
57124
|
+
return isTypeAny(type_1) || type_1 === unknownType ? type_1 : errorType;
|
|
57304
57125
|
}
|
|
57305
57126
|
// Handle export default expressions
|
|
57306
57127
|
if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) {
|
|
@@ -57510,11 +57331,11 @@ var ts;
|
|
|
57510
57331
|
return errorType;
|
|
57511
57332
|
}
|
|
57512
57333
|
var exportEquals = getMergedSymbol(symbol.exports.get("export=" /* ExportEquals */));
|
|
57513
|
-
var
|
|
57334
|
+
var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
|
|
57514
57335
|
if (!popTypeResolution()) {
|
|
57515
57336
|
return reportCircularityError(symbol);
|
|
57516
57337
|
}
|
|
57517
|
-
return
|
|
57338
|
+
return type_2;
|
|
57518
57339
|
}
|
|
57519
57340
|
}
|
|
57520
57341
|
var type = createObjectType(16 /* Anonymous */, symbol);
|
|
@@ -59737,10 +59558,10 @@ var ts;
|
|
|
59737
59558
|
var baseTypes = [];
|
|
59738
59559
|
var different = false;
|
|
59739
59560
|
for (var _i = 0, types_7 = types; _i < types_7.length; _i++) {
|
|
59740
|
-
var
|
|
59741
|
-
var baseType = getBaseConstraint(
|
|
59561
|
+
var type_3 = types_7[_i];
|
|
59562
|
+
var baseType = getBaseConstraint(type_3);
|
|
59742
59563
|
if (baseType) {
|
|
59743
|
-
if (baseType !==
|
|
59564
|
+
if (baseType !== type_3) {
|
|
59744
59565
|
different = true;
|
|
59745
59566
|
}
|
|
59746
59567
|
baseTypes.push(baseType);
|
|
@@ -60531,7 +60352,12 @@ var ts;
|
|
|
60531
60352
|
continue;
|
|
60532
60353
|
}
|
|
60533
60354
|
}
|
|
60534
|
-
|
|
60355
|
+
// If this is a function or method declaration, get the signature from the @type tag for the sake of optional parameters.
|
|
60356
|
+
// 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.
|
|
60357
|
+
result.push((!ts.isFunctionExpressionOrArrowFunction(decl) &&
|
|
60358
|
+
!ts.isObjectLiteralMethod(decl) &&
|
|
60359
|
+
getSignatureOfTypeTag(decl)) ||
|
|
60360
|
+
getSignatureFromDeclaration(decl));
|
|
60535
60361
|
}
|
|
60536
60362
|
return result;
|
|
60537
60363
|
}
|
|
@@ -60562,7 +60388,7 @@ var ts;
|
|
|
60562
60388
|
else {
|
|
60563
60389
|
var type = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration);
|
|
60564
60390
|
var jsdocPredicate = void 0;
|
|
60565
|
-
if (!type
|
|
60391
|
+
if (!type) {
|
|
60566
60392
|
var jsdocSignature = getSignatureOfTypeTag(signature.declaration);
|
|
60567
60393
|
if (jsdocSignature && signature !== jsdocSignature) {
|
|
60568
60394
|
jsdocPredicate = getTypePredicateOfSignature(jsdocSignature);
|
|
@@ -64588,15 +64414,14 @@ var ts;
|
|
|
64588
64414
|
return false;
|
|
64589
64415
|
}
|
|
64590
64416
|
function isContextSensitiveFunctionLikeDeclaration(node) {
|
|
64591
|
-
return
|
|
64592
|
-
(ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node));
|
|
64417
|
+
return ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node);
|
|
64593
64418
|
}
|
|
64594
64419
|
function hasContextSensitiveReturnExpression(node) {
|
|
64595
64420
|
// TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value.
|
|
64596
64421
|
return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 235 /* Block */ && isContextSensitive(node.body);
|
|
64597
64422
|
}
|
|
64598
64423
|
function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
|
|
64599
|
-
return (ts.
|
|
64424
|
+
return (ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) &&
|
|
64600
64425
|
isContextSensitiveFunctionLikeDeclaration(func);
|
|
64601
64426
|
}
|
|
64602
64427
|
function getTypeWithoutSignatures(type) {
|
|
@@ -73654,9 +73479,11 @@ var ts;
|
|
|
73654
73479
|
case 1 /* ExportsProperty */:
|
|
73655
73480
|
case 6 /* Prototype */:
|
|
73656
73481
|
case 3 /* PrototypeProperty */:
|
|
73657
|
-
var valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration;
|
|
73658
|
-
// falls through
|
|
73659
73482
|
case 2 /* ModuleExports */:
|
|
73483
|
+
var valueDeclaration = void 0;
|
|
73484
|
+
if (kind !== 2 /* ModuleExports */) {
|
|
73485
|
+
valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration;
|
|
73486
|
+
}
|
|
73660
73487
|
valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration);
|
|
73661
73488
|
var annotated = valueDeclaration && ts.getEffectiveTypeAnnotationNode(valueDeclaration);
|
|
73662
73489
|
return annotated ? getTypeFromTypeNode(annotated) : undefined;
|
|
@@ -74134,9 +73961,18 @@ var ts;
|
|
|
74134
73961
|
if (!isErrorType(intrinsicClassAttribs)) {
|
|
74135
73962
|
var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol);
|
|
74136
73963
|
var hostClassType = getReturnTypeOfSignature(sig);
|
|
74137
|
-
|
|
74138
|
-
|
|
74139
|
-
|
|
73964
|
+
var libraryManagedAttributeType = void 0;
|
|
73965
|
+
if (typeParams && typeParams.length === 1) {
|
|
73966
|
+
var inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context));
|
|
73967
|
+
libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs));
|
|
73968
|
+
}
|
|
73969
|
+
else if (typeParams)
|
|
73970
|
+
libraryManagedAttributeType = undefined;
|
|
73971
|
+
else
|
|
73972
|
+
libraryManagedAttributeType = intrinsicClassAttribs;
|
|
73973
|
+
if (libraryManagedAttributeType) {
|
|
73974
|
+
apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType);
|
|
73975
|
+
}
|
|
74140
73976
|
}
|
|
74141
73977
|
var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context);
|
|
74142
73978
|
if (!isErrorType(intrinsicAttribs)) {
|
|
@@ -77963,12 +77799,15 @@ var ts;
|
|
|
77963
77799
|
return false;
|
|
77964
77800
|
}
|
|
77965
77801
|
var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node :
|
|
77966
|
-
ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
|
|
77802
|
+
(ts.isVariableDeclaration(node) || ts.isPropertyAssignment(node)) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
|
|
77967
77803
|
undefined;
|
|
77968
77804
|
if (func) {
|
|
77969
|
-
// If the node has a @class tag, treat it like a constructor.
|
|
77805
|
+
// If the node has a @class or @constructor tag, treat it like a constructor.
|
|
77970
77806
|
if (ts.getJSDocClassTag(node))
|
|
77971
77807
|
return true;
|
|
77808
|
+
// If the node is a property of an object literal.
|
|
77809
|
+
if (ts.isPropertyAssignment(ts.walkUpParenthesizedExpressions(func.parent)))
|
|
77810
|
+
return false;
|
|
77972
77811
|
// If the symbol of the node has members, treat it like a constructor.
|
|
77973
77812
|
var symbol = getSymbolOfNode(func);
|
|
77974
77813
|
return !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.members) === null || _a === void 0 ? void 0 : _a.size);
|
|
@@ -78216,8 +78055,8 @@ var ts;
|
|
|
78216
78055
|
if (hasDefaultOnly && type && !isErrorType(type)) {
|
|
78217
78056
|
var synthType = type;
|
|
78218
78057
|
if (!synthType.defaultOnlyType) {
|
|
78219
|
-
var
|
|
78220
|
-
synthType.defaultOnlyType =
|
|
78058
|
+
var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol);
|
|
78059
|
+
synthType.defaultOnlyType = type_4;
|
|
78221
78060
|
}
|
|
78222
78061
|
return synthType.defaultOnlyType;
|
|
78223
78062
|
}
|
|
@@ -87554,6 +87393,12 @@ var ts;
|
|
|
87554
87393
|
return resolveJSDocMemberName(name, /*ignoreErrors*/ false, getSymbolOfNode(container));
|
|
87555
87394
|
}
|
|
87556
87395
|
}
|
|
87396
|
+
if (result && isJSDoc_1) {
|
|
87397
|
+
var container = ts.getJSDocHost(name);
|
|
87398
|
+
if (container && ts.isEnumMember(container) && container === result.valueDeclaration) {
|
|
87399
|
+
return resolveEntityName(name, meaning, /*ignoreErrors*/ true, /* dontResolveAlias */ true, ts.getSourceFileOfNode(container)) || result;
|
|
87400
|
+
}
|
|
87401
|
+
}
|
|
87557
87402
|
return result;
|
|
87558
87403
|
}
|
|
87559
87404
|
else if (ts.isPrivateIdentifier(name)) {
|
|
@@ -107715,6 +107560,13 @@ var ts;
|
|
|
107715
107560
|
ts.Debug.assert(importVariableName !== undefined);
|
|
107716
107561
|
// save import into the local
|
|
107717
107562
|
statements.push(factory.createExpressionStatement(factory.createAssignment(importVariableName, parameterName)));
|
|
107563
|
+
if (ts.hasSyntacticModifier(entry, 1 /* Export */)) {
|
|
107564
|
+
statements.push(factory.createExpressionStatement(factory.createCallExpression(exportFunction,
|
|
107565
|
+
/*typeArguments*/ undefined, [
|
|
107566
|
+
factory.createStringLiteral(ts.idText(importVariableName)),
|
|
107567
|
+
parameterName,
|
|
107568
|
+
])));
|
|
107569
|
+
}
|
|
107718
107570
|
break;
|
|
107719
107571
|
case 272 /* ExportDeclaration */:
|
|
107720
107572
|
ts.Debug.assert(importVariableName !== undefined);
|
|
@@ -110557,8 +110409,12 @@ var ts;
|
|
|
110557
110409
|
}
|
|
110558
110410
|
var previousNeedsDeclare = needsDeclare;
|
|
110559
110411
|
switch (input.kind) {
|
|
110560
|
-
case 259 /* TypeAliasDeclaration */:
|
|
110561
|
-
|
|
110412
|
+
case 259 /* TypeAliasDeclaration */: {
|
|
110413
|
+
needsDeclare = false;
|
|
110414
|
+
var clean = cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode)));
|
|
110415
|
+
needsDeclare = previousNeedsDeclare;
|
|
110416
|
+
return clean;
|
|
110417
|
+
}
|
|
110562
110418
|
case 258 /* InterfaceDeclaration */: {
|
|
110563
110419
|
return cleanup(factory.updateInterfaceDeclaration(input, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree)));
|
|
110564
110420
|
}
|
|
@@ -112062,8 +111918,8 @@ var ts;
|
|
|
112062
111918
|
}
|
|
112063
111919
|
ts.getBuildInfoText = getBuildInfoText;
|
|
112064
111920
|
/*@internal*/
|
|
112065
|
-
function getBuildInfo(buildInfoText) {
|
|
112066
|
-
return
|
|
111921
|
+
function getBuildInfo(buildInfoFile, buildInfoText) {
|
|
111922
|
+
return ts.readJsonOrUndefined(buildInfoFile, buildInfoText);
|
|
112067
111923
|
}
|
|
112068
111924
|
ts.getBuildInfo = getBuildInfo;
|
|
112069
111925
|
/*@internal*/
|
|
@@ -112141,17 +111997,16 @@ var ts;
|
|
|
112141
111997
|
var buildInfo;
|
|
112142
111998
|
if (host.getBuildInfo) {
|
|
112143
111999
|
// If host directly provides buildinfo we can get it directly. This allows host to cache the buildinfo
|
|
112144
|
-
|
|
112145
|
-
if (!hostBuildInfo)
|
|
112146
|
-
return buildInfoPath;
|
|
112147
|
-
buildInfo = hostBuildInfo;
|
|
112000
|
+
buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
|
|
112148
112001
|
}
|
|
112149
112002
|
else {
|
|
112150
112003
|
var buildInfoText = host.readFile(buildInfoPath);
|
|
112151
112004
|
if (!buildInfoText)
|
|
112152
112005
|
return buildInfoPath;
|
|
112153
|
-
buildInfo = getBuildInfo(buildInfoText);
|
|
112006
|
+
buildInfo = getBuildInfo(buildInfoPath, buildInfoText);
|
|
112154
112007
|
}
|
|
112008
|
+
if (!buildInfo)
|
|
112009
|
+
return buildInfoPath;
|
|
112155
112010
|
if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
|
|
112156
112011
|
return buildInfoPath;
|
|
112157
112012
|
var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
|
|
@@ -116809,7 +116664,16 @@ var ts;
|
|
|
116809
116664
|
return cachedReadDirectoryResult.get(ts.ensureTrailingDirectorySeparator(rootDirPath));
|
|
116810
116665
|
}
|
|
116811
116666
|
function getCachedFileSystemEntriesForBaseDir(path) {
|
|
116812
|
-
|
|
116667
|
+
var entries = getCachedFileSystemEntries(ts.getDirectoryPath(path));
|
|
116668
|
+
if (!entries) {
|
|
116669
|
+
return entries;
|
|
116670
|
+
}
|
|
116671
|
+
// If we're looking for the base directory, we're definitely going to search the entries
|
|
116672
|
+
if (!entries.sortedAndCanonicalizedFiles) {
|
|
116673
|
+
entries.sortedAndCanonicalizedFiles = entries.files.map(getCanonicalFileName).sort();
|
|
116674
|
+
entries.sortedAndCanonicalizedDirectories = entries.directories.map(getCanonicalFileName).sort();
|
|
116675
|
+
}
|
|
116676
|
+
return entries;
|
|
116813
116677
|
}
|
|
116814
116678
|
function getBaseNameOfFileName(fileName) {
|
|
116815
116679
|
return ts.getBaseFileName(ts.normalizePath(fileName));
|
|
@@ -116852,21 +116716,10 @@ var ts;
|
|
|
116852
116716
|
return undefined;
|
|
116853
116717
|
}
|
|
116854
116718
|
}
|
|
116855
|
-
function fileNameEqual(name1, name2) {
|
|
116856
|
-
return getCanonicalFileName(name1) === getCanonicalFileName(name2);
|
|
116857
|
-
}
|
|
116858
116719
|
function hasEntry(entries, name) {
|
|
116859
|
-
|
|
116860
|
-
|
|
116861
|
-
|
|
116862
|
-
if (hasEntry(entries, baseName)) {
|
|
116863
|
-
if (!isValid) {
|
|
116864
|
-
return ts.filterMutate(entries, function (entry) { return !fileNameEqual(entry, baseName); });
|
|
116865
|
-
}
|
|
116866
|
-
}
|
|
116867
|
-
else if (isValid) {
|
|
116868
|
-
return entries.push(baseName);
|
|
116869
|
-
}
|
|
116720
|
+
// Case-sensitive comparison since already canonicalized
|
|
116721
|
+
var index = ts.binarySearch(entries, name, ts.identity, ts.compareStringsCaseSensitive);
|
|
116722
|
+
return index >= 0;
|
|
116870
116723
|
}
|
|
116871
116724
|
function writeFile(fileName, data, writeByteOrderMark) {
|
|
116872
116725
|
var path = toPath(fileName);
|
|
@@ -116879,7 +116732,7 @@ var ts;
|
|
|
116879
116732
|
function fileExists(fileName) {
|
|
116880
116733
|
var path = toPath(fileName);
|
|
116881
116734
|
var result = getCachedFileSystemEntriesForBaseDir(path);
|
|
116882
|
-
return result && hasEntry(result.
|
|
116735
|
+
return result && hasEntry(result.sortedAndCanonicalizedFiles, getCanonicalFileName(getBaseNameOfFileName(fileName))) ||
|
|
116883
116736
|
host.fileExists(fileName);
|
|
116884
116737
|
}
|
|
116885
116738
|
function directoryExists(dirPath) {
|
|
@@ -116889,9 +116742,14 @@ var ts;
|
|
|
116889
116742
|
function createDirectory(dirPath) {
|
|
116890
116743
|
var path = toPath(dirPath);
|
|
116891
116744
|
var result = getCachedFileSystemEntriesForBaseDir(path);
|
|
116892
|
-
var baseFileName = getBaseNameOfFileName(dirPath);
|
|
116893
116745
|
if (result) {
|
|
116894
|
-
|
|
116746
|
+
var baseName = getBaseNameOfFileName(dirPath);
|
|
116747
|
+
var canonicalizedBaseName = getCanonicalFileName(baseName);
|
|
116748
|
+
var canonicalizedDirectories = result.sortedAndCanonicalizedDirectories;
|
|
116749
|
+
// Case-sensitive comparison since already canonicalized
|
|
116750
|
+
if (ts.insertSorted(canonicalizedDirectories, canonicalizedBaseName, ts.compareStringsCaseSensitive)) {
|
|
116751
|
+
result.directories.push(baseName);
|
|
116752
|
+
}
|
|
116895
116753
|
}
|
|
116896
116754
|
host.createDirectory(dirPath);
|
|
116897
116755
|
}
|
|
@@ -116960,7 +116818,7 @@ var ts;
|
|
|
116960
116818
|
fileExists: host.fileExists(fileOrDirectoryPath),
|
|
116961
116819
|
directoryExists: host.directoryExists(fileOrDirectoryPath)
|
|
116962
116820
|
};
|
|
116963
|
-
if (fsQueryResult.directoryExists || hasEntry(parentResult.
|
|
116821
|
+
if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) {
|
|
116964
116822
|
// Folder added or removed, clear the cache instead of updating the folder and its structure
|
|
116965
116823
|
clearCache();
|
|
116966
116824
|
}
|
|
@@ -116980,7 +116838,23 @@ var ts;
|
|
|
116980
116838
|
}
|
|
116981
116839
|
}
|
|
116982
116840
|
function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists) {
|
|
116983
|
-
|
|
116841
|
+
var canonicalizedFiles = parentResult.sortedAndCanonicalizedFiles;
|
|
116842
|
+
var canonicalizedBaseName = getCanonicalFileName(baseName);
|
|
116843
|
+
if (fileExists) {
|
|
116844
|
+
// Case-sensitive comparison since already canonicalized
|
|
116845
|
+
if (ts.insertSorted(canonicalizedFiles, canonicalizedBaseName, ts.compareStringsCaseSensitive)) {
|
|
116846
|
+
parentResult.files.push(baseName);
|
|
116847
|
+
}
|
|
116848
|
+
}
|
|
116849
|
+
else {
|
|
116850
|
+
// Case-sensitive comparison since already canonicalized
|
|
116851
|
+
var sortedIndex = ts.binarySearch(canonicalizedFiles, canonicalizedBaseName, ts.identity, ts.compareStringsCaseSensitive);
|
|
116852
|
+
if (sortedIndex >= 0) {
|
|
116853
|
+
canonicalizedFiles.splice(sortedIndex, 1);
|
|
116854
|
+
var unsortedIndex = parentResult.files.findIndex(function (entry) { return getCanonicalFileName(entry) === canonicalizedBaseName; });
|
|
116855
|
+
parentResult.files.splice(unsortedIndex, 1);
|
|
116856
|
+
}
|
|
116857
|
+
}
|
|
116984
116858
|
}
|
|
116985
116859
|
function clearCache() {
|
|
116986
116860
|
cachedReadDirectoryResult.clear();
|
|
@@ -125218,18 +125092,14 @@ var ts;
|
|
|
125218
125092
|
if (host.getBuildInfo) {
|
|
125219
125093
|
// host provides buildinfo, get it from there. This allows host to cache it
|
|
125220
125094
|
buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
|
|
125221
|
-
if (!buildInfo)
|
|
125222
|
-
return undefined;
|
|
125223
125095
|
}
|
|
125224
125096
|
else {
|
|
125225
125097
|
var content = host.readFile(buildInfoPath);
|
|
125226
125098
|
if (!content)
|
|
125227
125099
|
return undefined;
|
|
125228
|
-
buildInfo = ts.getBuildInfo(content);
|
|
125100
|
+
buildInfo = ts.getBuildInfo(buildInfoPath, content);
|
|
125229
125101
|
}
|
|
125230
|
-
if (buildInfo.version !== ts.version)
|
|
125231
|
-
return undefined;
|
|
125232
|
-
if (!buildInfo.program)
|
|
125102
|
+
if (!buildInfo || buildInfo.version !== ts.version || !buildInfo.program)
|
|
125233
125103
|
return undefined;
|
|
125234
125104
|
return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
|
|
125235
125105
|
}
|
|
@@ -125451,7 +125321,8 @@ var ts;
|
|
|
125451
125321
|
}
|
|
125452
125322
|
// All resolutions are invalid if user provided resolutions
|
|
125453
125323
|
var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution);
|
|
125454
|
-
|
|
125324
|
+
var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile;
|
|
125325
|
+
if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
125455
125326
|
if (hasChangedConfigFileParsingErrors) {
|
|
125456
125327
|
if (reportFileChangeDetectedOnCreateProgram) {
|
|
125457
125328
|
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
@@ -125470,6 +125341,11 @@ var ts;
|
|
|
125470
125341
|
if (host.afterProgramCreate && program !== builderProgram) {
|
|
125471
125342
|
host.afterProgramCreate(builderProgram);
|
|
125472
125343
|
}
|
|
125344
|
+
compilerHost.readFile = originalReadFile;
|
|
125345
|
+
compilerHost.fileExists = originalFileExists;
|
|
125346
|
+
compilerHost.directoryExists = originalDirectoryExists;
|
|
125347
|
+
compilerHost.createDirectory = originalCreateDirectory;
|
|
125348
|
+
compilerHost.writeFile = originalWriteFile;
|
|
125473
125349
|
return builderProgram;
|
|
125474
125350
|
}
|
|
125475
125351
|
function createNewProgram(hasInvalidatedResolution) {
|
|
@@ -125947,19 +125823,20 @@ var ts;
|
|
|
125947
125823
|
*/
|
|
125948
125824
|
UpToDateStatusType[UpToDateStatusType["OutOfDateWithPrepend"] = 3] = "OutOfDateWithPrepend";
|
|
125949
125825
|
UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
|
|
125950
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125951
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125952
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125953
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125954
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125955
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125956
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125957
|
-
UpToDateStatusType[UpToDateStatusType["
|
|
125826
|
+
UpToDateStatusType[UpToDateStatusType["ErrorReadingFile"] = 5] = "ErrorReadingFile";
|
|
125827
|
+
UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 6] = "OutOfDateWithSelf";
|
|
125828
|
+
UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 7] = "OutOfDateWithUpstream";
|
|
125829
|
+
UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 8] = "OutOfDateBuildInfo";
|
|
125830
|
+
UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 9] = "UpstreamOutOfDate";
|
|
125831
|
+
UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 10] = "UpstreamBlocked";
|
|
125832
|
+
UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 11] = "ComputingUpstream";
|
|
125833
|
+
UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 12] = "TsVersionOutputOfDate";
|
|
125834
|
+
UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 13] = "UpToDateWithInputFileText";
|
|
125958
125835
|
/**
|
|
125959
125836
|
* Projects with no outputs (i.e. "solution" files)
|
|
125960
125837
|
*/
|
|
125961
|
-
UpToDateStatusType[UpToDateStatusType["ContainerOnly"] =
|
|
125962
|
-
UpToDateStatusType[UpToDateStatusType["ForceBuild"] =
|
|
125838
|
+
UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 14] = "ContainerOnly";
|
|
125839
|
+
UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 15] = "ForceBuild";
|
|
125963
125840
|
})(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
|
|
125964
125841
|
function resolveConfigFileProjectName(project) {
|
|
125965
125842
|
if (ts.fileExtensionIs(project, ".json" /* Json */)) {
|
|
@@ -126661,13 +126538,13 @@ var ts;
|
|
|
126661
126538
|
var emitterDiagnostics = ts.createDiagnosticCollection();
|
|
126662
126539
|
var emittedOutputs = new ts.Map();
|
|
126663
126540
|
var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
|
|
126664
|
-
var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
|
|
126541
|
+
var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo || undefined;
|
|
126665
126542
|
outputFiles.forEach(function (_a) {
|
|
126666
126543
|
var _b, _c;
|
|
126667
126544
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
|
|
126668
126545
|
emittedOutputs.set(toPath(state, name), name);
|
|
126669
126546
|
if (buildInfo) {
|
|
126670
|
-
if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) {
|
|
126547
|
+
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)) {
|
|
126671
126548
|
resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
|
|
126672
126549
|
}
|
|
126673
126550
|
setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags);
|
|
@@ -126960,8 +126837,7 @@ var ts;
|
|
|
126960
126837
|
return existing.buildInfo || undefined;
|
|
126961
126838
|
}
|
|
126962
126839
|
var value = state.readFileWithCache(buildInfoPath);
|
|
126963
|
-
var buildInfo = value ? ts.getBuildInfo(value) : undefined;
|
|
126964
|
-
ts.Debug.assert(modifiedTime || !buildInfo);
|
|
126840
|
+
var buildInfo = value ? ts.getBuildInfo(buildInfoPath, value) : undefined;
|
|
126965
126841
|
state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
|
|
126966
126842
|
return buildInfo;
|
|
126967
126843
|
}
|
|
@@ -127046,7 +126922,14 @@ var ts;
|
|
|
127046
126922
|
missingOutputFileName: buildInfoPath
|
|
127047
126923
|
};
|
|
127048
126924
|
}
|
|
127049
|
-
var buildInfo =
|
|
126925
|
+
var buildInfo = getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime);
|
|
126926
|
+
if (!buildInfo) {
|
|
126927
|
+
// Error reading buildInfo
|
|
126928
|
+
return {
|
|
126929
|
+
type: ts.UpToDateStatusType.ErrorReadingFile,
|
|
126930
|
+
fileName: buildInfoPath
|
|
126931
|
+
};
|
|
126932
|
+
}
|
|
127050
126933
|
if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
|
|
127051
126934
|
return {
|
|
127052
126935
|
type: ts.UpToDateStatusType.TsVersionOutputOfDate,
|
|
@@ -127704,6 +127587,8 @@ var ts;
|
|
|
127704
127587
|
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));
|
|
127705
127588
|
case ts.UpToDateStatusType.OutputMissing:
|
|
127706
127589
|
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));
|
|
127590
|
+
case ts.UpToDateStatusType.ErrorReadingFile:
|
|
127591
|
+
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));
|
|
127707
127592
|
case ts.UpToDateStatusType.OutOfDateBuildInfo:
|
|
127708
127593
|
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));
|
|
127709
127594
|
case ts.UpToDateStatusType.UpToDate:
|
|
@@ -157157,6 +157042,15 @@ var ts;
|
|
|
157157
157042
|
ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code,
|
|
157158
157043
|
ts.Diagnostics.Cannot_find_name_0.code
|
|
157159
157044
|
];
|
|
157045
|
+
var InfoKind;
|
|
157046
|
+
(function (InfoKind) {
|
|
157047
|
+
InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration";
|
|
157048
|
+
InfoKind[InfoKind["Enum"] = 1] = "Enum";
|
|
157049
|
+
InfoKind[InfoKind["Function"] = 2] = "Function";
|
|
157050
|
+
InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral";
|
|
157051
|
+
InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes";
|
|
157052
|
+
InfoKind[InfoKind["Signature"] = 5] = "Signature";
|
|
157053
|
+
})(InfoKind || (InfoKind = {}));
|
|
157160
157054
|
codefix.registerCodeFix({
|
|
157161
157055
|
errorCodes: errorCodes,
|
|
157162
157056
|
getCodeActions: function (context) {
|
|
@@ -157165,19 +157059,19 @@ var ts;
|
|
|
157165
157059
|
if (!info) {
|
|
157166
157060
|
return undefined;
|
|
157167
157061
|
}
|
|
157168
|
-
if (info.kind ===
|
|
157062
|
+
if (info.kind === InfoKind.ObjectLiteral) {
|
|
157169
157063
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addObjectLiteralProperties(t, context, info); });
|
|
157170
157064
|
return [codefix.createCodeFixAction(fixMissingProperties, changes, ts.Diagnostics.Add_missing_properties, fixMissingProperties, ts.Diagnostics.Add_all_missing_properties)];
|
|
157171
157065
|
}
|
|
157172
|
-
if (info.kind ===
|
|
157066
|
+
if (info.kind === InfoKind.JsxAttributes) {
|
|
157173
157067
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addJsxAttributes(t, context, info); });
|
|
157174
157068
|
return [codefix.createCodeFixAction(fixMissingAttributes, changes, ts.Diagnostics.Add_missing_attributes, fixMissingAttributes, ts.Diagnostics.Add_all_missing_attributes)];
|
|
157175
157069
|
}
|
|
157176
|
-
if (info.kind ===
|
|
157070
|
+
if (info.kind === InfoKind.Function || info.kind === InfoKind.Signature) {
|
|
157177
157071
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addFunctionDeclaration(t, context, info); });
|
|
157178
157072
|
return [codefix.createCodeFixAction(fixMissingFunctionDeclaration, changes, [ts.Diagnostics.Add_missing_function_declaration_0, info.token.text], fixMissingFunctionDeclaration, ts.Diagnostics.Add_all_missing_function_declarations)];
|
|
157179
157073
|
}
|
|
157180
|
-
if (info.kind ===
|
|
157074
|
+
if (info.kind === InfoKind.Enum) {
|
|
157181
157075
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addEnumMemberDeclaration(t, context.program.getTypeChecker(), info); });
|
|
157182
157076
|
return [codefix.createCodeFixAction(fixMissingMember, changes, [ts.Diagnostics.Add_missing_enum_member_0, info.token.text], fixMissingMember, ts.Diagnostics.Add_all_missing_members)];
|
|
157183
157077
|
}
|
|
@@ -157195,20 +157089,20 @@ var ts;
|
|
|
157195
157089
|
if (!info || !ts.addToSeen(seen, ts.getNodeId(info.parentDeclaration) + "#" + info.token.text)) {
|
|
157196
157090
|
return;
|
|
157197
157091
|
}
|
|
157198
|
-
if (fixId === fixMissingFunctionDeclaration && info.kind ===
|
|
157092
|
+
if (fixId === fixMissingFunctionDeclaration && (info.kind === InfoKind.Function || info.kind === InfoKind.Signature)) {
|
|
157199
157093
|
addFunctionDeclaration(changes, context, info);
|
|
157200
157094
|
}
|
|
157201
|
-
else if (fixId === fixMissingProperties && info.kind ===
|
|
157095
|
+
else if (fixId === fixMissingProperties && info.kind === InfoKind.ObjectLiteral) {
|
|
157202
157096
|
addObjectLiteralProperties(changes, context, info);
|
|
157203
157097
|
}
|
|
157204
|
-
else if (fixId === fixMissingAttributes && info.kind ===
|
|
157098
|
+
else if (fixId === fixMissingAttributes && info.kind === InfoKind.JsxAttributes) {
|
|
157205
157099
|
addJsxAttributes(changes, context, info);
|
|
157206
157100
|
}
|
|
157207
157101
|
else {
|
|
157208
|
-
if (info.kind ===
|
|
157102
|
+
if (info.kind === InfoKind.Enum) {
|
|
157209
157103
|
addEnumMemberDeclaration(changes, checker, info);
|
|
157210
157104
|
}
|
|
157211
|
-
if (info.kind ===
|
|
157105
|
+
if (info.kind === InfoKind.TypeLikeDeclaration) {
|
|
157212
157106
|
var parentDeclaration = info.parentDeclaration, token_1 = info.token;
|
|
157213
157107
|
var infos = ts.getOrUpdate(typeDeclToMembers, parentDeclaration, function () { return []; });
|
|
157214
157108
|
if (!infos.some(function (i) { return i.token.text === token_1.text; })) {
|
|
@@ -157252,14 +157146,6 @@ var ts;
|
|
|
157252
157146
|
}));
|
|
157253
157147
|
},
|
|
157254
157148
|
});
|
|
157255
|
-
var InfoKind;
|
|
157256
|
-
(function (InfoKind) {
|
|
157257
|
-
InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration";
|
|
157258
|
-
InfoKind[InfoKind["Enum"] = 1] = "Enum";
|
|
157259
|
-
InfoKind[InfoKind["Function"] = 2] = "Function";
|
|
157260
|
-
InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral";
|
|
157261
|
-
InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes";
|
|
157262
|
-
})(InfoKind || (InfoKind = {}));
|
|
157263
157149
|
function getInfo(sourceFile, tokenPos, errorCode, checker, program) {
|
|
157264
157150
|
// The identifier of the missing property. eg:
|
|
157265
157151
|
// this.missing = 1;
|
|
@@ -157281,7 +157167,7 @@ var ts;
|
|
|
157281
157167
|
var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent), checker.getParameterType(signature, argIndex), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false));
|
|
157282
157168
|
if (!ts.length(properties))
|
|
157283
157169
|
return undefined;
|
|
157284
|
-
return { kind:
|
|
157170
|
+
return { kind: InfoKind.ObjectLiteral, token: param.name, properties: properties, parentDeclaration: parent };
|
|
157285
157171
|
}
|
|
157286
157172
|
if (!ts.isMemberName(token))
|
|
157287
157173
|
return undefined;
|
|
@@ -157289,17 +157175,26 @@ var ts;
|
|
|
157289
157175
|
var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent.initializer), checker.getTypeAtLocation(token), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false));
|
|
157290
157176
|
if (!ts.length(properties))
|
|
157291
157177
|
return undefined;
|
|
157292
|
-
return { kind:
|
|
157178
|
+
return { kind: InfoKind.ObjectLiteral, token: token, properties: properties, parentDeclaration: parent.initializer };
|
|
157293
157179
|
}
|
|
157294
157180
|
if (ts.isIdentifier(token) && ts.isJsxOpeningLikeElement(token.parent)) {
|
|
157295
157181
|
var target = ts.getEmitScriptTarget(program.getCompilerOptions());
|
|
157296
157182
|
var attributes = getUnmatchedAttributes(checker, target, token.parent);
|
|
157297
157183
|
if (!ts.length(attributes))
|
|
157298
157184
|
return undefined;
|
|
157299
|
-
return { kind:
|
|
157185
|
+
return { kind: InfoKind.JsxAttributes, token: token, attributes: attributes, parentDeclaration: token.parent };
|
|
157300
157186
|
}
|
|
157301
|
-
if (ts.isIdentifier(token)
|
|
157302
|
-
|
|
157187
|
+
if (ts.isIdentifier(token)) {
|
|
157188
|
+
var type = checker.getContextualType(token);
|
|
157189
|
+
if (type && ts.getObjectFlags(type) & 16 /* Anonymous */) {
|
|
157190
|
+
var signature = ts.firstOrUndefined(checker.getSignaturesOfType(type, 0 /* Call */));
|
|
157191
|
+
if (signature === undefined)
|
|
157192
|
+
return undefined;
|
|
157193
|
+
return { kind: InfoKind.Signature, token: token, signature: signature, sourceFile: sourceFile, parentDeclaration: findScope(token) };
|
|
157194
|
+
}
|
|
157195
|
+
if (ts.isCallExpression(parent) && parent.expression === token) {
|
|
157196
|
+
return { kind: InfoKind.Function, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* None */, parentDeclaration: findScope(token) };
|
|
157197
|
+
}
|
|
157303
157198
|
}
|
|
157304
157199
|
if (!ts.isPropertyAccessExpression(parent))
|
|
157305
157200
|
return undefined;
|
|
@@ -157311,13 +157206,13 @@ var ts;
|
|
|
157311
157206
|
var moduleDeclaration = ts.find(symbol.declarations, ts.isModuleDeclaration);
|
|
157312
157207
|
var moduleDeclarationSourceFile = moduleDeclaration === null || moduleDeclaration === void 0 ? void 0 : moduleDeclaration.getSourceFile();
|
|
157313
157208
|
if (moduleDeclaration && moduleDeclarationSourceFile && !isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) {
|
|
157314
|
-
return { kind:
|
|
157209
|
+
return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* Export */, parentDeclaration: moduleDeclaration };
|
|
157315
157210
|
}
|
|
157316
157211
|
var moduleSourceFile = ts.find(symbol.declarations, ts.isSourceFile);
|
|
157317
157212
|
if (sourceFile.commonJsModuleIndicator)
|
|
157318
157213
|
return undefined;
|
|
157319
157214
|
if (moduleSourceFile && !isSourceFileFromLibrary(program, moduleSourceFile)) {
|
|
157320
|
-
return { kind:
|
|
157215
|
+
return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* Export */, parentDeclaration: moduleSourceFile };
|
|
157321
157216
|
}
|
|
157322
157217
|
}
|
|
157323
157218
|
var classDeclaration = ts.find(symbol.declarations, ts.isClassLike);
|
|
@@ -157335,11 +157230,11 @@ var ts;
|
|
|
157335
157230
|
(makeStatic ? 32 /* Static */ : 0 /* None */) | (ts.startsWithUnderscore(token.text) ? 8 /* Private */ : 0 /* None */);
|
|
157336
157231
|
var isJSFile = ts.isSourceFileJS(declSourceFile);
|
|
157337
157232
|
var call = ts.tryCast(parent.parent, ts.isCallExpression);
|
|
157338
|
-
return { kind:
|
|
157233
|
+
return { kind: InfoKind.TypeLikeDeclaration, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile };
|
|
157339
157234
|
}
|
|
157340
157235
|
var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration);
|
|
157341
157236
|
if (enumDeclaration && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
|
|
157342
|
-
return { kind:
|
|
157237
|
+
return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration };
|
|
157343
157238
|
}
|
|
157344
157239
|
return undefined;
|
|
157345
157240
|
}
|
|
@@ -157515,9 +157410,17 @@ var ts;
|
|
|
157515
157410
|
});
|
|
157516
157411
|
}
|
|
157517
157412
|
function addFunctionDeclaration(changes, context, info) {
|
|
157413
|
+
var quotePreference = ts.getQuotePreference(context.sourceFile, context.preferences);
|
|
157518
157414
|
var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host);
|
|
157519
|
-
var functionDeclaration =
|
|
157520
|
-
|
|
157415
|
+
var functionDeclaration = info.kind === InfoKind.Function
|
|
157416
|
+
? codefix.createSignatureDeclarationFromCallExpression(256 /* FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration)
|
|
157417
|
+
: 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);
|
|
157418
|
+
if (functionDeclaration === undefined) {
|
|
157419
|
+
ts.Debug.fail("fixMissingFunctionDeclaration codefix got unexpected error.");
|
|
157420
|
+
}
|
|
157421
|
+
ts.isReturnStatement(info.parentDeclaration)
|
|
157422
|
+
? changes.insertNodeBefore(info.sourceFile, info.parentDeclaration, functionDeclaration, /*blankLineBetween*/ true)
|
|
157423
|
+
: changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration);
|
|
157521
157424
|
importAdder.writeFixes(changes);
|
|
157522
157425
|
}
|
|
157523
157426
|
function addJsxAttributes(changes, context, info) {
|
|
@@ -157675,6 +157578,14 @@ var ts;
|
|
|
157675
157578
|
}
|
|
157676
157579
|
return ts.createPropertyNameNodeForIdentifierOrLiteral(symbol.name, target, quotePreference === 0 /* Single */);
|
|
157677
157580
|
}
|
|
157581
|
+
function findScope(node) {
|
|
157582
|
+
if (ts.findAncestor(node, ts.isJsxExpression)) {
|
|
157583
|
+
var returnStatement = ts.findAncestor(node.parent, ts.isReturnStatement);
|
|
157584
|
+
if (returnStatement)
|
|
157585
|
+
return returnStatement;
|
|
157586
|
+
}
|
|
157587
|
+
return ts.getSourceFileOfNode(node);
|
|
157588
|
+
}
|
|
157678
157589
|
})(codefix = ts.codefix || (ts.codefix = {}));
|
|
157679
157590
|
})(ts || (ts = {}));
|
|
157680
157591
|
/* @internal */
|
|
@@ -160364,6 +160275,9 @@ var ts;
|
|
|
160364
160275
|
if (ts.isMethodDeclaration(signatureDeclaration)) {
|
|
160365
160276
|
return ts.factory.updateMethodDeclaration(signatureDeclaration, modifiers, asteriskToken, name !== null && name !== void 0 ? name : ts.factory.createIdentifier(""), questionToken, typeParameters, parameters, type, body);
|
|
160366
160277
|
}
|
|
160278
|
+
if (ts.isFunctionDeclaration(signatureDeclaration)) {
|
|
160279
|
+
return ts.factory.updateFunctionDeclaration(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, ts.tryCast(name, ts.isIdentifier), typeParameters, parameters, type, body !== null && body !== void 0 ? body : signatureDeclaration.body);
|
|
160280
|
+
}
|
|
160367
160281
|
return undefined;
|
|
160368
160282
|
}
|
|
160369
160283
|
codefix.createSignatureDeclarationFromSignature = createSignatureDeclarationFromSignature;
|
|
@@ -167666,6 +167580,10 @@ var ts;
|
|
|
167666
167580
|
getCurrentDirectory: compilerHost.getCurrentDirectory,
|
|
167667
167581
|
onUnRecoverableConfigFileDiagnostic: ts.noop,
|
|
167668
167582
|
};
|
|
167583
|
+
// The call to isProgramUptoDate below may refer back to documentRegistryBucketKey;
|
|
167584
|
+
// calculate this early so it's not undefined if downleveled to a var (or, if emitted
|
|
167585
|
+
// as a const variable without downleveling, doesn't crash).
|
|
167586
|
+
var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
|
|
167669
167587
|
// If the program is already up-to-date, we can reuse it
|
|
167670
167588
|
if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
167671
167589
|
return;
|
|
@@ -167675,7 +167593,6 @@ var ts;
|
|
|
167675
167593
|
// instance. If we cancel midway through, we may end up in an inconsistent state where
|
|
167676
167594
|
// the program points to old source files that have been invalidated because of
|
|
167677
167595
|
// incremental parsing.
|
|
167678
|
-
var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
|
|
167679
167596
|
var options = {
|
|
167680
167597
|
rootNames: rootFileNames,
|
|
167681
167598
|
options: newSettings,
|