@mohsen-azimi/tsz-dev 0.1.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/LICENSE.txt +55 -0
- package/bundler/LICENSE.txt +55 -0
- package/bundler/package.json +26 -0
- package/bundler/tsz_wasm.d.ts +2104 -0
- package/bundler/tsz_wasm.js +9 -0
- package/bundler/tsz_wasm_bg.js +5173 -0
- package/bundler/tsz_wasm_bg.wasm +0 -0
- package/bundler/tsz_wasm_bg.wasm.d.ts +369 -0
- package/node/LICENSE.txt +55 -0
- package/node/package.json +20 -0
- package/node/tsz_wasm.d.ts +2104 -0
- package/node/tsz_wasm.js +5317 -0
- package/node/tsz_wasm_bg.wasm +0 -0
- package/node/tsz_wasm_bg.wasm.d.ts +369 -0
- package/package.json +22 -0
|
@@ -0,0 +1,2104 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Comparison result for ordering operations.
|
|
6
|
+
* Matches TypeScript's `Comparison` const enum in src/compiler/corePublic.ts
|
|
7
|
+
*/
|
|
8
|
+
export enum Comparison {
|
|
9
|
+
LessThan = -1,
|
|
10
|
+
EqualTo = 0,
|
|
11
|
+
GreaterThan = 1,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* `DiagnosticCategory` enum
|
|
16
|
+
*/
|
|
17
|
+
export enum DiagnosticCategory {
|
|
18
|
+
Warning = 0,
|
|
19
|
+
Error = 1,
|
|
20
|
+
Suggestion = 2,
|
|
21
|
+
Message = 3,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* `ModuleKind` enum
|
|
26
|
+
*/
|
|
27
|
+
export enum ModuleKind {
|
|
28
|
+
None = 0,
|
|
29
|
+
CommonJS = 1,
|
|
30
|
+
AMD = 2,
|
|
31
|
+
UMD = 3,
|
|
32
|
+
System = 4,
|
|
33
|
+
ES2015 = 5,
|
|
34
|
+
ES2020 = 6,
|
|
35
|
+
ES2022 = 7,
|
|
36
|
+
ESNext = 99,
|
|
37
|
+
Node16 = 100,
|
|
38
|
+
NodeNext = 199,
|
|
39
|
+
Preserve = 200,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Index into an arena. Used instead of pointers/references for serialization-friendly graphs.
|
|
44
|
+
*/
|
|
45
|
+
export class NodeIndex {
|
|
46
|
+
private constructor();
|
|
47
|
+
free(): void;
|
|
48
|
+
[Symbol.dispose](): void;
|
|
49
|
+
0: number;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* High-performance parser using Node architecture (16 bytes/node).
|
|
54
|
+
* This is the optimized path for Phase 8 test suite evaluation.
|
|
55
|
+
*/
|
|
56
|
+
export class Parser {
|
|
57
|
+
free(): void;
|
|
58
|
+
[Symbol.dispose](): void;
|
|
59
|
+
/**
|
|
60
|
+
* Add a lib file (e.g., lib.es5.d.ts) for global type resolution.
|
|
61
|
+
* The lib file will be parsed and bound, and its global symbols will be
|
|
62
|
+
* available during binding and type checking.
|
|
63
|
+
*/
|
|
64
|
+
addLibFile(file_name: string, source_text: string): void;
|
|
65
|
+
/**
|
|
66
|
+
* Bind the source file and return symbol count.
|
|
67
|
+
*/
|
|
68
|
+
bindSourceFile(): string;
|
|
69
|
+
/**
|
|
70
|
+
* Type check the source file and return diagnostics.
|
|
71
|
+
*/
|
|
72
|
+
checkSourceFile(): string;
|
|
73
|
+
/**
|
|
74
|
+
* Debug interface parsing - dump interface members for diagnostics
|
|
75
|
+
*/
|
|
76
|
+
debugInterfaceMembers(interface_name: string): string;
|
|
77
|
+
/**
|
|
78
|
+
* Debug namespace scoping - dump scope info for all scopes
|
|
79
|
+
*/
|
|
80
|
+
debugScopes(): string;
|
|
81
|
+
/**
|
|
82
|
+
* Debug type lowering - trace what happens when lowering an interface type
|
|
83
|
+
*/
|
|
84
|
+
debugTypeLowering(interface_name: string): string;
|
|
85
|
+
/**
|
|
86
|
+
* Dump all nodes for debugging
|
|
87
|
+
*/
|
|
88
|
+
dumpAllNodes(start: number, count: number): string;
|
|
89
|
+
/**
|
|
90
|
+
* Dump variable declaration info for debugging
|
|
91
|
+
*/
|
|
92
|
+
dumpVarDecl(var_decl_idx: number): string;
|
|
93
|
+
/**
|
|
94
|
+
* Emit the source file as JavaScript (ES5 target, auto-detect CommonJS for modules).
|
|
95
|
+
*/
|
|
96
|
+
emit(): string;
|
|
97
|
+
/**
|
|
98
|
+
* Emit the source file as JavaScript (ES6+ modern output).
|
|
99
|
+
*/
|
|
100
|
+
emitModern(): string;
|
|
101
|
+
/**
|
|
102
|
+
* Emit the source file using pre-computed transforms.
|
|
103
|
+
*/
|
|
104
|
+
emitWithTransforms(context: WasmTransformContext): string;
|
|
105
|
+
/**
|
|
106
|
+
* Generate transform directives based on compiler options.
|
|
107
|
+
*/
|
|
108
|
+
generateTransforms(target: number, module: number): WasmTransformContext;
|
|
109
|
+
/**
|
|
110
|
+
* Get the AST as JSON (for debugging).
|
|
111
|
+
*/
|
|
112
|
+
getAstJson(): string;
|
|
113
|
+
/**
|
|
114
|
+
* Code Actions: Get code actions for a range.
|
|
115
|
+
*/
|
|
116
|
+
getCodeActions(start_line: number, start_char: number, end_line: number, end_char: number): any;
|
|
117
|
+
/**
|
|
118
|
+
* Code Actions: Get code actions for a range with diagnostics context.
|
|
119
|
+
*/
|
|
120
|
+
getCodeActionsWithContext(start_line: number, start_char: number, end_line: number, end_char: number, context: any): any;
|
|
121
|
+
/**
|
|
122
|
+
* Completions: Returns array of `CompletionItem` objects.
|
|
123
|
+
*/
|
|
124
|
+
getCompletionsAtPosition(line: number, character: number): any;
|
|
125
|
+
/**
|
|
126
|
+
* Go to Definition: Returns array of Location objects.
|
|
127
|
+
*/
|
|
128
|
+
getDefinitionAtPosition(line: number, character: number): any;
|
|
129
|
+
/**
|
|
130
|
+
* Get parse diagnostics as JSON.
|
|
131
|
+
*/
|
|
132
|
+
getDiagnosticsJson(): string;
|
|
133
|
+
/**
|
|
134
|
+
* Document Symbols: Returns array of `DocumentSymbol` objects.
|
|
135
|
+
*/
|
|
136
|
+
getDocumentSymbols(): any;
|
|
137
|
+
/**
|
|
138
|
+
* Hover: Returns `HoverInfo` object.
|
|
139
|
+
*/
|
|
140
|
+
getHoverAtPosition(line: number, character: number): any;
|
|
141
|
+
/**
|
|
142
|
+
* Diagnostics: Get checker diagnostics in LSP format.
|
|
143
|
+
*/
|
|
144
|
+
getLspDiagnostics(): any;
|
|
145
|
+
/**
|
|
146
|
+
* Get the number of nodes in the AST.
|
|
147
|
+
*/
|
|
148
|
+
getNodeCount(): number;
|
|
149
|
+
/**
|
|
150
|
+
* Find References: Returns array of Location objects.
|
|
151
|
+
*/
|
|
152
|
+
getReferencesAtPosition(line: number, character: number): any;
|
|
153
|
+
/**
|
|
154
|
+
* Rename - Edits: Get workspace edits for rename.
|
|
155
|
+
*/
|
|
156
|
+
getRenameEdits(line: number, character: number, new_name: string): any;
|
|
157
|
+
/**
|
|
158
|
+
* Semantic Tokens: Returns flat array of u32 (delta encoded).
|
|
159
|
+
*/
|
|
160
|
+
getSemanticTokens(): Uint32Array;
|
|
161
|
+
/**
|
|
162
|
+
* Signature Help: Returns `SignatureHelp` object.
|
|
163
|
+
*/
|
|
164
|
+
getSignatureHelpAtPosition(line: number, character: number): any;
|
|
165
|
+
/**
|
|
166
|
+
* Get the type of a node as a string.
|
|
167
|
+
*/
|
|
168
|
+
getTypeOfNode(node_idx: number): string;
|
|
169
|
+
/**
|
|
170
|
+
* Create a new Parser for the given source file.
|
|
171
|
+
*/
|
|
172
|
+
constructor(file_name: string, source_text: string);
|
|
173
|
+
/**
|
|
174
|
+
* Parse the source file and return the root node index.
|
|
175
|
+
*/
|
|
176
|
+
parseSourceFile(): number;
|
|
177
|
+
/**
|
|
178
|
+
* Rename - Prepare: Check if rename is valid at position.
|
|
179
|
+
*/
|
|
180
|
+
prepareRename(line: number, character: number): any;
|
|
181
|
+
/**
|
|
182
|
+
* Set compiler options from JSON.
|
|
183
|
+
*
|
|
184
|
+
* # Arguments
|
|
185
|
+
* * `options_json` - JSON string containing compiler options
|
|
186
|
+
*
|
|
187
|
+
* # Example
|
|
188
|
+
* ```javascript
|
|
189
|
+
* const parser = new Parser("file.ts", "const x = 1;");
|
|
190
|
+
* parser.setCompilerOptions(JSON.stringify({
|
|
191
|
+
* strict: true,
|
|
192
|
+
* noImplicitAny: true,
|
|
193
|
+
* strictNullChecks: true
|
|
194
|
+
* }));
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
setCompilerOptions(options_json: string): void;
|
|
198
|
+
/**
|
|
199
|
+
* Trace the parent chain for a node at a given position
|
|
200
|
+
*/
|
|
201
|
+
traceParentChain(pos: number): string;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* The scanner state that holds the current position and token information.
|
|
206
|
+
*
|
|
207
|
+
* ZERO-COPY OPTIMIZATION: Source is stored as UTF-8 text directly (no Vec<char>).
|
|
208
|
+
* For ASCII-only files (99% of TypeScript), byte position == character position.
|
|
209
|
+
* Positions are byte-based internally for performance, converted when needed.
|
|
210
|
+
*/
|
|
211
|
+
export class ScannerState {
|
|
212
|
+
free(): void;
|
|
213
|
+
[Symbol.dispose](): void;
|
|
214
|
+
/**
|
|
215
|
+
* Get the current position (end position of current token).
|
|
216
|
+
*/
|
|
217
|
+
getPos(): number;
|
|
218
|
+
/**
|
|
219
|
+
* Get the source text.
|
|
220
|
+
*/
|
|
221
|
+
getText(): string;
|
|
222
|
+
/**
|
|
223
|
+
* Get the current token kind.
|
|
224
|
+
*/
|
|
225
|
+
getToken(): SyntaxKind;
|
|
226
|
+
/**
|
|
227
|
+
* Get the end position of the current token.
|
|
228
|
+
*/
|
|
229
|
+
getTokenEnd(): number;
|
|
230
|
+
/**
|
|
231
|
+
* Get the token flags.
|
|
232
|
+
*/
|
|
233
|
+
getTokenFlags(): number;
|
|
234
|
+
/**
|
|
235
|
+
* Get the full start position (including leading trivia).
|
|
236
|
+
*/
|
|
237
|
+
getTokenFullStart(): number;
|
|
238
|
+
/**
|
|
239
|
+
* Get the start position of the current token (excluding trivia).
|
|
240
|
+
*/
|
|
241
|
+
getTokenStart(): number;
|
|
242
|
+
/**
|
|
243
|
+
* Get the current token's text from the source.
|
|
244
|
+
*/
|
|
245
|
+
getTokenText(): string;
|
|
246
|
+
/**
|
|
247
|
+
* Get the current token's string value.
|
|
248
|
+
* Note: Prefer `get_token_value_ref()` to avoid allocation when possible.
|
|
249
|
+
*/
|
|
250
|
+
getTokenValue(): string;
|
|
251
|
+
/**
|
|
252
|
+
* Check if there was a preceding line break.
|
|
253
|
+
*/
|
|
254
|
+
hasPrecedingLineBreak(): boolean;
|
|
255
|
+
/**
|
|
256
|
+
* Check if the current token is an identifier.
|
|
257
|
+
*/
|
|
258
|
+
isIdentifier(): boolean;
|
|
259
|
+
/**
|
|
260
|
+
* Check if the current token is a reserved word.
|
|
261
|
+
*/
|
|
262
|
+
isReservedWord(): boolean;
|
|
263
|
+
/**
|
|
264
|
+
* Check if the token is unterminated.
|
|
265
|
+
*/
|
|
266
|
+
isUnterminated(): boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Exported scanner accessors are JS bindings and cannot be made `const`
|
|
269
|
+
* because `#[wasm_bindgen]` methods in this crate are non-`const`.
|
|
270
|
+
* Create a new scanner state with the given text.
|
|
271
|
+
* ZERO-COPY: No Vec<char> allocation, works directly with UTF-8 bytes.
|
|
272
|
+
*/
|
|
273
|
+
constructor(text: string, skip_trivia: boolean);
|
|
274
|
+
/**
|
|
275
|
+
* Re-scan the current `*=` token as `*` followed by `=`.
|
|
276
|
+
* Used when parsing computed property names.
|
|
277
|
+
*/
|
|
278
|
+
reScanAsteriskEqualsToken(): SyntaxKind;
|
|
279
|
+
/**
|
|
280
|
+
* Re-scan the current `>` token to see if it should be `>=`, `>>`, `>>>`, `>>=`, or `>>>=`.
|
|
281
|
+
* This is used by the parser for type arguments and bitwise operators.
|
|
282
|
+
*/
|
|
283
|
+
reScanGreaterToken(): SyntaxKind;
|
|
284
|
+
/**
|
|
285
|
+
* Re-scan the current `#` token as a hash token or private identifier.
|
|
286
|
+
*/
|
|
287
|
+
reScanHashToken(): SyntaxKind;
|
|
288
|
+
/**
|
|
289
|
+
* Re-scan an invalid identifier to check if it's valid in a specific context.
|
|
290
|
+
*/
|
|
291
|
+
reScanInvalidIdentifier(): SyntaxKind;
|
|
292
|
+
/**
|
|
293
|
+
* Re-scan a JSX attribute value from the current token position.
|
|
294
|
+
*/
|
|
295
|
+
reScanJsxAttributeValue(): SyntaxKind;
|
|
296
|
+
/**
|
|
297
|
+
* Re-scan the current token as a JSX token.
|
|
298
|
+
* Used when the parser enters JSX context and needs to rescan.
|
|
299
|
+
*/
|
|
300
|
+
reScanJsxToken(allow_multiline_jsx_text: boolean): SyntaxKind;
|
|
301
|
+
/**
|
|
302
|
+
* Re-scan a `<` token in JSX context.
|
|
303
|
+
* Returns `LessThanSlashToken` if followed by `/`, otherwise `LessThanToken`.
|
|
304
|
+
*/
|
|
305
|
+
reScanLessThanToken(): SyntaxKind;
|
|
306
|
+
/**
|
|
307
|
+
* Re-scan the current `?` token for optional chaining.
|
|
308
|
+
*/
|
|
309
|
+
reScanQuestionToken(): SyntaxKind;
|
|
310
|
+
/**
|
|
311
|
+
* Re-scan the current `/` or `/=` token as a regex literal.
|
|
312
|
+
* This is used by the parser when it determines the context requires a regex.
|
|
313
|
+
*/
|
|
314
|
+
reScanSlashToken(): SyntaxKind;
|
|
315
|
+
/**
|
|
316
|
+
* Re-scan template head or no-substitution template.
|
|
317
|
+
* Used when the parser needs to rescan the start of a template.
|
|
318
|
+
*/
|
|
319
|
+
reScanTemplateHeadOrNoSubstitutionTemplate(): SyntaxKind;
|
|
320
|
+
/**
|
|
321
|
+
* Re-scan the current `}` token as the continuation of a template literal.
|
|
322
|
+
* Called by the parser when it determines that a `}` is closing a template expression.
|
|
323
|
+
*
|
|
324
|
+
* # Arguments
|
|
325
|
+
* * `is_tagged_template` - If true, invalid escape sequences should not report errors
|
|
326
|
+
* (tagged templates can have invalid escapes that get passed to the tag function as raw).
|
|
327
|
+
* For now, we don't report errors anyway, so this parameter affects nothing.
|
|
328
|
+
*/
|
|
329
|
+
reScanTemplateToken(_is_tagged_template: boolean): SyntaxKind;
|
|
330
|
+
/**
|
|
331
|
+
* Reset the token state to a specific position.
|
|
332
|
+
*/
|
|
333
|
+
resetTokenState(new_pos: number): void;
|
|
334
|
+
/**
|
|
335
|
+
* Scan the next token.
|
|
336
|
+
*/
|
|
337
|
+
scan(): SyntaxKind;
|
|
338
|
+
/**
|
|
339
|
+
* Scan `JSDoc` comment text token.
|
|
340
|
+
* Used for scanning the text content within `JSDoc` comments.
|
|
341
|
+
*/
|
|
342
|
+
scanJsDocCommentTextToken(in_backticks: boolean): SyntaxKind;
|
|
343
|
+
/**
|
|
344
|
+
* Scan a `JSDoc` token.
|
|
345
|
+
* Used when parsing `JSDoc` comments.
|
|
346
|
+
*/
|
|
347
|
+
scanJsDocToken(): SyntaxKind;
|
|
348
|
+
/**
|
|
349
|
+
* Scan a JSX attribute value (string literal or expression).
|
|
350
|
+
*/
|
|
351
|
+
scanJsxAttributeValue(): SyntaxKind;
|
|
352
|
+
/**
|
|
353
|
+
* Scan a JSX identifier.
|
|
354
|
+
* In JSX, identifiers can contain hyphens (like `data-testid`).
|
|
355
|
+
*/
|
|
356
|
+
scanJsxIdentifier(): SyntaxKind;
|
|
357
|
+
/**
|
|
358
|
+
* Scan a shebang (#!) at the start of the file.
|
|
359
|
+
* Returns the length of the shebang line (including newline), or 0 if no shebang.
|
|
360
|
+
*/
|
|
361
|
+
scanShebangTrivia(): number;
|
|
362
|
+
/**
|
|
363
|
+
* Set the text to scan.
|
|
364
|
+
* ZERO-COPY: Works directly with UTF-8 bytes.
|
|
365
|
+
*/
|
|
366
|
+
setText(text: string, start?: number | null, length?: number | null): void;
|
|
367
|
+
/**
|
|
368
|
+
* Set the current position (used for rescanning compound tokens).
|
|
369
|
+
* This allows consuming partial tokens like splitting `>>` into `>` + `>`.
|
|
370
|
+
*/
|
|
371
|
+
set_pos(pos: number): void;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* `ScriptKind` enum (file type)
|
|
376
|
+
*/
|
|
377
|
+
export enum ScriptKind {
|
|
378
|
+
Unknown = 0,
|
|
379
|
+
JS = 1,
|
|
380
|
+
JSX = 2,
|
|
381
|
+
TS = 3,
|
|
382
|
+
TSX = 4,
|
|
383
|
+
External = 5,
|
|
384
|
+
JSON = 6,
|
|
385
|
+
Deferred = 7,
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* `ScriptTarget` enum (ES version)
|
|
390
|
+
*/
|
|
391
|
+
export enum ScriptTarget {
|
|
392
|
+
ES3 = 0,
|
|
393
|
+
ES5 = 1,
|
|
394
|
+
ES2015 = 2,
|
|
395
|
+
ES2016 = 3,
|
|
396
|
+
ES2017 = 4,
|
|
397
|
+
ES2018 = 5,
|
|
398
|
+
ES2019 = 6,
|
|
399
|
+
ES2020 = 7,
|
|
400
|
+
ES2021 = 8,
|
|
401
|
+
ES2022 = 9,
|
|
402
|
+
ES2023 = 10,
|
|
403
|
+
ESNext = 99,
|
|
404
|
+
JSON = 100,
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* `SignatureKind` enum
|
|
409
|
+
*/
|
|
410
|
+
export enum SignatureKind {
|
|
411
|
+
Call = 0,
|
|
412
|
+
Construct = 1,
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Syntax kind enum matching TypeScript's `SyntaxKind`.
|
|
417
|
+
* This enum contains only the token types produced by the scanner (0-186).
|
|
418
|
+
* AST node types are not included here.
|
|
419
|
+
*/
|
|
420
|
+
export enum SyntaxKind {
|
|
421
|
+
Unknown = 0,
|
|
422
|
+
EndOfFileToken = 1,
|
|
423
|
+
SingleLineCommentTrivia = 2,
|
|
424
|
+
MultiLineCommentTrivia = 3,
|
|
425
|
+
NewLineTrivia = 4,
|
|
426
|
+
WhitespaceTrivia = 5,
|
|
427
|
+
ShebangTrivia = 6,
|
|
428
|
+
ConflictMarkerTrivia = 7,
|
|
429
|
+
NonTextFileMarkerTrivia = 8,
|
|
430
|
+
NumericLiteral = 9,
|
|
431
|
+
BigIntLiteral = 10,
|
|
432
|
+
StringLiteral = 11,
|
|
433
|
+
JsxText = 12,
|
|
434
|
+
JsxTextAllWhiteSpaces = 13,
|
|
435
|
+
RegularExpressionLiteral = 14,
|
|
436
|
+
NoSubstitutionTemplateLiteral = 15,
|
|
437
|
+
TemplateHead = 16,
|
|
438
|
+
TemplateMiddle = 17,
|
|
439
|
+
TemplateTail = 18,
|
|
440
|
+
OpenBraceToken = 19,
|
|
441
|
+
CloseBraceToken = 20,
|
|
442
|
+
OpenParenToken = 21,
|
|
443
|
+
CloseParenToken = 22,
|
|
444
|
+
OpenBracketToken = 23,
|
|
445
|
+
CloseBracketToken = 24,
|
|
446
|
+
DotToken = 25,
|
|
447
|
+
DotDotDotToken = 26,
|
|
448
|
+
SemicolonToken = 27,
|
|
449
|
+
CommaToken = 28,
|
|
450
|
+
QuestionDotToken = 29,
|
|
451
|
+
LessThanToken = 30,
|
|
452
|
+
LessThanSlashToken = 31,
|
|
453
|
+
GreaterThanToken = 32,
|
|
454
|
+
LessThanEqualsToken = 33,
|
|
455
|
+
GreaterThanEqualsToken = 34,
|
|
456
|
+
EqualsEqualsToken = 35,
|
|
457
|
+
ExclamationEqualsToken = 36,
|
|
458
|
+
EqualsEqualsEqualsToken = 37,
|
|
459
|
+
ExclamationEqualsEqualsToken = 38,
|
|
460
|
+
EqualsGreaterThanToken = 39,
|
|
461
|
+
PlusToken = 40,
|
|
462
|
+
MinusToken = 41,
|
|
463
|
+
AsteriskToken = 42,
|
|
464
|
+
AsteriskAsteriskToken = 43,
|
|
465
|
+
SlashToken = 44,
|
|
466
|
+
PercentToken = 45,
|
|
467
|
+
PlusPlusToken = 46,
|
|
468
|
+
MinusMinusToken = 47,
|
|
469
|
+
LessThanLessThanToken = 48,
|
|
470
|
+
GreaterThanGreaterThanToken = 49,
|
|
471
|
+
GreaterThanGreaterThanGreaterThanToken = 50,
|
|
472
|
+
AmpersandToken = 51,
|
|
473
|
+
BarToken = 52,
|
|
474
|
+
CaretToken = 53,
|
|
475
|
+
ExclamationToken = 54,
|
|
476
|
+
TildeToken = 55,
|
|
477
|
+
AmpersandAmpersandToken = 56,
|
|
478
|
+
BarBarToken = 57,
|
|
479
|
+
QuestionToken = 58,
|
|
480
|
+
ColonToken = 59,
|
|
481
|
+
AtToken = 60,
|
|
482
|
+
QuestionQuestionToken = 61,
|
|
483
|
+
BacktickToken = 62,
|
|
484
|
+
HashToken = 63,
|
|
485
|
+
EqualsToken = 64,
|
|
486
|
+
PlusEqualsToken = 65,
|
|
487
|
+
MinusEqualsToken = 66,
|
|
488
|
+
AsteriskEqualsToken = 67,
|
|
489
|
+
AsteriskAsteriskEqualsToken = 68,
|
|
490
|
+
SlashEqualsToken = 69,
|
|
491
|
+
PercentEqualsToken = 70,
|
|
492
|
+
LessThanLessThanEqualsToken = 71,
|
|
493
|
+
GreaterThanGreaterThanEqualsToken = 72,
|
|
494
|
+
GreaterThanGreaterThanGreaterThanEqualsToken = 73,
|
|
495
|
+
AmpersandEqualsToken = 74,
|
|
496
|
+
BarEqualsToken = 75,
|
|
497
|
+
BarBarEqualsToken = 76,
|
|
498
|
+
AmpersandAmpersandEqualsToken = 77,
|
|
499
|
+
QuestionQuestionEqualsToken = 78,
|
|
500
|
+
CaretEqualsToken = 79,
|
|
501
|
+
Identifier = 80,
|
|
502
|
+
PrivateIdentifier = 81,
|
|
503
|
+
JSDocCommentTextToken = 82,
|
|
504
|
+
BreakKeyword = 83,
|
|
505
|
+
CaseKeyword = 84,
|
|
506
|
+
CatchKeyword = 85,
|
|
507
|
+
ClassKeyword = 86,
|
|
508
|
+
ConstKeyword = 87,
|
|
509
|
+
ContinueKeyword = 88,
|
|
510
|
+
DebuggerKeyword = 89,
|
|
511
|
+
DefaultKeyword = 90,
|
|
512
|
+
DeleteKeyword = 91,
|
|
513
|
+
DoKeyword = 92,
|
|
514
|
+
ElseKeyword = 93,
|
|
515
|
+
EnumKeyword = 94,
|
|
516
|
+
ExportKeyword = 95,
|
|
517
|
+
ExtendsKeyword = 96,
|
|
518
|
+
FalseKeyword = 97,
|
|
519
|
+
FinallyKeyword = 98,
|
|
520
|
+
ForKeyword = 99,
|
|
521
|
+
FunctionKeyword = 100,
|
|
522
|
+
IfKeyword = 101,
|
|
523
|
+
ImportKeyword = 102,
|
|
524
|
+
InKeyword = 103,
|
|
525
|
+
InstanceOfKeyword = 104,
|
|
526
|
+
NewKeyword = 105,
|
|
527
|
+
NullKeyword = 106,
|
|
528
|
+
ReturnKeyword = 107,
|
|
529
|
+
SuperKeyword = 108,
|
|
530
|
+
SwitchKeyword = 109,
|
|
531
|
+
ThisKeyword = 110,
|
|
532
|
+
ThrowKeyword = 111,
|
|
533
|
+
TrueKeyword = 112,
|
|
534
|
+
TryKeyword = 113,
|
|
535
|
+
TypeOfKeyword = 114,
|
|
536
|
+
VarKeyword = 115,
|
|
537
|
+
VoidKeyword = 116,
|
|
538
|
+
WhileKeyword = 117,
|
|
539
|
+
WithKeyword = 118,
|
|
540
|
+
ImplementsKeyword = 119,
|
|
541
|
+
InterfaceKeyword = 120,
|
|
542
|
+
LetKeyword = 121,
|
|
543
|
+
PackageKeyword = 122,
|
|
544
|
+
PrivateKeyword = 123,
|
|
545
|
+
ProtectedKeyword = 124,
|
|
546
|
+
PublicKeyword = 125,
|
|
547
|
+
StaticKeyword = 126,
|
|
548
|
+
YieldKeyword = 127,
|
|
549
|
+
AbstractKeyword = 128,
|
|
550
|
+
AccessorKeyword = 129,
|
|
551
|
+
AsKeyword = 130,
|
|
552
|
+
AssertsKeyword = 131,
|
|
553
|
+
AssertKeyword = 132,
|
|
554
|
+
AnyKeyword = 133,
|
|
555
|
+
AsyncKeyword = 134,
|
|
556
|
+
AwaitKeyword = 135,
|
|
557
|
+
BooleanKeyword = 136,
|
|
558
|
+
ConstructorKeyword = 137,
|
|
559
|
+
DeclareKeyword = 138,
|
|
560
|
+
GetKeyword = 139,
|
|
561
|
+
InferKeyword = 140,
|
|
562
|
+
IntrinsicKeyword = 141,
|
|
563
|
+
IsKeyword = 142,
|
|
564
|
+
KeyOfKeyword = 143,
|
|
565
|
+
ModuleKeyword = 144,
|
|
566
|
+
NamespaceKeyword = 145,
|
|
567
|
+
NeverKeyword = 146,
|
|
568
|
+
OutKeyword = 147,
|
|
569
|
+
ReadonlyKeyword = 148,
|
|
570
|
+
RequireKeyword = 149,
|
|
571
|
+
NumberKeyword = 150,
|
|
572
|
+
ObjectKeyword = 151,
|
|
573
|
+
SatisfiesKeyword = 152,
|
|
574
|
+
SetKeyword = 153,
|
|
575
|
+
StringKeyword = 154,
|
|
576
|
+
SymbolKeyword = 155,
|
|
577
|
+
TypeKeyword = 156,
|
|
578
|
+
UndefinedKeyword = 157,
|
|
579
|
+
UniqueKeyword = 158,
|
|
580
|
+
UnknownKeyword = 159,
|
|
581
|
+
UsingKeyword = 160,
|
|
582
|
+
FromKeyword = 161,
|
|
583
|
+
GlobalKeyword = 162,
|
|
584
|
+
BigIntKeyword = 163,
|
|
585
|
+
OverrideKeyword = 164,
|
|
586
|
+
OfKeyword = 165,
|
|
587
|
+
DeferKeyword = 166,
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* A text range with start and end positions.
|
|
592
|
+
* All positions are character indices (not byte indices).
|
|
593
|
+
*/
|
|
594
|
+
export class TextRange {
|
|
595
|
+
free(): void;
|
|
596
|
+
[Symbol.dispose](): void;
|
|
597
|
+
/**
|
|
598
|
+
* Create a new text range.
|
|
599
|
+
* All positions are character indices (not byte indices).
|
|
600
|
+
*/
|
|
601
|
+
constructor(pos: number, end: number);
|
|
602
|
+
end: number;
|
|
603
|
+
pos: number;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Token flags indicating special properties of scanned tokens.
|
|
608
|
+
*/
|
|
609
|
+
export enum TokenFlags {
|
|
610
|
+
None = 0,
|
|
611
|
+
PrecedingLineBreak = 1,
|
|
612
|
+
PrecedingJSDocComment = 2,
|
|
613
|
+
Unterminated = 4,
|
|
614
|
+
ExtendedUnicodeEscape = 8,
|
|
615
|
+
Scientific = 16,
|
|
616
|
+
Octal = 32,
|
|
617
|
+
HexSpecifier = 64,
|
|
618
|
+
BinarySpecifier = 128,
|
|
619
|
+
OctalSpecifier = 256,
|
|
620
|
+
ContainsSeparator = 512,
|
|
621
|
+
UnicodeEscape = 1024,
|
|
622
|
+
ContainsInvalidEscape = 2048,
|
|
623
|
+
HexEscape = 4096,
|
|
624
|
+
ContainsLeadingZero = 8192,
|
|
625
|
+
ContainsInvalidSeparator = 16384,
|
|
626
|
+
PrecedingJSDocLeadingAsterisks = 32768,
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* TypeScript Diagnostic - represents a compiler diagnostic
|
|
631
|
+
*
|
|
632
|
+
* Contains:
|
|
633
|
+
* - file information (name, position)
|
|
634
|
+
* - message (text or chain)
|
|
635
|
+
* - category (error, warning, suggestion, message)
|
|
636
|
+
* - error code
|
|
637
|
+
*/
|
|
638
|
+
export class TsDiagnostic {
|
|
639
|
+
free(): void;
|
|
640
|
+
[Symbol.dispose](): void;
|
|
641
|
+
/**
|
|
642
|
+
* Check if this is an error
|
|
643
|
+
*/
|
|
644
|
+
isError(): boolean;
|
|
645
|
+
/**
|
|
646
|
+
* Check if this is a warning
|
|
647
|
+
*/
|
|
648
|
+
isWarning(): boolean;
|
|
649
|
+
/**
|
|
650
|
+
* Create a new diagnostic
|
|
651
|
+
*/
|
|
652
|
+
constructor(file_name: string | null | undefined, start: number, length: number, message_text: string, category: DiagnosticCategory, code: number);
|
|
653
|
+
/**
|
|
654
|
+
* Convert to JSON
|
|
655
|
+
*/
|
|
656
|
+
toJson(): string;
|
|
657
|
+
/**
|
|
658
|
+
* Get the category
|
|
659
|
+
*/
|
|
660
|
+
readonly category: number;
|
|
661
|
+
/**
|
|
662
|
+
* Get the error code
|
|
663
|
+
*/
|
|
664
|
+
readonly code: number;
|
|
665
|
+
/**
|
|
666
|
+
* Get the file name
|
|
667
|
+
*/
|
|
668
|
+
readonly fileName: string | undefined;
|
|
669
|
+
/**
|
|
670
|
+
* Get the length
|
|
671
|
+
*/
|
|
672
|
+
readonly length: number;
|
|
673
|
+
/**
|
|
674
|
+
* Get the message text
|
|
675
|
+
*/
|
|
676
|
+
readonly messageText: string;
|
|
677
|
+
/**
|
|
678
|
+
* Get the start position
|
|
679
|
+
*/
|
|
680
|
+
readonly start: number;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* Language Service for a single file
|
|
685
|
+
*
|
|
686
|
+
* Provides IDE-like features for a TypeScript/JavaScript file.
|
|
687
|
+
*/
|
|
688
|
+
export class TsLanguageService {
|
|
689
|
+
free(): void;
|
|
690
|
+
[Symbol.dispose](): void;
|
|
691
|
+
/**
|
|
692
|
+
* Dispose resources
|
|
693
|
+
*/
|
|
694
|
+
dispose(): void;
|
|
695
|
+
/**
|
|
696
|
+
* Get completions at a position
|
|
697
|
+
*
|
|
698
|
+
* # Arguments
|
|
699
|
+
* * `line` - 0-based line number
|
|
700
|
+
* * `character` - 0-based character offset
|
|
701
|
+
*
|
|
702
|
+
* # Returns
|
|
703
|
+
* JSON array of completion items
|
|
704
|
+
*/
|
|
705
|
+
getCompletionsAtPosition(line: number, character: number): string;
|
|
706
|
+
/**
|
|
707
|
+
* Get definition location at a position
|
|
708
|
+
*
|
|
709
|
+
* # Arguments
|
|
710
|
+
* * `line` - 0-based line number
|
|
711
|
+
* * `character` - 0-based character offset
|
|
712
|
+
*
|
|
713
|
+
* # Returns
|
|
714
|
+
* JSON array of definition locations
|
|
715
|
+
*/
|
|
716
|
+
getDefinitionAtPosition(line: number, character: number): string;
|
|
717
|
+
/**
|
|
718
|
+
* Get hover information at a position
|
|
719
|
+
*
|
|
720
|
+
* # Arguments
|
|
721
|
+
* * `line` - 0-based line number
|
|
722
|
+
* * `character` - 0-based character offset
|
|
723
|
+
*
|
|
724
|
+
* # Returns
|
|
725
|
+
* JSON with hover contents and range
|
|
726
|
+
*/
|
|
727
|
+
getQuickInfoAtPosition(line: number, character: number): string;
|
|
728
|
+
/**
|
|
729
|
+
* Get references at a position
|
|
730
|
+
*
|
|
731
|
+
* # Arguments
|
|
732
|
+
* * `line` - 0-based line number
|
|
733
|
+
* * `character` - 0-based character offset
|
|
734
|
+
*
|
|
735
|
+
* # Returns
|
|
736
|
+
* JSON array of reference locations
|
|
737
|
+
*/
|
|
738
|
+
getReferencesAtPosition(line: number, character: number): string;
|
|
739
|
+
/**
|
|
740
|
+
* Create a new language service for a file
|
|
741
|
+
*/
|
|
742
|
+
constructor(file_name: string, source_text: string);
|
|
743
|
+
/**
|
|
744
|
+
* Update the source text and re-parse
|
|
745
|
+
*/
|
|
746
|
+
updateSource(source_text: string): void;
|
|
747
|
+
/**
|
|
748
|
+
* Get the file name
|
|
749
|
+
*/
|
|
750
|
+
readonly fileName: string;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* TypeScript Program - the main compilation unit
|
|
755
|
+
*
|
|
756
|
+
* Represents a compiled TypeScript program with access to:
|
|
757
|
+
* - Source files
|
|
758
|
+
* - Diagnostics (syntactic and semantic)
|
|
759
|
+
* - Type checker
|
|
760
|
+
* - Emit functionality
|
|
761
|
+
*/
|
|
762
|
+
export class TsProgram {
|
|
763
|
+
free(): void;
|
|
764
|
+
[Symbol.dispose](): void;
|
|
765
|
+
/**
|
|
766
|
+
* Add a library file (lib.d.ts, lib.es5.d.ts, etc.)
|
|
767
|
+
*/
|
|
768
|
+
addLibFile(file_name: string, source_text: string): void;
|
|
769
|
+
/**
|
|
770
|
+
* Add a source file to the program
|
|
771
|
+
*/
|
|
772
|
+
addSourceFile(file_name: string, source_text: string): void;
|
|
773
|
+
/**
|
|
774
|
+
* Clean up resources
|
|
775
|
+
*/
|
|
776
|
+
dispose(): void;
|
|
777
|
+
/**
|
|
778
|
+
* Emit a single file by name
|
|
779
|
+
*/
|
|
780
|
+
emitFile(file_name: string): string;
|
|
781
|
+
/**
|
|
782
|
+
* Emit JavaScript output for all files
|
|
783
|
+
*/
|
|
784
|
+
emitJson(): string;
|
|
785
|
+
/**
|
|
786
|
+
* Get all diagnostic codes as array
|
|
787
|
+
*/
|
|
788
|
+
getAllDiagnosticCodes(): Uint32Array;
|
|
789
|
+
/**
|
|
790
|
+
* Get compiler options as JSON
|
|
791
|
+
*/
|
|
792
|
+
getCompilerOptionsJson(): string;
|
|
793
|
+
/**
|
|
794
|
+
* Get all diagnostics (syntactic + semantic) as JSON
|
|
795
|
+
*/
|
|
796
|
+
getPreEmitDiagnosticsJson(): string;
|
|
797
|
+
/**
|
|
798
|
+
* Get source file names as JSON array
|
|
799
|
+
*/
|
|
800
|
+
getRootFileNames(): any;
|
|
801
|
+
/**
|
|
802
|
+
* Get semantic diagnostics as JSON
|
|
803
|
+
*/
|
|
804
|
+
getSemanticDiagnosticsJson(file_name?: string | null): string;
|
|
805
|
+
/**
|
|
806
|
+
* Get the number of source files
|
|
807
|
+
*/
|
|
808
|
+
getSourceFileCount(): number;
|
|
809
|
+
/**
|
|
810
|
+
* Get syntactic diagnostics as JSON
|
|
811
|
+
*/
|
|
812
|
+
getSyntacticDiagnosticsJson(file_name?: string | null): string;
|
|
813
|
+
/**
|
|
814
|
+
* Get the type checker
|
|
815
|
+
*
|
|
816
|
+
* Returns a handle to the type checker for this program.
|
|
817
|
+
* The type checker provides type information and type-related operations.
|
|
818
|
+
*/
|
|
819
|
+
getTypeChecker(): TsTypeChecker;
|
|
820
|
+
/**
|
|
821
|
+
* Create a new empty program
|
|
822
|
+
*/
|
|
823
|
+
constructor();
|
|
824
|
+
/**
|
|
825
|
+
* Set compiler options from JSON
|
|
826
|
+
*/
|
|
827
|
+
setCompilerOptions(options_json: string): void;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
/**
|
|
831
|
+
* TypeScript Signature - represents a call/construct signature
|
|
832
|
+
*
|
|
833
|
+
* Signatures have:
|
|
834
|
+
* - parameters
|
|
835
|
+
* - return type
|
|
836
|
+
* - type parameters (for generic signatures)
|
|
837
|
+
*/
|
|
838
|
+
export class TsSignature {
|
|
839
|
+
free(): void;
|
|
840
|
+
[Symbol.dispose](): void;
|
|
841
|
+
/**
|
|
842
|
+
* Get declaration node handle
|
|
843
|
+
*/
|
|
844
|
+
getDeclarationHandle(): number | undefined;
|
|
845
|
+
/**
|
|
846
|
+
* Get parameter symbol handles
|
|
847
|
+
*/
|
|
848
|
+
getParameterHandles(): Uint32Array;
|
|
849
|
+
/**
|
|
850
|
+
* Get type parameter handles
|
|
851
|
+
*/
|
|
852
|
+
getTypeParameterHandles(): Uint32Array;
|
|
853
|
+
/**
|
|
854
|
+
* Create a new signature wrapper
|
|
855
|
+
*/
|
|
856
|
+
constructor(handle: number);
|
|
857
|
+
/**
|
|
858
|
+
* Get the signature handle
|
|
859
|
+
*/
|
|
860
|
+
readonly handle: number;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
/**
|
|
864
|
+
* TypeScript `SourceFile` - represents a parsed source file
|
|
865
|
+
*
|
|
866
|
+
* Provides access to:
|
|
867
|
+
* - File metadata (name, text, language version)
|
|
868
|
+
* - AST root and statements
|
|
869
|
+
* - Node traversal methods
|
|
870
|
+
*/
|
|
871
|
+
export class TsSourceFile {
|
|
872
|
+
free(): void;
|
|
873
|
+
[Symbol.dispose](): void;
|
|
874
|
+
/**
|
|
875
|
+
* Iterate over children (returns child handles as JSON array)
|
|
876
|
+
*/
|
|
877
|
+
forEachChild(handle: number): any;
|
|
878
|
+
/**
|
|
879
|
+
* Get children of a node
|
|
880
|
+
*/
|
|
881
|
+
getChildHandles(handle: number): Uint32Array;
|
|
882
|
+
/**
|
|
883
|
+
* Get identifier text for an identifier node
|
|
884
|
+
*/
|
|
885
|
+
getIdentifierText(handle: number): string | undefined;
|
|
886
|
+
/**
|
|
887
|
+
* Get node end position
|
|
888
|
+
*/
|
|
889
|
+
getNodeEnd(handle: number): number;
|
|
890
|
+
/**
|
|
891
|
+
* Get node flags
|
|
892
|
+
*/
|
|
893
|
+
getNodeFlags(handle: number): number;
|
|
894
|
+
/**
|
|
895
|
+
* Get node kind by handle
|
|
896
|
+
*/
|
|
897
|
+
getNodeKind(handle: number): number;
|
|
898
|
+
/**
|
|
899
|
+
* Get node start position
|
|
900
|
+
*/
|
|
901
|
+
getNodePos(handle: number): number;
|
|
902
|
+
/**
|
|
903
|
+
* Get node text (substring from source)
|
|
904
|
+
*/
|
|
905
|
+
getNodeText(handle: number): string;
|
|
906
|
+
/**
|
|
907
|
+
* Get parent node handle
|
|
908
|
+
*/
|
|
909
|
+
getParentHandle(handle: number): number;
|
|
910
|
+
/**
|
|
911
|
+
* Get the root node handle
|
|
912
|
+
*/
|
|
913
|
+
getRootHandle(): number;
|
|
914
|
+
/**
|
|
915
|
+
* Get statement handles (children of source file)
|
|
916
|
+
*/
|
|
917
|
+
getStatementHandles(): Uint32Array;
|
|
918
|
+
/**
|
|
919
|
+
* Check if a node is a specific kind
|
|
920
|
+
*/
|
|
921
|
+
isKind(handle: number, kind: number): boolean;
|
|
922
|
+
/**
|
|
923
|
+
* Create a new source file by parsing the given text
|
|
924
|
+
*/
|
|
925
|
+
constructor(file_name: string, source_text: string);
|
|
926
|
+
/**
|
|
927
|
+
* Get the end position (length of text)
|
|
928
|
+
*/
|
|
929
|
+
readonly end: number;
|
|
930
|
+
/**
|
|
931
|
+
* Get the file name
|
|
932
|
+
*/
|
|
933
|
+
readonly fileName: string;
|
|
934
|
+
/**
|
|
935
|
+
* Check if this is a declaration file
|
|
936
|
+
*/
|
|
937
|
+
readonly isDeclarationFile: boolean;
|
|
938
|
+
/**
|
|
939
|
+
* Get the kind (always `SourceFile`)
|
|
940
|
+
*/
|
|
941
|
+
readonly kind: number;
|
|
942
|
+
/**
|
|
943
|
+
* Get the language version
|
|
944
|
+
*/
|
|
945
|
+
readonly languageVersion: ScriptTarget;
|
|
946
|
+
/**
|
|
947
|
+
* Get the start position (always 0)
|
|
948
|
+
*/
|
|
949
|
+
readonly pos: number;
|
|
950
|
+
/**
|
|
951
|
+
* Get the script kind
|
|
952
|
+
*/
|
|
953
|
+
readonly scriptKind: ScriptKind;
|
|
954
|
+
/**
|
|
955
|
+
* Get the source text
|
|
956
|
+
*/
|
|
957
|
+
readonly text: string;
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
/**
|
|
961
|
+
* TypeScript Symbol - represents a named entity
|
|
962
|
+
*
|
|
963
|
+
* Symbols have:
|
|
964
|
+
* - name (escaped name for identifiers)
|
|
965
|
+
* - flags (`SymbolFlags` bits)
|
|
966
|
+
* - declarations (AST nodes where declared)
|
|
967
|
+
* - value declaration (primary declaration)
|
|
968
|
+
*/
|
|
969
|
+
export class TsSymbol {
|
|
970
|
+
free(): void;
|
|
971
|
+
[Symbol.dispose](): void;
|
|
972
|
+
/**
|
|
973
|
+
* r" Check if this is an alias (import) symbol
|
|
974
|
+
*/
|
|
975
|
+
isAlias(): boolean;
|
|
976
|
+
/**
|
|
977
|
+
* r" Check if this is a class symbol
|
|
978
|
+
*/
|
|
979
|
+
isClass(): boolean;
|
|
980
|
+
/**
|
|
981
|
+
* r" Check if this is an enum symbol
|
|
982
|
+
*/
|
|
983
|
+
isEnum(): boolean;
|
|
984
|
+
/**
|
|
985
|
+
* r" Check if this is a function symbol
|
|
986
|
+
*/
|
|
987
|
+
isFunction(): boolean;
|
|
988
|
+
/**
|
|
989
|
+
* r" Check if this is an interface symbol
|
|
990
|
+
*/
|
|
991
|
+
isInterface(): boolean;
|
|
992
|
+
/**
|
|
993
|
+
* r" Check if this is a method symbol
|
|
994
|
+
*/
|
|
995
|
+
isMethod(): boolean;
|
|
996
|
+
/**
|
|
997
|
+
* r" Check if this symbol is optional
|
|
998
|
+
*/
|
|
999
|
+
isOptional(): boolean;
|
|
1000
|
+
/**
|
|
1001
|
+
* r" Check if this is a property symbol
|
|
1002
|
+
*/
|
|
1003
|
+
isProperty(): boolean;
|
|
1004
|
+
/**
|
|
1005
|
+
* r" Check if this is a type alias symbol
|
|
1006
|
+
*/
|
|
1007
|
+
isTypeAlias(): boolean;
|
|
1008
|
+
/**
|
|
1009
|
+
* r" Check if this is a type parameter symbol
|
|
1010
|
+
*/
|
|
1011
|
+
isTypeParameter(): boolean;
|
|
1012
|
+
/**
|
|
1013
|
+
* r" Check if this is a variable symbol
|
|
1014
|
+
*/
|
|
1015
|
+
isVariable(): boolean;
|
|
1016
|
+
/**
|
|
1017
|
+
* Create a new symbol wrapper
|
|
1018
|
+
*/
|
|
1019
|
+
constructor(handle: number, flags: number, name: string);
|
|
1020
|
+
/**
|
|
1021
|
+
* Get escaped name (same as name for most identifiers)
|
|
1022
|
+
*/
|
|
1023
|
+
readonly escapedName: string;
|
|
1024
|
+
/**
|
|
1025
|
+
* Get symbol flags
|
|
1026
|
+
*/
|
|
1027
|
+
readonly flags: number;
|
|
1028
|
+
/**
|
|
1029
|
+
* Get the symbol handle
|
|
1030
|
+
*/
|
|
1031
|
+
readonly handle: number;
|
|
1032
|
+
/**
|
|
1033
|
+
* Get symbol name
|
|
1034
|
+
*/
|
|
1035
|
+
readonly name: string;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
/**
|
|
1039
|
+
* TypeScript Type - represents a type in the type system
|
|
1040
|
+
*
|
|
1041
|
+
* Types are identified by handles (`TypeId`) and have:
|
|
1042
|
+
* - flags (`TypeFlags` bits)
|
|
1043
|
+
* - optional symbol
|
|
1044
|
+
* - various type-specific properties
|
|
1045
|
+
*/
|
|
1046
|
+
export class TsType {
|
|
1047
|
+
free(): void;
|
|
1048
|
+
[Symbol.dispose](): void;
|
|
1049
|
+
/**
|
|
1050
|
+
* r" Check if this is `any` type
|
|
1051
|
+
*/
|
|
1052
|
+
isAny(): boolean;
|
|
1053
|
+
/**
|
|
1054
|
+
* r" Check if this is `boolean` type
|
|
1055
|
+
*/
|
|
1056
|
+
isBoolean(): boolean;
|
|
1057
|
+
/**
|
|
1058
|
+
* Check if this type is a class or interface
|
|
1059
|
+
*/
|
|
1060
|
+
isClassOrInterface(): boolean;
|
|
1061
|
+
/**
|
|
1062
|
+
* r" Check if this is an intersection type
|
|
1063
|
+
*/
|
|
1064
|
+
isIntersection(): boolean;
|
|
1065
|
+
/**
|
|
1066
|
+
* Check if this is a literal type
|
|
1067
|
+
*/
|
|
1068
|
+
isLiteral(): boolean;
|
|
1069
|
+
/**
|
|
1070
|
+
* r" Check if this is `never` type
|
|
1071
|
+
*/
|
|
1072
|
+
isNever(): boolean;
|
|
1073
|
+
/**
|
|
1074
|
+
* r" Check if this is `null` type
|
|
1075
|
+
*/
|
|
1076
|
+
isNull(): boolean;
|
|
1077
|
+
/**
|
|
1078
|
+
* r" Check if this is `number` type
|
|
1079
|
+
*/
|
|
1080
|
+
isNumber(): boolean;
|
|
1081
|
+
/**
|
|
1082
|
+
* r" Check if this is a number literal type
|
|
1083
|
+
*/
|
|
1084
|
+
isNumberLiteral(): boolean;
|
|
1085
|
+
/**
|
|
1086
|
+
* r" Check if this is an object type
|
|
1087
|
+
*/
|
|
1088
|
+
isObject(): boolean;
|
|
1089
|
+
/**
|
|
1090
|
+
* r" Check if this is `string` type
|
|
1091
|
+
*/
|
|
1092
|
+
isString(): boolean;
|
|
1093
|
+
/**
|
|
1094
|
+
* r" Check if this is a string literal type
|
|
1095
|
+
*/
|
|
1096
|
+
isStringLiteral(): boolean;
|
|
1097
|
+
/**
|
|
1098
|
+
* r" Check if this is a type parameter
|
|
1099
|
+
*/
|
|
1100
|
+
isTypeParameter(): boolean;
|
|
1101
|
+
/**
|
|
1102
|
+
* r" Check if this is `undefined` type
|
|
1103
|
+
*/
|
|
1104
|
+
isUndefined(): boolean;
|
|
1105
|
+
/**
|
|
1106
|
+
* r" Check if this is a union type
|
|
1107
|
+
*/
|
|
1108
|
+
isUnion(): boolean;
|
|
1109
|
+
/**
|
|
1110
|
+
* Check if this is a union or intersection
|
|
1111
|
+
*/
|
|
1112
|
+
isUnionOrIntersection(): boolean;
|
|
1113
|
+
/**
|
|
1114
|
+
* r" Check if this is `unknown` type
|
|
1115
|
+
*/
|
|
1116
|
+
isUnknown(): boolean;
|
|
1117
|
+
/**
|
|
1118
|
+
* r" Check if this is `void` type
|
|
1119
|
+
*/
|
|
1120
|
+
isVoid(): boolean;
|
|
1121
|
+
/**
|
|
1122
|
+
* Create a new type wrapper
|
|
1123
|
+
*/
|
|
1124
|
+
constructor(handle: number, flags: number);
|
|
1125
|
+
/**
|
|
1126
|
+
* Get type flags
|
|
1127
|
+
*/
|
|
1128
|
+
readonly flags: number;
|
|
1129
|
+
/**
|
|
1130
|
+
* Get the type handle
|
|
1131
|
+
*/
|
|
1132
|
+
readonly handle: number;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
/**
|
|
1136
|
+
* TypeScript `TypeChecker` - provides type information
|
|
1137
|
+
*
|
|
1138
|
+
* The type checker is the primary interface for querying type information
|
|
1139
|
+
* from a program. It provides methods like:
|
|
1140
|
+
* - `getTypeAtLocation(node)` - Get the type of an AST node
|
|
1141
|
+
* - `getSymbolAtLocation(node)` - Get the symbol for an identifier
|
|
1142
|
+
* - `typeToString(type)` - Format a type for display
|
|
1143
|
+
* - `isTypeAssignableTo(source, target)` - Check assignability
|
|
1144
|
+
*/
|
|
1145
|
+
export class TsTypeChecker {
|
|
1146
|
+
private constructor();
|
|
1147
|
+
free(): void;
|
|
1148
|
+
[Symbol.dispose](): void;
|
|
1149
|
+
/**
|
|
1150
|
+
* r" Get the `any` type
|
|
1151
|
+
*/
|
|
1152
|
+
getAnyType(): number;
|
|
1153
|
+
/**
|
|
1154
|
+
* Get the apparent type (handles widening, etc.)
|
|
1155
|
+
*/
|
|
1156
|
+
getApparentType(type_handle: number): number;
|
|
1157
|
+
/**
|
|
1158
|
+
* Get base types (for classes/interfaces)
|
|
1159
|
+
*/
|
|
1160
|
+
getBaseTypes(_type_handle: number): Uint32Array;
|
|
1161
|
+
/**
|
|
1162
|
+
* r" Get the `boolean` type
|
|
1163
|
+
*/
|
|
1164
|
+
getBooleanType(): number;
|
|
1165
|
+
/**
|
|
1166
|
+
* Get the declared type of a symbol
|
|
1167
|
+
*/
|
|
1168
|
+
getDeclaredTypeOfSymbol(_symbol_handle: number): number;
|
|
1169
|
+
/**
|
|
1170
|
+
* r" Get the `false` literal type
|
|
1171
|
+
*/
|
|
1172
|
+
getFalseType(): number;
|
|
1173
|
+
/**
|
|
1174
|
+
* Get the fully qualified name of a symbol
|
|
1175
|
+
*/
|
|
1176
|
+
getFullyQualifiedName(_symbol_handle: number): string;
|
|
1177
|
+
/**
|
|
1178
|
+
* r" Get the `never` type
|
|
1179
|
+
*/
|
|
1180
|
+
getNeverType(): number;
|
|
1181
|
+
/**
|
|
1182
|
+
* r" Get the `null` type
|
|
1183
|
+
*/
|
|
1184
|
+
getNullType(): number;
|
|
1185
|
+
/**
|
|
1186
|
+
* r" Get the `number` type
|
|
1187
|
+
*/
|
|
1188
|
+
getNumberType(): number;
|
|
1189
|
+
/**
|
|
1190
|
+
* Get properties of a type
|
|
1191
|
+
*
|
|
1192
|
+
* Returns handles to symbol objects
|
|
1193
|
+
*/
|
|
1194
|
+
getPropertiesOfType(_type_handle: number): Uint32Array;
|
|
1195
|
+
/**
|
|
1196
|
+
* Get a specific property of a type by name
|
|
1197
|
+
*/
|
|
1198
|
+
getPropertyOfType(_type_handle: number, _property_name: string): number | undefined;
|
|
1199
|
+
/**
|
|
1200
|
+
* Get return type of a signature
|
|
1201
|
+
*/
|
|
1202
|
+
getReturnTypeOfSignature(_signature_handle: number): number;
|
|
1203
|
+
/**
|
|
1204
|
+
* Get call signatures of a type
|
|
1205
|
+
*/
|
|
1206
|
+
getSignaturesOfType(_type_handle: number, _kind: SignatureKind): Uint32Array;
|
|
1207
|
+
/**
|
|
1208
|
+
* r" Get the `string` type
|
|
1209
|
+
*/
|
|
1210
|
+
getStringType(): number;
|
|
1211
|
+
/**
|
|
1212
|
+
* Get the symbol at a specific AST node location
|
|
1213
|
+
*
|
|
1214
|
+
* # Arguments
|
|
1215
|
+
* * `node_handle` - Handle (index) of the AST node
|
|
1216
|
+
*
|
|
1217
|
+
* # Returns
|
|
1218
|
+
* Handle (ID) of the symbol, or `u32::MAX` if none
|
|
1219
|
+
*/
|
|
1220
|
+
getSymbolAtLocation(_node_handle: number): number;
|
|
1221
|
+
/**
|
|
1222
|
+
* Get symbol flags
|
|
1223
|
+
*/
|
|
1224
|
+
getSymbolFlags(_symbol_handle: number): number;
|
|
1225
|
+
/**
|
|
1226
|
+
* r" Get the `true` literal type
|
|
1227
|
+
*/
|
|
1228
|
+
getTrueType(): number;
|
|
1229
|
+
/**
|
|
1230
|
+
* Get the type at a specific AST node location
|
|
1231
|
+
*
|
|
1232
|
+
* # Arguments
|
|
1233
|
+
* * `node_handle` - Handle (index) of the AST node
|
|
1234
|
+
*
|
|
1235
|
+
* # Returns
|
|
1236
|
+
* Handle (ID) of the type, or 0 for error type
|
|
1237
|
+
*/
|
|
1238
|
+
getTypeAtLocation(_node_handle: number): number;
|
|
1239
|
+
/**
|
|
1240
|
+
* Get type flags
|
|
1241
|
+
*/
|
|
1242
|
+
getTypeFlags(type_handle: number): number;
|
|
1243
|
+
/**
|
|
1244
|
+
* Get the type of a symbol
|
|
1245
|
+
*/
|
|
1246
|
+
getTypeOfSymbol(_symbol_handle: number): number;
|
|
1247
|
+
/**
|
|
1248
|
+
* r" Get the `undefined` type
|
|
1249
|
+
*/
|
|
1250
|
+
getUndefinedType(): number;
|
|
1251
|
+
/**
|
|
1252
|
+
* r" Get the `unknown` type
|
|
1253
|
+
*/
|
|
1254
|
+
getUnknownType(): number;
|
|
1255
|
+
/**
|
|
1256
|
+
* r" Get the `void` type
|
|
1257
|
+
*/
|
|
1258
|
+
getVoidType(): number;
|
|
1259
|
+
/**
|
|
1260
|
+
* Check if type is an array type
|
|
1261
|
+
*/
|
|
1262
|
+
isArrayType(_type_handle: number): boolean;
|
|
1263
|
+
/**
|
|
1264
|
+
* Check if type is an intersection type
|
|
1265
|
+
*/
|
|
1266
|
+
isIntersectionType(_type_handle: number): boolean;
|
|
1267
|
+
/**
|
|
1268
|
+
* Check if type is nullable (includes null or undefined)
|
|
1269
|
+
*/
|
|
1270
|
+
isNullableType(type_handle: number): boolean;
|
|
1271
|
+
/**
|
|
1272
|
+
* Check if type is a tuple type
|
|
1273
|
+
*/
|
|
1274
|
+
isTupleType(_type_handle: number): boolean;
|
|
1275
|
+
/**
|
|
1276
|
+
* Check if source type is assignable to target type
|
|
1277
|
+
*/
|
|
1278
|
+
isTypeAssignableTo(source: number, target: number): boolean;
|
|
1279
|
+
/**
|
|
1280
|
+
* Check if type is a type parameter
|
|
1281
|
+
*/
|
|
1282
|
+
isTypeParameter(_type_handle: number): boolean;
|
|
1283
|
+
/**
|
|
1284
|
+
* Check if type is a union type
|
|
1285
|
+
*/
|
|
1286
|
+
isUnionType(_type_handle: number): boolean;
|
|
1287
|
+
/**
|
|
1288
|
+
* Format a symbol as a string
|
|
1289
|
+
*/
|
|
1290
|
+
symbolToString(_symbol_handle: number): string;
|
|
1291
|
+
/**
|
|
1292
|
+
* Format a type as a string
|
|
1293
|
+
*/
|
|
1294
|
+
typeToString(type_handle: number): string;
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
/**
|
|
1298
|
+
* Parallel type checker using the shared `TypeInterner`.
|
|
1299
|
+
*
|
|
1300
|
+
* This enables parallel type checking of function bodies across multiple files
|
|
1301
|
+
* while sharing a single type interner for deduplication.
|
|
1302
|
+
*/
|
|
1303
|
+
export class WasmParallelChecker {
|
|
1304
|
+
free(): void;
|
|
1305
|
+
[Symbol.dispose](): void;
|
|
1306
|
+
/**
|
|
1307
|
+
* Add a file to be checked.
|
|
1308
|
+
*/
|
|
1309
|
+
addFile(file_name: string, source_text: string): void;
|
|
1310
|
+
/**
|
|
1311
|
+
* Compile and check all files in parallel.
|
|
1312
|
+
*
|
|
1313
|
+
* This performs:
|
|
1314
|
+
* 1. Parallel parsing of all files
|
|
1315
|
+
* 2. Parallel binding to create symbols
|
|
1316
|
+
* 3. Sequential merging of symbol tables
|
|
1317
|
+
* 4. Parallel type checking of function bodies
|
|
1318
|
+
*
|
|
1319
|
+
* This function catches panics to prevent WASM crashes.
|
|
1320
|
+
*/
|
|
1321
|
+
checkAll(): any;
|
|
1322
|
+
/**
|
|
1323
|
+
* Clear all files.
|
|
1324
|
+
*/
|
|
1325
|
+
clear(): void;
|
|
1326
|
+
/**
|
|
1327
|
+
* Get the number of files added.
|
|
1328
|
+
*/
|
|
1329
|
+
getFileCount(): number;
|
|
1330
|
+
/**
|
|
1331
|
+
* Create a new parallel checker.
|
|
1332
|
+
*/
|
|
1333
|
+
constructor();
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
/**
|
|
1337
|
+
* Parallel file parser using rayon's work-stealing scheduler.
|
|
1338
|
+
*
|
|
1339
|
+
* This provides high-performance parallel parsing of multiple TypeScript files.
|
|
1340
|
+
* Each file is parsed independently, producing its own AST arena.
|
|
1341
|
+
*/
|
|
1342
|
+
export class WasmParallelParser {
|
|
1343
|
+
free(): void;
|
|
1344
|
+
[Symbol.dispose](): void;
|
|
1345
|
+
/**
|
|
1346
|
+
* Add a file to be parsed.
|
|
1347
|
+
*/
|
|
1348
|
+
addFile(file_name: string, source_text: string): void;
|
|
1349
|
+
/**
|
|
1350
|
+
* Clear all files.
|
|
1351
|
+
*/
|
|
1352
|
+
clear(): void;
|
|
1353
|
+
/**
|
|
1354
|
+
* Get the number of files added.
|
|
1355
|
+
*/
|
|
1356
|
+
getFileCount(): number;
|
|
1357
|
+
/**
|
|
1358
|
+
* Create a new parallel parser.
|
|
1359
|
+
*/
|
|
1360
|
+
constructor();
|
|
1361
|
+
/**
|
|
1362
|
+
* Parse all files in parallel and return statistics.
|
|
1363
|
+
*
|
|
1364
|
+
* This function catches panics to prevent WASM crashes.
|
|
1365
|
+
*/
|
|
1366
|
+
parseAll(): any;
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
/**
|
|
1370
|
+
* Multi-file TypeScript program for cross-file type checking.
|
|
1371
|
+
*
|
|
1372
|
+
* This struct provides an API for compiling multiple TypeScript files together,
|
|
1373
|
+
* enabling proper module resolution and cross-file type checking.
|
|
1374
|
+
*
|
|
1375
|
+
* # Example (JavaScript)
|
|
1376
|
+
* ```javascript
|
|
1377
|
+
* const program = new WasmProgram();
|
|
1378
|
+
* program.addFile("a.ts", "export const x = 1;");
|
|
1379
|
+
* program.addFile("b.ts", "import { x } from './a'; const y = x + 1;");
|
|
1380
|
+
* const result = program.checkAll();
|
|
1381
|
+
* console.log(result);
|
|
1382
|
+
* ```
|
|
1383
|
+
*/
|
|
1384
|
+
export class WasmProgram {
|
|
1385
|
+
free(): void;
|
|
1386
|
+
[Symbol.dispose](): void;
|
|
1387
|
+
/**
|
|
1388
|
+
* Add a file to the program.
|
|
1389
|
+
*
|
|
1390
|
+
* Files are accumulated and compiled together when `checkAll` is called.
|
|
1391
|
+
* The `file_name` should be a relative path like "src/a.ts".
|
|
1392
|
+
*
|
|
1393
|
+
* For TypeScript library files (lib.d.ts, lib.dom.d.ts, etc.), use `addLibFile` instead.
|
|
1394
|
+
*/
|
|
1395
|
+
addFile(file_name: string, source_text: string): void;
|
|
1396
|
+
/**
|
|
1397
|
+
* Add a TypeScript library file (lib.d.ts, lib.dom.d.ts, etc.) to the program.
|
|
1398
|
+
*
|
|
1399
|
+
* Lib files are used for global symbol resolution and are merged into
|
|
1400
|
+
* the symbol table before user files are processed.
|
|
1401
|
+
*
|
|
1402
|
+
* Use this method explicitly instead of relying on automatic file name detection.
|
|
1403
|
+
* This makes the API behavior predictable and explicit.
|
|
1404
|
+
*
|
|
1405
|
+
* # Example (JavaScript)
|
|
1406
|
+
* ```javascript
|
|
1407
|
+
* const program = new WasmProgram();
|
|
1408
|
+
* program.addLibFile("lib.d.ts", libContent);
|
|
1409
|
+
* program.addFile("src/a.ts", userCode);
|
|
1410
|
+
* ```
|
|
1411
|
+
*/
|
|
1412
|
+
addLibFile(file_name: string, source_text: string): void;
|
|
1413
|
+
/**
|
|
1414
|
+
* Compile all files and return diagnostics as JSON.
|
|
1415
|
+
*
|
|
1416
|
+
* This performs:
|
|
1417
|
+
* 1. Load lib files for global symbol resolution
|
|
1418
|
+
* 2. Parallel parsing of all files
|
|
1419
|
+
* 3. Parallel binding of all files with lib symbols merged
|
|
1420
|
+
* 4. Symbol merging (sequential)
|
|
1421
|
+
* 5. Parallel type checking
|
|
1422
|
+
*
|
|
1423
|
+
* Returns a JSON object with diagnostics per file.
|
|
1424
|
+
*/
|
|
1425
|
+
checkAll(): string;
|
|
1426
|
+
/**
|
|
1427
|
+
* Clear all files and reset the program state.
|
|
1428
|
+
*/
|
|
1429
|
+
clear(): void;
|
|
1430
|
+
/**
|
|
1431
|
+
* Get all diagnostic codes as a flat array (for simple conformance comparison).
|
|
1432
|
+
*
|
|
1433
|
+
* This combines all parse and check diagnostics from all files into a single
|
|
1434
|
+
* array of error codes, which can be compared against tsc output.
|
|
1435
|
+
*/
|
|
1436
|
+
getAllDiagnosticCodes(): Uint32Array;
|
|
1437
|
+
/**
|
|
1438
|
+
* Get diagnostic codes for all files (for conformance testing).
|
|
1439
|
+
*
|
|
1440
|
+
* Returns a JSON object mapping file names to arrays of error codes.
|
|
1441
|
+
*/
|
|
1442
|
+
getDiagnosticCodes(): string;
|
|
1443
|
+
/**
|
|
1444
|
+
* Get the number of files in the program.
|
|
1445
|
+
*/
|
|
1446
|
+
getFileCount(): number;
|
|
1447
|
+
/**
|
|
1448
|
+
* Create a new empty program.
|
|
1449
|
+
*/
|
|
1450
|
+
constructor();
|
|
1451
|
+
/**
|
|
1452
|
+
* Set compiler options from JSON.
|
|
1453
|
+
*
|
|
1454
|
+
* # Arguments
|
|
1455
|
+
* * `options_json` - JSON string containing compiler options
|
|
1456
|
+
*/
|
|
1457
|
+
setCompilerOptions(options_json: string): void;
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
/**
|
|
1461
|
+
* Opaque wrapper for transform directives across the wasm boundary.
|
|
1462
|
+
*/
|
|
1463
|
+
export class WasmTransformContext {
|
|
1464
|
+
private constructor();
|
|
1465
|
+
free(): void;
|
|
1466
|
+
[Symbol.dispose](): void;
|
|
1467
|
+
/**
|
|
1468
|
+
* Get the number of transform directives generated.
|
|
1469
|
+
*/
|
|
1470
|
+
getCount(): number;
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
/**
|
|
1474
|
+
* WASM-compatible type interner for parallel type checking.
|
|
1475
|
+
*
|
|
1476
|
+
* This wraps the internal `TypeInterner` with a `wasm-bindgen` compatible interface.
|
|
1477
|
+
* The underlying interner uses lock-free `DashMap` storage for concurrent access.
|
|
1478
|
+
*/
|
|
1479
|
+
export class WasmTypeInterner {
|
|
1480
|
+
free(): void;
|
|
1481
|
+
[Symbol.dispose](): void;
|
|
1482
|
+
/**
|
|
1483
|
+
* Get the number of interned types.
|
|
1484
|
+
*/
|
|
1485
|
+
getTypeCount(): number;
|
|
1486
|
+
/**
|
|
1487
|
+
* Intern a string and return its atom ID.
|
|
1488
|
+
*/
|
|
1489
|
+
internString(s: string): number;
|
|
1490
|
+
/**
|
|
1491
|
+
* Check if the interner is empty (only has intrinsics).
|
|
1492
|
+
*/
|
|
1493
|
+
isEmpty(): boolean;
|
|
1494
|
+
/**
|
|
1495
|
+
* Create a new type interner with pre-registered intrinsics.
|
|
1496
|
+
*/
|
|
1497
|
+
constructor();
|
|
1498
|
+
/**
|
|
1499
|
+
* Resolve an atom ID back to its string value.
|
|
1500
|
+
*/
|
|
1501
|
+
resolveAtom(atom_id: number): string;
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
/**
|
|
1505
|
+
* Compare two strings using a case-insensitive ordinal comparison.
|
|
1506
|
+
*
|
|
1507
|
+
* Case-insensitive comparisons compare both strings one code-point at a time using
|
|
1508
|
+
* the integer value of each code-point after applying `to_uppercase` to each string.
|
|
1509
|
+
* We always map both strings to their upper-case form as some unicode characters do
|
|
1510
|
+
* not properly round-trip to lowercase (such as `ẞ` German sharp capital s).
|
|
1511
|
+
*/
|
|
1512
|
+
export function compareStringsCaseInsensitive(a?: string | null, b?: string | null): Comparison;
|
|
1513
|
+
|
|
1514
|
+
/**
|
|
1515
|
+
* Compare two strings using a case-insensitive ordinal comparison (eslint-compatible).
|
|
1516
|
+
*
|
|
1517
|
+
* This uses `to_lowercase` instead of `to_uppercase` to match eslint's `sort-imports`
|
|
1518
|
+
* rule behavior. The difference affects the relative order of letters and ASCII
|
|
1519
|
+
* characters 91-96, of which `_` is a valid identifier character.
|
|
1520
|
+
*/
|
|
1521
|
+
export function compareStringsCaseInsensitiveEslintCompatible(a?: string | null, b?: string | null): Comparison;
|
|
1522
|
+
|
|
1523
|
+
/**
|
|
1524
|
+
* Compare two strings using a case-sensitive ordinal comparison.
|
|
1525
|
+
*
|
|
1526
|
+
* Ordinal comparisons are based on the difference between the unicode code points
|
|
1527
|
+
* of both strings. Characters with multiple unicode representations are considered
|
|
1528
|
+
* unequal. Ordinal comparisons provide predictable ordering, but place "a" after "B".
|
|
1529
|
+
*/
|
|
1530
|
+
export function compareStringsCaseSensitive(a?: string | null, b?: string | null): Comparison;
|
|
1531
|
+
|
|
1532
|
+
/**
|
|
1533
|
+
* r" Create the `any` type
|
|
1534
|
+
*/
|
|
1535
|
+
export function createAnyType(): TsType;
|
|
1536
|
+
|
|
1537
|
+
/**
|
|
1538
|
+
* r" Create the `boolean` type
|
|
1539
|
+
*/
|
|
1540
|
+
export function createBooleanType(): TsType;
|
|
1541
|
+
|
|
1542
|
+
/**
|
|
1543
|
+
* Create a language service for a file
|
|
1544
|
+
*/
|
|
1545
|
+
export function createLanguageService(file_name: string, source_text: string): TsLanguageService;
|
|
1546
|
+
|
|
1547
|
+
/**
|
|
1548
|
+
* r" Create the `never` type
|
|
1549
|
+
*/
|
|
1550
|
+
export function createNeverType(): TsType;
|
|
1551
|
+
|
|
1552
|
+
/**
|
|
1553
|
+
* r" Create the `null` type
|
|
1554
|
+
*/
|
|
1555
|
+
export function createNullType(): TsType;
|
|
1556
|
+
|
|
1557
|
+
/**
|
|
1558
|
+
* r" Create the `number` type
|
|
1559
|
+
*/
|
|
1560
|
+
export function createNumberType(): TsType;
|
|
1561
|
+
|
|
1562
|
+
/**
|
|
1563
|
+
* Create a new Parser for the given source text.
|
|
1564
|
+
* This is the recommended parser for production use.
|
|
1565
|
+
*/
|
|
1566
|
+
export function createParser(file_name: string, source_text: string): Parser;
|
|
1567
|
+
|
|
1568
|
+
/**
|
|
1569
|
+
* Create a new multi-file program.
|
|
1570
|
+
*/
|
|
1571
|
+
export function createProgram(): WasmProgram;
|
|
1572
|
+
|
|
1573
|
+
/**
|
|
1574
|
+
* Create a new scanner for the given source text.
|
|
1575
|
+
* This is the wasm-bindgen entry point for creating scanners from JavaScript.
|
|
1576
|
+
*/
|
|
1577
|
+
export function createScanner(text: string, skip_trivia: boolean): ScannerState;
|
|
1578
|
+
|
|
1579
|
+
/**
|
|
1580
|
+
* Create a source file (parse only, no binding)
|
|
1581
|
+
*
|
|
1582
|
+
* This is a lightweight way to parse a file without full program creation.
|
|
1583
|
+
*/
|
|
1584
|
+
export function createSourceFile(file_name: string, source_text: string, _target?: number | null): TsSourceFile;
|
|
1585
|
+
|
|
1586
|
+
/**
|
|
1587
|
+
* r" Create the `string` type
|
|
1588
|
+
*/
|
|
1589
|
+
export function createStringType(): TsType;
|
|
1590
|
+
|
|
1591
|
+
/**
|
|
1592
|
+
* Create a TypeScript program (factory function)
|
|
1593
|
+
*
|
|
1594
|
+
* This is the main entry point for creating a program.
|
|
1595
|
+
*
|
|
1596
|
+
* # Arguments
|
|
1597
|
+
* * `root_names_json` - JSON array of file names
|
|
1598
|
+
* * `options_json` - JSON object with compiler options
|
|
1599
|
+
* * `files_json` - JSON object mapping file names to content
|
|
1600
|
+
*
|
|
1601
|
+
* # Returns
|
|
1602
|
+
* A new `TsProgram` instance
|
|
1603
|
+
*/
|
|
1604
|
+
export function createTsProgram(root_names_json: string, options_json: string, files_json: string): TsProgram;
|
|
1605
|
+
|
|
1606
|
+
/**
|
|
1607
|
+
* Create a source file (factory function)
|
|
1608
|
+
*/
|
|
1609
|
+
export function createTsSourceFile(file_name: string, source_text: string, language_version: ScriptTarget): TsSourceFile;
|
|
1610
|
+
|
|
1611
|
+
/**
|
|
1612
|
+
* r" Create the `undefined` type
|
|
1613
|
+
*/
|
|
1614
|
+
export function createUndefinedType(): TsType;
|
|
1615
|
+
|
|
1616
|
+
/**
|
|
1617
|
+
* r" Create the `unknown` type
|
|
1618
|
+
*/
|
|
1619
|
+
export function createUnknownType(): TsType;
|
|
1620
|
+
|
|
1621
|
+
/**
|
|
1622
|
+
* r" Create the `void` type
|
|
1623
|
+
*/
|
|
1624
|
+
export function createVoidType(): TsType;
|
|
1625
|
+
|
|
1626
|
+
/**
|
|
1627
|
+
* Get diagnostic category name
|
|
1628
|
+
*/
|
|
1629
|
+
export function diagnosticCategoryName(category: DiagnosticCategory): string;
|
|
1630
|
+
|
|
1631
|
+
/**
|
|
1632
|
+
* Ensures a path has a trailing directory separator.
|
|
1633
|
+
*/
|
|
1634
|
+
export function ensureTrailingDirectorySeparator(path: string): string;
|
|
1635
|
+
|
|
1636
|
+
/**
|
|
1637
|
+
* Check if two strings are equal (case-insensitive).
|
|
1638
|
+
* Uses iterator-based comparison to avoid allocating new strings.
|
|
1639
|
+
*/
|
|
1640
|
+
export function equateStringsCaseInsensitive(a: string, b: string): boolean;
|
|
1641
|
+
|
|
1642
|
+
/**
|
|
1643
|
+
* Check if two strings are equal (case-sensitive).
|
|
1644
|
+
*/
|
|
1645
|
+
export function equateStringsCaseSensitive(a: string, b: string): boolean;
|
|
1646
|
+
|
|
1647
|
+
/**
|
|
1648
|
+
* Check if path ends with a specific extension.
|
|
1649
|
+
*/
|
|
1650
|
+
export function fileExtensionIs(path: string, extension: string): boolean;
|
|
1651
|
+
|
|
1652
|
+
/**
|
|
1653
|
+
* Flatten diagnostic message chain to a single string
|
|
1654
|
+
*
|
|
1655
|
+
* TypeScript diagnostics can have chained messages (messageText can be
|
|
1656
|
+
* a chain). This flattens them to a single string.
|
|
1657
|
+
*/
|
|
1658
|
+
export function flattenDiagnosticMessageText(message_text: string, _new_line: string): string;
|
|
1659
|
+
|
|
1660
|
+
/**
|
|
1661
|
+
* Format a diagnostic to a string
|
|
1662
|
+
*/
|
|
1663
|
+
export function formatDiagnostic(diagnostic_json: string): string;
|
|
1664
|
+
|
|
1665
|
+
/**
|
|
1666
|
+
* Format diagnostics with color and context
|
|
1667
|
+
*/
|
|
1668
|
+
export function formatDiagnosticsWithColorAndContext(diagnostics_json: string, source_text: string): string;
|
|
1669
|
+
|
|
1670
|
+
/**
|
|
1671
|
+
* Format a diagnostic to a string
|
|
1672
|
+
*
|
|
1673
|
+
* Matches TypeScript's `formatDiagnostic` output format.
|
|
1674
|
+
*/
|
|
1675
|
+
export function formatTsDiagnostic(diagnostic: TsDiagnostic, new_line: string): string;
|
|
1676
|
+
|
|
1677
|
+
/**
|
|
1678
|
+
* Format diagnostics with color and context
|
|
1679
|
+
*
|
|
1680
|
+
* Provides pretty-printed output with:
|
|
1681
|
+
* - ANSI colors (if terminal supports it)
|
|
1682
|
+
* - Source code context around the error
|
|
1683
|
+
* - Squiggle underlining
|
|
1684
|
+
*/
|
|
1685
|
+
export function formatTsDiagnosticsWithColorAndContext(diagnostics_json: string, source_files_json: string, use_colors: boolean): string;
|
|
1686
|
+
|
|
1687
|
+
/**
|
|
1688
|
+
* Returns the path except for its containing directory name (basename).
|
|
1689
|
+
* Uses char-based operations for UTF-8 safety.
|
|
1690
|
+
*/
|
|
1691
|
+
export function getBaseFileName(path: string): string;
|
|
1692
|
+
|
|
1693
|
+
/**
|
|
1694
|
+
* Get the operator precedence for a binary operator
|
|
1695
|
+
*/
|
|
1696
|
+
export function getOperatorPrecedence(operator_kind: number): number;
|
|
1697
|
+
|
|
1698
|
+
/**
|
|
1699
|
+
* Get the tsz version
|
|
1700
|
+
*/
|
|
1701
|
+
export function getTszVersion(): string;
|
|
1702
|
+
|
|
1703
|
+
/**
|
|
1704
|
+
* Get the TypeScript version this is compatible with
|
|
1705
|
+
*/
|
|
1706
|
+
export function getTypeScriptVersion(): string;
|
|
1707
|
+
|
|
1708
|
+
/**
|
|
1709
|
+
* Determines whether a path has an extension.
|
|
1710
|
+
*/
|
|
1711
|
+
export function hasExtension(file_name: string): boolean;
|
|
1712
|
+
|
|
1713
|
+
/**
|
|
1714
|
+
* Determines whether a path has a trailing separator (`/` or `\\`).
|
|
1715
|
+
*/
|
|
1716
|
+
export function hasTrailingDirectorySeparator(path: string): boolean;
|
|
1717
|
+
|
|
1718
|
+
/**
|
|
1719
|
+
* Check if character is an ASCII letter (A-Z, a-z).
|
|
1720
|
+
*/
|
|
1721
|
+
export function isASCIILetter(ch: number): boolean;
|
|
1722
|
+
|
|
1723
|
+
/**
|
|
1724
|
+
* Determines whether a charCode corresponds to `/` or `\`.
|
|
1725
|
+
*/
|
|
1726
|
+
export function isAnyDirectorySeparator(char_code: number): boolean;
|
|
1727
|
+
|
|
1728
|
+
/**
|
|
1729
|
+
* r" Check if node is an array type
|
|
1730
|
+
*/
|
|
1731
|
+
export function isArrayTypeNode(kind: number): boolean;
|
|
1732
|
+
|
|
1733
|
+
/**
|
|
1734
|
+
* r" Check if node is an arrow function
|
|
1735
|
+
*/
|
|
1736
|
+
export function isArrowFunction(kind: number): boolean;
|
|
1737
|
+
|
|
1738
|
+
/**
|
|
1739
|
+
* r" Check if node is a binary expression
|
|
1740
|
+
*/
|
|
1741
|
+
export function isBinaryExpression(kind: number): boolean;
|
|
1742
|
+
|
|
1743
|
+
/**
|
|
1744
|
+
* r" Check if node is a block
|
|
1745
|
+
*/
|
|
1746
|
+
export function isBlock(kind: number): boolean;
|
|
1747
|
+
|
|
1748
|
+
/**
|
|
1749
|
+
* r" Check if node is a call expression
|
|
1750
|
+
*/
|
|
1751
|
+
export function isCallExpression(kind: number): boolean;
|
|
1752
|
+
|
|
1753
|
+
/**
|
|
1754
|
+
* r" Check if node is a class declaration
|
|
1755
|
+
*/
|
|
1756
|
+
export function isClassDeclaration(kind: number): boolean;
|
|
1757
|
+
|
|
1758
|
+
/**
|
|
1759
|
+
* r" Check if node is a class expression
|
|
1760
|
+
*/
|
|
1761
|
+
export function isClassExpression(kind: number): boolean;
|
|
1762
|
+
|
|
1763
|
+
/**
|
|
1764
|
+
* Check if node is any class-like
|
|
1765
|
+
*/
|
|
1766
|
+
export function isClassLike(kind: number): boolean;
|
|
1767
|
+
|
|
1768
|
+
/**
|
|
1769
|
+
* r" Check if node is a constructor
|
|
1770
|
+
*/
|
|
1771
|
+
export function isConstructorDeclaration(kind: number): boolean;
|
|
1772
|
+
|
|
1773
|
+
/**
|
|
1774
|
+
* Check if node is a declaration
|
|
1775
|
+
*/
|
|
1776
|
+
export function isDeclaration(kind: number): boolean;
|
|
1777
|
+
|
|
1778
|
+
/**
|
|
1779
|
+
* Check if character is a decimal digit (0-9).
|
|
1780
|
+
*/
|
|
1781
|
+
export function isDigit(ch: number): boolean;
|
|
1782
|
+
|
|
1783
|
+
/**
|
|
1784
|
+
* r" Check if node is an element access expression
|
|
1785
|
+
*/
|
|
1786
|
+
export function isElementAccessExpression(kind: number): boolean;
|
|
1787
|
+
|
|
1788
|
+
/**
|
|
1789
|
+
* r" Check if node is an enum declaration
|
|
1790
|
+
*/
|
|
1791
|
+
export function isEnumDeclaration(kind: number): boolean;
|
|
1792
|
+
|
|
1793
|
+
/**
|
|
1794
|
+
* r" Check if node is an export declaration
|
|
1795
|
+
*/
|
|
1796
|
+
export function isExportDeclaration(kind: number): boolean;
|
|
1797
|
+
|
|
1798
|
+
/**
|
|
1799
|
+
* Check if node is an expression
|
|
1800
|
+
*/
|
|
1801
|
+
export function isExpression(kind: number): boolean;
|
|
1802
|
+
|
|
1803
|
+
/**
|
|
1804
|
+
* r" Check if node is an expression statement
|
|
1805
|
+
*/
|
|
1806
|
+
export function isExpressionStatement(kind: number): boolean;
|
|
1807
|
+
|
|
1808
|
+
/**
|
|
1809
|
+
* r" Check if node is a for statement
|
|
1810
|
+
*/
|
|
1811
|
+
export function isForStatement(kind: number): boolean;
|
|
1812
|
+
|
|
1813
|
+
/**
|
|
1814
|
+
* r" Check if node is a function declaration
|
|
1815
|
+
*/
|
|
1816
|
+
export function isFunctionDeclaration(kind: number): boolean;
|
|
1817
|
+
|
|
1818
|
+
/**
|
|
1819
|
+
* r" Check if node is a function expression
|
|
1820
|
+
*/
|
|
1821
|
+
export function isFunctionExpression(kind: number): boolean;
|
|
1822
|
+
|
|
1823
|
+
/**
|
|
1824
|
+
* Check if node is any function-like
|
|
1825
|
+
*/
|
|
1826
|
+
export function isFunctionLike(kind: number): boolean;
|
|
1827
|
+
|
|
1828
|
+
/**
|
|
1829
|
+
* Check if character is a hexadecimal digit (0-9, A-F, a-f).
|
|
1830
|
+
*/
|
|
1831
|
+
export function isHexDigit(ch: number): boolean;
|
|
1832
|
+
|
|
1833
|
+
/**
|
|
1834
|
+
* r" Check if node is an identifier
|
|
1835
|
+
*/
|
|
1836
|
+
export function isIdentifier(kind: number): boolean;
|
|
1837
|
+
|
|
1838
|
+
/**
|
|
1839
|
+
* r" Check if node is an if statement
|
|
1840
|
+
*/
|
|
1841
|
+
export function isIfStatement(kind: number): boolean;
|
|
1842
|
+
|
|
1843
|
+
/**
|
|
1844
|
+
* r" Check if node is an import declaration
|
|
1845
|
+
*/
|
|
1846
|
+
export function isImportDeclaration(kind: number): boolean;
|
|
1847
|
+
|
|
1848
|
+
/**
|
|
1849
|
+
* r" Check if node is an interface declaration
|
|
1850
|
+
*/
|
|
1851
|
+
export function isInterfaceDeclaration(kind: number): boolean;
|
|
1852
|
+
|
|
1853
|
+
/**
|
|
1854
|
+
* r" Check if node is an intersection type
|
|
1855
|
+
*/
|
|
1856
|
+
export function isIntersectionTypeNode(kind: number): boolean;
|
|
1857
|
+
|
|
1858
|
+
/**
|
|
1859
|
+
* Check if a kind is a keyword
|
|
1860
|
+
*/
|
|
1861
|
+
export function isKeyword(kind: number): boolean;
|
|
1862
|
+
|
|
1863
|
+
/**
|
|
1864
|
+
* Check if character is a line break (LF, CR, LS, PS).
|
|
1865
|
+
*/
|
|
1866
|
+
export function isLineBreak(ch: number): boolean;
|
|
1867
|
+
|
|
1868
|
+
/**
|
|
1869
|
+
* Check if a kind is a literal expression
|
|
1870
|
+
*/
|
|
1871
|
+
export function isLiteralExpression(kind: number): boolean;
|
|
1872
|
+
|
|
1873
|
+
/**
|
|
1874
|
+
* r" Check if node is a method declaration
|
|
1875
|
+
*/
|
|
1876
|
+
export function isMethodDeclaration(kind: number): boolean;
|
|
1877
|
+
|
|
1878
|
+
/**
|
|
1879
|
+
* r" Check if node is a module/namespace declaration
|
|
1880
|
+
*/
|
|
1881
|
+
export function isModuleDeclaration(kind: number): boolean;
|
|
1882
|
+
|
|
1883
|
+
/**
|
|
1884
|
+
* r" Check if node is a new expression
|
|
1885
|
+
*/
|
|
1886
|
+
export function isNewExpression(kind: number): boolean;
|
|
1887
|
+
|
|
1888
|
+
/**
|
|
1889
|
+
* r" Check if node is a numeric literal
|
|
1890
|
+
*/
|
|
1891
|
+
export function isNumericLiteral(kind: number): boolean;
|
|
1892
|
+
|
|
1893
|
+
/**
|
|
1894
|
+
* Check if character is an octal digit (0-7).
|
|
1895
|
+
*/
|
|
1896
|
+
export function isOctalDigit(ch: number): boolean;
|
|
1897
|
+
|
|
1898
|
+
/**
|
|
1899
|
+
* r" Check if node is a parameter
|
|
1900
|
+
*/
|
|
1901
|
+
export function isParameter(kind: number): boolean;
|
|
1902
|
+
|
|
1903
|
+
/**
|
|
1904
|
+
* r" Check if node is a property access expression
|
|
1905
|
+
*/
|
|
1906
|
+
export function isPropertyAccessExpression(kind: number): boolean;
|
|
1907
|
+
|
|
1908
|
+
/**
|
|
1909
|
+
* r" Check if node is a property declaration
|
|
1910
|
+
*/
|
|
1911
|
+
export function isPropertyDeclaration(kind: number): boolean;
|
|
1912
|
+
|
|
1913
|
+
/**
|
|
1914
|
+
* Check if a kind is a punctuation token
|
|
1915
|
+
*/
|
|
1916
|
+
export function isPunctuation(kind: number): boolean;
|
|
1917
|
+
|
|
1918
|
+
/**
|
|
1919
|
+
* r" Check if node is a return statement
|
|
1920
|
+
*/
|
|
1921
|
+
export function isReturnStatement(kind: number): boolean;
|
|
1922
|
+
|
|
1923
|
+
/**
|
|
1924
|
+
* Check if node is a statement
|
|
1925
|
+
*/
|
|
1926
|
+
export function isStatement(kind: number): boolean;
|
|
1927
|
+
|
|
1928
|
+
/**
|
|
1929
|
+
* r" Check if node is a string literal
|
|
1930
|
+
*/
|
|
1931
|
+
export function isStringLiteral(kind: number): boolean;
|
|
1932
|
+
|
|
1933
|
+
/**
|
|
1934
|
+
* Check if a kind is a template literal token
|
|
1935
|
+
*/
|
|
1936
|
+
export function isTemplateLiteralKind(kind: number): boolean;
|
|
1937
|
+
|
|
1938
|
+
/**
|
|
1939
|
+
* Check if a kind is a trivia (whitespace, comment)
|
|
1940
|
+
*/
|
|
1941
|
+
export function isTrivia(kind: number): boolean;
|
|
1942
|
+
|
|
1943
|
+
/**
|
|
1944
|
+
* r" Check if node is a type alias declaration
|
|
1945
|
+
*/
|
|
1946
|
+
export function isTypeAliasDeclaration(kind: number): boolean;
|
|
1947
|
+
|
|
1948
|
+
/**
|
|
1949
|
+
* r" Check if node is a type reference
|
|
1950
|
+
*/
|
|
1951
|
+
export function isTypeReferenceNode(kind: number): boolean;
|
|
1952
|
+
|
|
1953
|
+
/**
|
|
1954
|
+
* r" Check if node is a union type
|
|
1955
|
+
*/
|
|
1956
|
+
export function isUnionTypeNode(kind: number): boolean;
|
|
1957
|
+
|
|
1958
|
+
/**
|
|
1959
|
+
* r" Check if node is a variable declaration
|
|
1960
|
+
*/
|
|
1961
|
+
export function isVariableDeclaration(kind: number): boolean;
|
|
1962
|
+
|
|
1963
|
+
/**
|
|
1964
|
+
* r" Check if node is a variable statement
|
|
1965
|
+
*/
|
|
1966
|
+
export function isVariableStatement(kind: number): boolean;
|
|
1967
|
+
|
|
1968
|
+
/**
|
|
1969
|
+
* r" Check if node is a while statement
|
|
1970
|
+
*/
|
|
1971
|
+
export function isWhileStatement(kind: number): boolean;
|
|
1972
|
+
|
|
1973
|
+
/**
|
|
1974
|
+
* Check if character is any whitespace (including line breaks).
|
|
1975
|
+
*/
|
|
1976
|
+
export function isWhiteSpaceLike(ch: number): boolean;
|
|
1977
|
+
|
|
1978
|
+
/**
|
|
1979
|
+
* Check if character is a single-line whitespace (not including line breaks).
|
|
1980
|
+
*/
|
|
1981
|
+
export function isWhiteSpaceSingleLine(ch: number): boolean;
|
|
1982
|
+
|
|
1983
|
+
/**
|
|
1984
|
+
* Check if character is a word character (A-Z, a-z, 0-9, _).
|
|
1985
|
+
*/
|
|
1986
|
+
export function isWordCharacter(ch: number): boolean;
|
|
1987
|
+
|
|
1988
|
+
/**
|
|
1989
|
+
* Get the text representation of a keyword token.
|
|
1990
|
+
* WASM-exported version that allocates a String for JS compatibility.
|
|
1991
|
+
*/
|
|
1992
|
+
export function keywordToText(token: SyntaxKind): string | undefined;
|
|
1993
|
+
|
|
1994
|
+
/**
|
|
1995
|
+
* Normalize path separators, converting `\` into `/`.
|
|
1996
|
+
*/
|
|
1997
|
+
export function normalizeSlashes(path: string): string;
|
|
1998
|
+
|
|
1999
|
+
/**
|
|
2000
|
+
* Parse a JSON configuration file (tsconfig.json, etc.)
|
|
2001
|
+
*/
|
|
2002
|
+
export function parseConfigFileTextToJson(file_name: string, json_text: string): string;
|
|
2003
|
+
|
|
2004
|
+
/**
|
|
2005
|
+
* Parse JSON with comments (JSONC)
|
|
2006
|
+
*/
|
|
2007
|
+
export function parseJsonText(json_text: string): string;
|
|
2008
|
+
|
|
2009
|
+
/**
|
|
2010
|
+
* Determines whether a path starts with a relative path component (i.e. `.` or `..`).
|
|
2011
|
+
*/
|
|
2012
|
+
export function pathIsRelative(path: string): boolean;
|
|
2013
|
+
|
|
2014
|
+
/**
|
|
2015
|
+
* Get the text representation of a punctuation token.
|
|
2016
|
+
* WASM-exported version that allocates a String for JS compatibility.
|
|
2017
|
+
*/
|
|
2018
|
+
export function punctuationToText(token: SyntaxKind): string | undefined;
|
|
2019
|
+
|
|
2020
|
+
/**
|
|
2021
|
+
* Removes a trailing directory separator from a path, if it has one.
|
|
2022
|
+
* Uses char-based operations for UTF-8 safety.
|
|
2023
|
+
*/
|
|
2024
|
+
export function removeTrailingDirectorySeparator(path: string): string;
|
|
2025
|
+
|
|
2026
|
+
/**
|
|
2027
|
+
* Scan/tokenize source text using a source file
|
|
2028
|
+
*
|
|
2029
|
+
* Returns JSON array of tokens extracted from the parsed AST
|
|
2030
|
+
*/
|
|
2031
|
+
export function scanTokens(source_text: string): string;
|
|
2032
|
+
|
|
2033
|
+
/**
|
|
2034
|
+
* Get the token kind for a given text, including identifiers and keywords.
|
|
2035
|
+
* Returns `Identifier` if the text is not a keyword.
|
|
2036
|
+
*/
|
|
2037
|
+
export function stringToToken(text: string): SyntaxKind;
|
|
2038
|
+
|
|
2039
|
+
/**
|
|
2040
|
+
* Get the name of a `SyntaxKind`
|
|
2041
|
+
*/
|
|
2042
|
+
export function syntaxKindToName(kind: number): string;
|
|
2043
|
+
|
|
2044
|
+
/**
|
|
2045
|
+
* Convert a string to its keyword `SyntaxKind`, if it's a keyword.
|
|
2046
|
+
* Returns None if the text is not a keyword.
|
|
2047
|
+
*/
|
|
2048
|
+
export function textToKeyword(text: string): SyntaxKind | undefined;
|
|
2049
|
+
|
|
2050
|
+
/**
|
|
2051
|
+
* Convert file name to lowercase for case-insensitive file systems.
|
|
2052
|
+
*
|
|
2053
|
+
* This function handles special Unicode characters that need to remain
|
|
2054
|
+
* case-sensitive for proper cross-platform file name handling:
|
|
2055
|
+
* - \u{0130} (İ - Latin capital I with dot above)
|
|
2056
|
+
* - \u{0131} (ı - Latin small letter dotless i)
|
|
2057
|
+
* - \u{00DF} (ß - Latin small letter sharp s)
|
|
2058
|
+
*
|
|
2059
|
+
* These characters are excluded from lowercase conversion to maintain
|
|
2060
|
+
* compatibility with case-insensitive file systems that have special
|
|
2061
|
+
* handling for these characters (notably Turkish locale on Windows).
|
|
2062
|
+
*
|
|
2063
|
+
* Matches TypeScript's `toFileNameLowerCase` in src/compiler/core.ts
|
|
2064
|
+
*/
|
|
2065
|
+
export function toFileNameLowerCase(x: string): string;
|
|
2066
|
+
|
|
2067
|
+
export function tokenIsAssignmentOperator(token: SyntaxKind): boolean;
|
|
2068
|
+
|
|
2069
|
+
export function tokenIsIdentifierOrKeyword(token: SyntaxKind): boolean;
|
|
2070
|
+
|
|
2071
|
+
export function tokenIsKeyword(token: SyntaxKind): boolean;
|
|
2072
|
+
|
|
2073
|
+
export function tokenIsLiteral(token: SyntaxKind): boolean;
|
|
2074
|
+
|
|
2075
|
+
export function tokenIsPunctuation(token: SyntaxKind): boolean;
|
|
2076
|
+
|
|
2077
|
+
export function tokenIsReservedWord(token: SyntaxKind): boolean;
|
|
2078
|
+
|
|
2079
|
+
export function tokenIsStrictModeReservedWord(token: SyntaxKind): boolean;
|
|
2080
|
+
|
|
2081
|
+
export function tokenIsTemplateLiteral(token: SyntaxKind): boolean;
|
|
2082
|
+
|
|
2083
|
+
export function tokenIsTrivia(token: SyntaxKind): boolean;
|
|
2084
|
+
|
|
2085
|
+
/**
|
|
2086
|
+
* Get the text of a token kind (for operators, keywords)
|
|
2087
|
+
*/
|
|
2088
|
+
export function tokenToString(kind: number): string | undefined;
|
|
2089
|
+
|
|
2090
|
+
/**
|
|
2091
|
+
* Transpile TypeScript to JavaScript (simple version)
|
|
2092
|
+
*
|
|
2093
|
+
* Returns just the JavaScript output string for quick use.
|
|
2094
|
+
*/
|
|
2095
|
+
export function transpile(source: string, target?: number | null, module?: number | null): string;
|
|
2096
|
+
|
|
2097
|
+
/**
|
|
2098
|
+
* Transpile a single TypeScript file to JavaScript
|
|
2099
|
+
*
|
|
2100
|
+
* This is a simplified API for quick transpilation without creating a full program.
|
|
2101
|
+
*/
|
|
2102
|
+
export function transpileModule(source: string, options_json: string): string;
|
|
2103
|
+
|
|
2104
|
+
export function wasm_init(): void;
|