@typescript/native-preview 7.0.0-dev.20260623.1 → 7.0.0-dev.20260626.1
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/dist/api/async/api.d.ts +99 -10
- package/dist/api/async/api.d.ts.map +1 -1
- package/dist/api/async/api.js +386 -49
- package/dist/api/async/api.js.map +1 -1
- package/dist/api/async/types.d.ts +48 -3
- package/dist/api/async/types.d.ts.map +1 -1
- package/dist/api/node/node.d.ts +8 -0
- package/dist/api/node/node.d.ts.map +1 -1
- package/dist/api/node/node.generated.d.ts +8 -0
- package/dist/api/node/node.generated.d.ts.map +1 -1
- package/dist/api/node/node.generated.js +26 -1
- package/dist/api/node/node.generated.js.map +1 -1
- package/dist/api/node/node.js +44 -6
- package/dist/api/node/node.js.map +1 -1
- package/dist/api/proto.d.ts +36 -1
- package/dist/api/proto.d.ts.map +1 -1
- package/dist/api/proto.js +15 -0
- package/dist/api/proto.js.map +1 -1
- package/dist/api/sync/api.d.ts +99 -10
- package/dist/api/sync/api.d.ts.map +1 -1
- package/dist/api/sync/api.js +386 -49
- package/dist/api/sync/api.js.map +1 -1
- package/dist/api/sync/types.d.ts +48 -3
- package/dist/api/sync/types.d.ts.map +1 -1
- package/dist/ast/ast.d.ts +8 -0
- package/dist/ast/ast.d.ts.map +1 -1
- package/dist/ast/factory.generated.d.ts +8 -0
- package/dist/ast/factory.generated.d.ts.map +1 -1
- package/dist/ast/factory.generated.js +36 -2
- package/dist/ast/factory.generated.js.map +1 -1
- package/dist/ast/is.generated.d.ts +2 -1
- package/dist/ast/is.generated.d.ts.map +1 -1
- package/dist/ast/is.generated.js +3 -0
- package/dist/ast/is.generated.js.map +1 -1
- package/dist/ast/utils.d.ts +2 -0
- package/dist/ast/utils.d.ts.map +1 -1
- package/dist/ast/utils.js +20 -0
- package/dist/ast/utils.js.map +1 -1
- package/lib/version.cjs +3 -0
- package/lib/version.d.cts +2 -0
- package/package.json +14 -12
- package/dist/api/objectRegistry.d.ts +0 -40
- package/dist/api/objectRegistry.d.ts.map +0 -1
- package/dist/api/objectRegistry.js +0 -61
- package/dist/api/objectRegistry.js.map +0 -1
package/dist/api/sync/api.js
CHANGED
|
@@ -20,9 +20,8 @@ import { TypePredicateKind } from "#enums/typePredicateKind";
|
|
|
20
20
|
import { ModifierFlags, } from "../../ast/index.js";
|
|
21
21
|
import { encodeNode, uint8ArrayToBase64, } from "../node/encoder.js";
|
|
22
22
|
import { decodeNode, getNodeId, parseNodeHandle, readParseOptionsKey, readSourceFileHash, RemoteSourceFile, } from "../node/node.js";
|
|
23
|
-
import { ObjectRegistry, } from "../objectRegistry.js";
|
|
24
23
|
import { createGetCanonicalFileName, toPath, } from "../path.js";
|
|
25
|
-
import { resolveFileName } from "../proto.js";
|
|
24
|
+
import { resolveFileName, toUpdateSnapshotRequest, } from "../proto.js";
|
|
26
25
|
import { SourceFileCache } from "../sourceFileCache.js";
|
|
27
26
|
import { Client, } from "./client.js";
|
|
28
27
|
export { CompletionItemKind, DiagnosticCategory, ElementFlags, ModifierFlags, NodeBuilderFlags, ObjectFlags, SignatureFlags, SignatureKind, SymbolFlags, TypeFlags, TypePredicateKind };
|
|
@@ -64,10 +63,7 @@ export class API {
|
|
|
64
63
|
}
|
|
65
64
|
updateSnapshot(params) {
|
|
66
65
|
this.ensureInitialized();
|
|
67
|
-
const requestParams = params
|
|
68
|
-
if (requestParams.openProject) {
|
|
69
|
-
requestParams.openProject = resolveFileName(requestParams.openProject);
|
|
70
|
-
}
|
|
66
|
+
const requestParams = toUpdateSnapshotRequest(params);
|
|
71
67
|
const data = this.client.apiRequest("updateSnapshot", requestParams);
|
|
72
68
|
// Retain cached source files from previous snapshot for unchanged files
|
|
73
69
|
if (this.latestSnapshot) {
|
|
@@ -131,23 +127,18 @@ export class Snapshot {
|
|
|
131
127
|
projectMap;
|
|
132
128
|
toPath;
|
|
133
129
|
client;
|
|
134
|
-
objectRegistry;
|
|
135
130
|
disposed = false;
|
|
136
131
|
onDispose;
|
|
132
|
+
snapshotRegistry;
|
|
137
133
|
constructor(data, client, sourceFileCache, toPath, onDispose) {
|
|
138
134
|
this.id = data.snapshot;
|
|
139
135
|
this.client = client;
|
|
140
136
|
this.toPath = toPath;
|
|
141
137
|
this.onDispose = onDispose;
|
|
142
|
-
this.
|
|
143
|
-
createSymbol: symbolData => new Symbol(symbolData, this.objectRegistry),
|
|
144
|
-
createType: typeData => new TypeObject(typeData, this.objectRegistry),
|
|
145
|
-
createSignature: sigData => new Signature(sigData, this.objectRegistry),
|
|
146
|
-
}, client, this.id);
|
|
147
|
-
// Create projects
|
|
138
|
+
this.snapshotRegistry = new SnapshotObjectRegistry(client, this.id);
|
|
148
139
|
this.projectMap = new Map();
|
|
149
140
|
for (const projData of data.projects) {
|
|
150
|
-
const project = new Project(projData, this.id, client,
|
|
141
|
+
const project = new Project(projData, this.id, client, sourceFileCache, toPath, this.snapshotRegistry);
|
|
151
142
|
this.projectMap.set(toPath(projData.configFileName), project);
|
|
152
143
|
}
|
|
153
144
|
}
|
|
@@ -176,7 +167,11 @@ export class Snapshot {
|
|
|
176
167
|
if (this.disposed)
|
|
177
168
|
return;
|
|
178
169
|
this.disposed = true;
|
|
179
|
-
this.
|
|
170
|
+
for (const project of this.projectMap.values()) {
|
|
171
|
+
project.dispose();
|
|
172
|
+
}
|
|
173
|
+
this.projectMap.clear();
|
|
174
|
+
this.snapshotRegistry.clear();
|
|
180
175
|
this.onDispose();
|
|
181
176
|
this.client.apiRequest("release", { snapshot: this.id });
|
|
182
177
|
}
|
|
@@ -189,41 +184,131 @@ export class Snapshot {
|
|
|
189
184
|
}
|
|
190
185
|
}
|
|
191
186
|
}
|
|
192
|
-
class SnapshotObjectRegistry
|
|
187
|
+
class SnapshotObjectRegistry {
|
|
188
|
+
symbols = new Map();
|
|
193
189
|
client;
|
|
194
190
|
snapshotId;
|
|
195
|
-
constructor(
|
|
196
|
-
super(factories);
|
|
191
|
+
constructor(client, snapshotId) {
|
|
197
192
|
this.client = client;
|
|
198
193
|
this.snapshotId = snapshotId;
|
|
199
194
|
}
|
|
200
|
-
|
|
195
|
+
getOrCreateSymbol(data) {
|
|
196
|
+
let symbol = this.symbols.get(data.id);
|
|
197
|
+
if (!symbol) {
|
|
198
|
+
symbol = new Symbol(data, this);
|
|
199
|
+
this.symbols.set(data.id, symbol);
|
|
200
|
+
}
|
|
201
|
+
return symbol;
|
|
202
|
+
}
|
|
203
|
+
getSymbol(id) {
|
|
204
|
+
return this.symbols.get(id);
|
|
205
|
+
}
|
|
206
|
+
clear() {
|
|
207
|
+
this.symbols.clear();
|
|
208
|
+
}
|
|
209
|
+
fetchSymbol(source, method, handle, projectId) {
|
|
201
210
|
if (!handle)
|
|
202
211
|
return undefined;
|
|
203
|
-
const cached = this.
|
|
212
|
+
const cached = this.getSymbol(handle);
|
|
204
213
|
if (cached)
|
|
205
214
|
return cached;
|
|
206
215
|
const data = this.client.apiRequest(method, {
|
|
207
216
|
snapshot: this.snapshotId,
|
|
217
|
+
project: projectId,
|
|
208
218
|
objectId: source.id,
|
|
209
219
|
});
|
|
210
220
|
if (!data)
|
|
211
|
-
throw new Error(`${method} returned null
|
|
212
|
-
return this.
|
|
221
|
+
throw new Error(`${method} returned null symbol for ${source.constructor.name} ${source.id}`);
|
|
222
|
+
return this.getOrCreateSymbol(data);
|
|
213
223
|
}
|
|
214
|
-
|
|
224
|
+
fetchSymbols(source, method, handles, projectId) {
|
|
225
|
+
if (handles) {
|
|
226
|
+
const result = new Array(handles.length);
|
|
227
|
+
let allCached = true;
|
|
228
|
+
for (let i = 0; i < handles.length; i++) {
|
|
229
|
+
const cached = this.getSymbol(handles[i]);
|
|
230
|
+
if (!cached) {
|
|
231
|
+
allCached = false;
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
result[i] = cached;
|
|
235
|
+
}
|
|
236
|
+
if (allCached)
|
|
237
|
+
return result;
|
|
238
|
+
}
|
|
239
|
+
const symbolData = this.client.apiRequest(method, {
|
|
240
|
+
snapshot: this.snapshotId,
|
|
241
|
+
project: projectId,
|
|
242
|
+
objectId: source.id,
|
|
243
|
+
});
|
|
244
|
+
if (symbolData == null)
|
|
245
|
+
return [];
|
|
246
|
+
else
|
|
247
|
+
return symbolData.map(data => this.getOrCreateSymbol(data));
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
class ProjectObjectRegistry {
|
|
251
|
+
client;
|
|
252
|
+
snapshotId;
|
|
253
|
+
projectId;
|
|
254
|
+
snapshotRegistry;
|
|
255
|
+
types = new Map();
|
|
256
|
+
signatures = new Map();
|
|
257
|
+
constructor(client, snapshotId, projectId, snapshotRegistry) {
|
|
258
|
+
this.client = client;
|
|
259
|
+
this.snapshotId = snapshotId;
|
|
260
|
+
this.projectId = projectId;
|
|
261
|
+
this.snapshotRegistry = snapshotRegistry;
|
|
262
|
+
}
|
|
263
|
+
getOrCreateSymbol(data) {
|
|
264
|
+
return this.snapshotRegistry.getOrCreateSymbol(data);
|
|
265
|
+
}
|
|
266
|
+
getSymbol(id) {
|
|
267
|
+
return this.snapshotRegistry.getSymbol(id);
|
|
268
|
+
}
|
|
269
|
+
getOrCreateType(data) {
|
|
270
|
+
let type = this.types.get(data.id);
|
|
271
|
+
if (!type) {
|
|
272
|
+
type = new TypeObject(data, this);
|
|
273
|
+
this.types.set(data.id, type);
|
|
274
|
+
}
|
|
275
|
+
return type;
|
|
276
|
+
}
|
|
277
|
+
getType(id) {
|
|
278
|
+
return this.types.get(id);
|
|
279
|
+
}
|
|
280
|
+
getOrCreateSignature(data) {
|
|
281
|
+
let sig = this.signatures.get(data.id);
|
|
282
|
+
if (!sig) {
|
|
283
|
+
sig = new Signature(data, this);
|
|
284
|
+
this.signatures.set(data.id, sig);
|
|
285
|
+
}
|
|
286
|
+
return sig;
|
|
287
|
+
}
|
|
288
|
+
getSignature(id) {
|
|
289
|
+
return this.signatures.get(id);
|
|
290
|
+
}
|
|
291
|
+
clear() {
|
|
292
|
+
this.types.clear();
|
|
293
|
+
this.signatures.clear();
|
|
294
|
+
}
|
|
295
|
+
fetchType(source, method, handle) {
|
|
215
296
|
if (!handle)
|
|
216
297
|
return undefined;
|
|
217
|
-
const cached = this.
|
|
298
|
+
const cached = this.getType(handle);
|
|
218
299
|
if (cached)
|
|
219
300
|
return cached;
|
|
220
301
|
const data = this.client.apiRequest(method, {
|
|
221
302
|
snapshot: this.snapshotId,
|
|
303
|
+
project: this.projectId,
|
|
222
304
|
objectId: source.id,
|
|
223
305
|
});
|
|
224
306
|
if (!data)
|
|
225
|
-
throw new Error(`${method} returned null
|
|
226
|
-
return this.
|
|
307
|
+
throw new Error(`${method} returned null type for ${source.constructor.name} ${source.id}`);
|
|
308
|
+
return this.getOrCreateType(data);
|
|
309
|
+
}
|
|
310
|
+
fetchSymbol(source, method, handle) {
|
|
311
|
+
return this.snapshotRegistry.fetchSymbol(source, method, handle, this.projectId);
|
|
227
312
|
}
|
|
228
313
|
fetchSignature(source, method, handle) {
|
|
229
314
|
if (!handle)
|
|
@@ -233,6 +318,7 @@ class SnapshotObjectRegistry extends ObjectRegistry {
|
|
|
233
318
|
return cached;
|
|
234
319
|
const data = this.client.apiRequest(method, {
|
|
235
320
|
snapshot: this.snapshotId,
|
|
321
|
+
project: this.projectId,
|
|
236
322
|
objectId: source.id,
|
|
237
323
|
});
|
|
238
324
|
if (!data)
|
|
@@ -256,6 +342,7 @@ class SnapshotObjectRegistry extends ObjectRegistry {
|
|
|
256
342
|
}
|
|
257
343
|
const typesData = this.client.apiRequest(method, {
|
|
258
344
|
snapshot: this.snapshotId,
|
|
345
|
+
project: this.projectId,
|
|
259
346
|
objectId: source.id,
|
|
260
347
|
});
|
|
261
348
|
if (typesData == null)
|
|
@@ -264,28 +351,7 @@ class SnapshotObjectRegistry extends ObjectRegistry {
|
|
|
264
351
|
return typesData.map(data => this.getOrCreateType(data));
|
|
265
352
|
}
|
|
266
353
|
fetchSymbols(source, method, handles) {
|
|
267
|
-
|
|
268
|
-
const result = new Array(handles.length);
|
|
269
|
-
let allCached = true;
|
|
270
|
-
for (let i = 0; i < handles.length; i++) {
|
|
271
|
-
const cached = this.getSymbol(handles[i]);
|
|
272
|
-
if (!cached) {
|
|
273
|
-
allCached = false;
|
|
274
|
-
break;
|
|
275
|
-
}
|
|
276
|
-
result[i] = cached;
|
|
277
|
-
}
|
|
278
|
-
if (allCached)
|
|
279
|
-
return result;
|
|
280
|
-
}
|
|
281
|
-
const symbolData = this.client.apiRequest(method, {
|
|
282
|
-
snapshot: this.snapshotId,
|
|
283
|
-
objectId: source.id,
|
|
284
|
-
});
|
|
285
|
-
if (symbolData == null)
|
|
286
|
-
return [];
|
|
287
|
-
else
|
|
288
|
-
return symbolData.map(data => this.getOrCreateSymbol(data));
|
|
354
|
+
return this.snapshotRegistry.fetchSymbols(source, method, handles, this.projectId);
|
|
289
355
|
}
|
|
290
356
|
}
|
|
291
357
|
export class Project {
|
|
@@ -297,16 +363,20 @@ export class Project {
|
|
|
297
363
|
checker;
|
|
298
364
|
emitter;
|
|
299
365
|
client;
|
|
300
|
-
constructor(data, snapshotId, client,
|
|
366
|
+
constructor(data, snapshotId, client, sourceFileCache, toPath, snapshotRegistry) {
|
|
301
367
|
this.id = data.id;
|
|
302
368
|
this.configFileName = data.configFileName;
|
|
303
369
|
this.compilerOptions = data.compilerOptions;
|
|
304
370
|
this.rootFiles = data.rootFiles;
|
|
305
371
|
this.client = client;
|
|
306
372
|
this.program = new Program(snapshotId, this.id, client, sourceFileCache, toPath);
|
|
373
|
+
const objectRegistry = new ProjectObjectRegistry(client, snapshotId, this.id, snapshotRegistry);
|
|
307
374
|
this.checker = new Checker(snapshotId, this.id, client, objectRegistry);
|
|
308
375
|
this.emitter = new Emitter(client);
|
|
309
376
|
}
|
|
377
|
+
dispose() {
|
|
378
|
+
this.checker.dispose();
|
|
379
|
+
}
|
|
310
380
|
}
|
|
311
381
|
export class Program {
|
|
312
382
|
snapshotId;
|
|
@@ -346,6 +416,13 @@ export class Program {
|
|
|
346
416
|
const sourceFile = new RemoteSourceFile(binaryData, this.decoder);
|
|
347
417
|
return this.sourceFileCache.set(path, sourceFile, parseOptionsKey, contentHash, this.snapshotId, this.projectId);
|
|
348
418
|
}
|
|
419
|
+
getSourceFileNames() {
|
|
420
|
+
const data = this.client.apiRequest("getSourceFileNames", {
|
|
421
|
+
snapshot: this.snapshotId,
|
|
422
|
+
project: this.projectId,
|
|
423
|
+
});
|
|
424
|
+
return data ?? [];
|
|
425
|
+
}
|
|
349
426
|
/**
|
|
350
427
|
* Get syntactic (parse) diagnostics for a specific file or all files.
|
|
351
428
|
* @param file - Optional file to get diagnostics for. If omitted, returns diagnostics for all files.
|
|
@@ -358,6 +435,18 @@ export class Program {
|
|
|
358
435
|
});
|
|
359
436
|
return data ?? [];
|
|
360
437
|
}
|
|
438
|
+
/**
|
|
439
|
+
* Get binder diagnostics for a specific file or all files.
|
|
440
|
+
* @param file - Optional file to get diagnostics for. If omitted, returns diagnostics for all files.
|
|
441
|
+
*/
|
|
442
|
+
getBindDiagnostics(file) {
|
|
443
|
+
const data = this.client.apiRequest("getBindDiagnostics", {
|
|
444
|
+
snapshot: this.snapshotId,
|
|
445
|
+
project: this.projectId,
|
|
446
|
+
...(file !== undefined ? { file } : {}),
|
|
447
|
+
});
|
|
448
|
+
return data ?? [];
|
|
449
|
+
}
|
|
361
450
|
/**
|
|
362
451
|
* Get semantic (type-check) diagnostics for a specific file or all files.
|
|
363
452
|
* @param file - Optional file to get diagnostics for. If omitted, returns diagnostics for all files.
|
|
@@ -394,6 +483,26 @@ export class Program {
|
|
|
394
483
|
});
|
|
395
484
|
return data ?? [];
|
|
396
485
|
}
|
|
486
|
+
/**
|
|
487
|
+
* Get program-wide diagnostics for the project, including compiler options diagnostics.
|
|
488
|
+
*/
|
|
489
|
+
getProgramDiagnostics() {
|
|
490
|
+
const data = this.client.apiRequest("getProgramDiagnostics", {
|
|
491
|
+
snapshot: this.snapshotId,
|
|
492
|
+
project: this.projectId,
|
|
493
|
+
});
|
|
494
|
+
return data ?? [];
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Get global (non-file-specific) semantic diagnostics for the project.
|
|
498
|
+
*/
|
|
499
|
+
getGlobalDiagnostics() {
|
|
500
|
+
const data = this.client.apiRequest("getGlobalDiagnostics", {
|
|
501
|
+
snapshot: this.snapshotId,
|
|
502
|
+
project: this.projectId,
|
|
503
|
+
});
|
|
504
|
+
return data ?? [];
|
|
505
|
+
}
|
|
397
506
|
/**
|
|
398
507
|
* Get config file parsing diagnostics for the project.
|
|
399
508
|
*/
|
|
@@ -416,6 +525,9 @@ export class Checker {
|
|
|
416
525
|
this.client = client;
|
|
417
526
|
this.objectRegistry = objectRegistry;
|
|
418
527
|
}
|
|
528
|
+
dispose() {
|
|
529
|
+
this.objectRegistry.clear();
|
|
530
|
+
}
|
|
419
531
|
getSymbolAtLocation(nodeOrNodes) {
|
|
420
532
|
if (Array.isArray(nodeOrNodes)) {
|
|
421
533
|
const data = this.client.apiRequest("getSymbolsAtLocations", {
|
|
@@ -760,6 +872,20 @@ export class Checker {
|
|
|
760
872
|
location: getNodeId(node),
|
|
761
873
|
});
|
|
762
874
|
}
|
|
875
|
+
isArrayType(type) {
|
|
876
|
+
return this.client.apiRequest("isArrayType", {
|
|
877
|
+
snapshot: this.snapshotId,
|
|
878
|
+
project: this.projectId,
|
|
879
|
+
type: type.id,
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
|
+
isTupleType(type) {
|
|
883
|
+
return this.client.apiRequest("isTupleType", {
|
|
884
|
+
snapshot: this.snapshotId,
|
|
885
|
+
project: this.projectId,
|
|
886
|
+
type: type.id,
|
|
887
|
+
});
|
|
888
|
+
}
|
|
763
889
|
getReturnTypeOfSignature(signature) {
|
|
764
890
|
const data = this.client.apiRequest("getReturnTypeOfSignature", {
|
|
765
891
|
snapshot: this.snapshotId,
|
|
@@ -799,6 +925,14 @@ export class Checker {
|
|
|
799
925
|
});
|
|
800
926
|
return data ? data.map(d => this.objectRegistry.getOrCreateType(d)) : [];
|
|
801
927
|
}
|
|
928
|
+
getApparentType(type) {
|
|
929
|
+
const data = this.client.apiRequest("getApparentType", {
|
|
930
|
+
snapshot: this.snapshotId,
|
|
931
|
+
project: this.projectId,
|
|
932
|
+
type: type.id,
|
|
933
|
+
});
|
|
934
|
+
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
935
|
+
}
|
|
802
936
|
getPropertiesOfType(type) {
|
|
803
937
|
const data = this.client.apiRequest("getPropertiesOfType", {
|
|
804
938
|
snapshot: this.snapshotId,
|
|
@@ -830,6 +964,95 @@ export class Checker {
|
|
|
830
964
|
});
|
|
831
965
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
832
966
|
}
|
|
967
|
+
getBaseConstraintOfType(type) {
|
|
968
|
+
const data = this.client.apiRequest("getBaseConstraintOfType", {
|
|
969
|
+
snapshot: this.snapshotId,
|
|
970
|
+
project: this.projectId,
|
|
971
|
+
type: type.id,
|
|
972
|
+
});
|
|
973
|
+
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
974
|
+
}
|
|
975
|
+
getPropertyOfType(type, name) {
|
|
976
|
+
const data = this.client.apiRequest("getPropertyOfType", {
|
|
977
|
+
snapshot: this.snapshotId,
|
|
978
|
+
project: this.projectId,
|
|
979
|
+
type: type.id,
|
|
980
|
+
name,
|
|
981
|
+
});
|
|
982
|
+
return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
|
|
983
|
+
}
|
|
984
|
+
getConstantValue(node) {
|
|
985
|
+
const data = this.client.apiRequest("getConstantValue", {
|
|
986
|
+
snapshot: this.snapshotId,
|
|
987
|
+
project: this.projectId,
|
|
988
|
+
location: getNodeId(node),
|
|
989
|
+
});
|
|
990
|
+
return data ?? undefined;
|
|
991
|
+
}
|
|
992
|
+
getSignatureFromDeclaration(node) {
|
|
993
|
+
const data = this.client.apiRequest("getSignatureFromDeclaration", {
|
|
994
|
+
snapshot: this.snapshotId,
|
|
995
|
+
project: this.projectId,
|
|
996
|
+
location: getNodeId(node),
|
|
997
|
+
});
|
|
998
|
+
return data ? this.objectRegistry.getOrCreateSignature(data) : undefined;
|
|
999
|
+
}
|
|
1000
|
+
getExportSpecifierLocalTargetSymbol(node) {
|
|
1001
|
+
const data = this.client.apiRequest("getExportSpecifierLocalTargetSymbol", {
|
|
1002
|
+
snapshot: this.snapshotId,
|
|
1003
|
+
project: this.projectId,
|
|
1004
|
+
location: getNodeId(node),
|
|
1005
|
+
});
|
|
1006
|
+
return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
|
|
1007
|
+
}
|
|
1008
|
+
getAliasedSymbol(symbol) {
|
|
1009
|
+
const data = this.client.apiRequest("getAliasedSymbol", {
|
|
1010
|
+
snapshot: this.snapshotId,
|
|
1011
|
+
project: this.projectId,
|
|
1012
|
+
symbol: symbol.id,
|
|
1013
|
+
});
|
|
1014
|
+
return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
|
|
1015
|
+
}
|
|
1016
|
+
getImmediateAliasedSymbol(symbol) {
|
|
1017
|
+
const data = this.client.apiRequest("getImmediateAliasedSymbol", {
|
|
1018
|
+
snapshot: this.snapshotId,
|
|
1019
|
+
project: this.projectId,
|
|
1020
|
+
symbol: symbol.id,
|
|
1021
|
+
});
|
|
1022
|
+
return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
|
|
1023
|
+
}
|
|
1024
|
+
getExportsOfModule(symbol) {
|
|
1025
|
+
const data = this.client.apiRequest("getExportsOfModule", {
|
|
1026
|
+
snapshot: this.snapshotId,
|
|
1027
|
+
project: this.projectId,
|
|
1028
|
+
symbol: symbol.id,
|
|
1029
|
+
});
|
|
1030
|
+
return data ? data.map(d => this.objectRegistry.getOrCreateSymbol(d)) : [];
|
|
1031
|
+
}
|
|
1032
|
+
getMemberInModuleExports(symbol, name) {
|
|
1033
|
+
const data = this.client.apiRequest("getMemberInModuleExports", {
|
|
1034
|
+
snapshot: this.snapshotId,
|
|
1035
|
+
project: this.projectId,
|
|
1036
|
+
symbol: symbol.id,
|
|
1037
|
+
name,
|
|
1038
|
+
});
|
|
1039
|
+
return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
|
|
1040
|
+
}
|
|
1041
|
+
getJsDocTagsOfSymbol(symbol) {
|
|
1042
|
+
const data = this.client.apiRequest("getJsDocTags", {
|
|
1043
|
+
snapshot: this.snapshotId,
|
|
1044
|
+
project: this.projectId,
|
|
1045
|
+
symbol: symbol.id,
|
|
1046
|
+
});
|
|
1047
|
+
return data ?? [];
|
|
1048
|
+
}
|
|
1049
|
+
getDocumentationCommentOfSymbol(symbol) {
|
|
1050
|
+
return this.client.apiRequest("getDocumentationComment", {
|
|
1051
|
+
snapshot: this.snapshotId,
|
|
1052
|
+
project: this.projectId,
|
|
1053
|
+
symbol: symbol.id,
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
833
1056
|
getTypeArguments(type) {
|
|
834
1057
|
const data = this.client.apiRequest("getTypeArguments", {
|
|
835
1058
|
snapshot: this.snapshotId,
|
|
@@ -912,6 +1135,12 @@ export class Symbol {
|
|
|
912
1135
|
return this;
|
|
913
1136
|
return this.objectRegistry.fetchSymbol(this, "getExportSymbolOfSymbol", this.exportSymbol);
|
|
914
1137
|
}
|
|
1138
|
+
getJsDocTags(checker) {
|
|
1139
|
+
return checker.getJsDocTagsOfSymbol(this);
|
|
1140
|
+
}
|
|
1141
|
+
getDocumentationComment(checker) {
|
|
1142
|
+
return checker.getDocumentationCommentOfSymbol(this);
|
|
1143
|
+
}
|
|
915
1144
|
}
|
|
916
1145
|
class TypeObject {
|
|
917
1146
|
objectRegistry;
|
|
@@ -1038,6 +1267,114 @@ class TypeObject {
|
|
|
1038
1267
|
getConstraint() {
|
|
1039
1268
|
return this.objectRegistry.fetchType(this, "getConstraintOfType", this.substConstraint);
|
|
1040
1269
|
}
|
|
1270
|
+
isUnionType() {
|
|
1271
|
+
return isUnionType(this);
|
|
1272
|
+
}
|
|
1273
|
+
isIntersectionType() {
|
|
1274
|
+
return isIntersectionType(this);
|
|
1275
|
+
}
|
|
1276
|
+
isObjectType() {
|
|
1277
|
+
return isObjectType(this);
|
|
1278
|
+
}
|
|
1279
|
+
isIntrinsicType() {
|
|
1280
|
+
return isIntrinsicType(this);
|
|
1281
|
+
}
|
|
1282
|
+
isLiteralType() {
|
|
1283
|
+
return isLiteralType(this);
|
|
1284
|
+
}
|
|
1285
|
+
isStringLiteralType() {
|
|
1286
|
+
return isStringLiteralType(this);
|
|
1287
|
+
}
|
|
1288
|
+
isNumberLiteralType() {
|
|
1289
|
+
return isNumberLiteralType(this);
|
|
1290
|
+
}
|
|
1291
|
+
isBigIntLiteralType() {
|
|
1292
|
+
return isBigIntLiteralType(this);
|
|
1293
|
+
}
|
|
1294
|
+
isBooleanLiteralType() {
|
|
1295
|
+
return isBooleanLiteralType(this);
|
|
1296
|
+
}
|
|
1297
|
+
isTypeReference() {
|
|
1298
|
+
return isTypeReference(this);
|
|
1299
|
+
}
|
|
1300
|
+
isTupleType() {
|
|
1301
|
+
return isTupleType(this);
|
|
1302
|
+
}
|
|
1303
|
+
isIndexType() {
|
|
1304
|
+
return isIndexType(this);
|
|
1305
|
+
}
|
|
1306
|
+
isIndexedAccessType() {
|
|
1307
|
+
return isIndexedAccessType(this);
|
|
1308
|
+
}
|
|
1309
|
+
isConditionalType() {
|
|
1310
|
+
return isConditionalType(this);
|
|
1311
|
+
}
|
|
1312
|
+
isSubstitutionType() {
|
|
1313
|
+
return isSubstitutionType(this);
|
|
1314
|
+
}
|
|
1315
|
+
isTemplateLiteralType() {
|
|
1316
|
+
return isTemplateLiteralType(this);
|
|
1317
|
+
}
|
|
1318
|
+
isStringMappingType() {
|
|
1319
|
+
return isStringMappingType(this);
|
|
1320
|
+
}
|
|
1321
|
+
isTypeParameter() {
|
|
1322
|
+
return isTypeParameter(this);
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
export function isUnionType(type) {
|
|
1326
|
+
return (type.flags & TypeFlags.Union) !== 0;
|
|
1327
|
+
}
|
|
1328
|
+
export function isIntersectionType(type) {
|
|
1329
|
+
return (type.flags & TypeFlags.Intersection) !== 0;
|
|
1330
|
+
}
|
|
1331
|
+
export function isObjectType(type) {
|
|
1332
|
+
return (type.flags & TypeFlags.Object) !== 0;
|
|
1333
|
+
}
|
|
1334
|
+
export function isIntrinsicType(type) {
|
|
1335
|
+
return (type.flags & TypeFlags.Intrinsic) !== 0;
|
|
1336
|
+
}
|
|
1337
|
+
export function isLiteralType(type) {
|
|
1338
|
+
return (type.flags & TypeFlags.Literal) !== 0;
|
|
1339
|
+
}
|
|
1340
|
+
export function isStringLiteralType(type) {
|
|
1341
|
+
return (type.flags & TypeFlags.StringLiteral) !== 0;
|
|
1342
|
+
}
|
|
1343
|
+
export function isNumberLiteralType(type) {
|
|
1344
|
+
return (type.flags & TypeFlags.NumberLiteral) !== 0;
|
|
1345
|
+
}
|
|
1346
|
+
export function isBigIntLiteralType(type) {
|
|
1347
|
+
return (type.flags & TypeFlags.BigIntLiteral) !== 0;
|
|
1348
|
+
}
|
|
1349
|
+
export function isBooleanLiteralType(type) {
|
|
1350
|
+
return (type.flags & TypeFlags.BooleanLiteral) !== 0;
|
|
1351
|
+
}
|
|
1352
|
+
export function isTypeReference(type) {
|
|
1353
|
+
return isObjectType(type) && (type.objectFlags & ObjectFlags.Reference) !== 0;
|
|
1354
|
+
}
|
|
1355
|
+
export function isTupleType(type) {
|
|
1356
|
+
return isObjectType(type) && (type.objectFlags & ObjectFlags.Tuple) !== 0;
|
|
1357
|
+
}
|
|
1358
|
+
export function isIndexType(type) {
|
|
1359
|
+
return (type.flags & TypeFlags.Index) !== 0;
|
|
1360
|
+
}
|
|
1361
|
+
export function isIndexedAccessType(type) {
|
|
1362
|
+
return (type.flags & TypeFlags.IndexedAccess) !== 0;
|
|
1363
|
+
}
|
|
1364
|
+
export function isConditionalType(type) {
|
|
1365
|
+
return (type.flags & TypeFlags.Conditional) !== 0;
|
|
1366
|
+
}
|
|
1367
|
+
export function isSubstitutionType(type) {
|
|
1368
|
+
return (type.flags & TypeFlags.Substitution) !== 0;
|
|
1369
|
+
}
|
|
1370
|
+
export function isTemplateLiteralType(type) {
|
|
1371
|
+
return (type.flags & TypeFlags.TemplateLiteral) !== 0;
|
|
1372
|
+
}
|
|
1373
|
+
export function isStringMappingType(type) {
|
|
1374
|
+
return (type.flags & TypeFlags.StringMapping) !== 0;
|
|
1375
|
+
}
|
|
1376
|
+
export function isTypeParameter(type) {
|
|
1377
|
+
return (type.flags & TypeFlags.TypeParameter) !== 0;
|
|
1041
1378
|
}
|
|
1042
1379
|
export class Signature {
|
|
1043
1380
|
flags;
|