@r_masseater/oxlint-plugin-decision 0.5.1 → 0.7.0

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.
Files changed (47) hide show
  1. package/README.md +23 -395
  2. package/dist/app-Bso1uwY5.mjs +662 -0
  3. package/dist/app-Bso1uwY5.mjs.map +1 -0
  4. package/dist/cloudflare-worker.mjs +6 -179
  5. package/dist/cloudflare-worker.mjs.map +1 -1
  6. package/dist/decision-BtTZ52be.mjs +643 -0
  7. package/dist/decision-BtTZ52be.mjs.map +1 -0
  8. package/dist/define-presets-clyqLZxo.mjs +550 -0
  9. package/dist/define-presets-clyqLZxo.mjs.map +1 -0
  10. package/dist/index-BOrpK3Iv.d.mts +89 -0
  11. package/dist/index-Cgg-w0hb.d.mts +3370 -0
  12. package/dist/index-D7VrRpTx.d.mts +6 -0
  13. package/dist/index.d.mts +3 -3372
  14. package/dist/index.mjs +1 -786
  15. package/dist/openrouter-app.d.mts +12 -4
  16. package/dist/openrouter-app.mjs +1 -87
  17. package/dist/openrouter-worker.mjs +5 -35
  18. package/dist/openrouter-worker.mjs.map +1 -1
  19. package/dist/preset-plugin-AAwedMeS.mjs +10 -0
  20. package/dist/preset-plugin-AAwedMeS.mjs.map +1 -0
  21. package/dist/presets/ai-slop.d.mts +6 -0
  22. package/dist/presets/ai-slop.mjs +10 -0
  23. package/dist/presets/ai-slop.mjs.map +1 -0
  24. package/dist/presets/index.d.mts +3 -0
  25. package/dist/presets/index.mjs +3 -0
  26. package/dist/presets/recommended.d.mts +5 -0
  27. package/dist/presets/recommended.mjs +7 -0
  28. package/dist/presets/recommended.mjs.map +1 -0
  29. package/dist/presets/review-only.d.mts +5 -0
  30. package/dist/presets/review-only.mjs +7 -0
  31. package/dist/presets/review-only.mjs.map +1 -0
  32. package/dist/presets/strict.d.mts +5 -0
  33. package/dist/presets/strict.mjs +7 -0
  34. package/dist/presets/strict.mjs.map +1 -0
  35. package/dist/serve-decisions-CjlhvYm7.mjs +290 -0
  36. package/dist/serve-decisions-CjlhvYm7.mjs.map +1 -0
  37. package/package.json +25 -3
  38. package/skills/write-decision-rules/SKILL.md +18 -17
  39. package/skills/write-decision-rules/references/tuning.md +1 -1
  40. package/dist/index.mjs.map +0 -1
  41. package/dist/openrouter-app.mjs.map +0 -1
  42. package/dist/runtime-CICpEidL.mjs +0 -271
  43. package/dist/runtime-CICpEidL.mjs.map +0 -1
  44. package/dist/serve-decisions-cQpGj_Fq.mjs +0 -112
  45. package/dist/serve-decisions-cQpGj_Fq.mjs.map +0 -1
  46. package/dist/wire-CRD1mSAo.mjs +0 -251
  47. package/dist/wire-CRD1mSAo.mjs.map +0 -1
@@ -0,0 +1,3370 @@
1
+ import { Array as Array$1, Effect, Option, Result, Schema } from "effect";
2
+ import { Answer, ChoiceQuestion, DecisionsRequest, DecisionsResponse, NoulQuestion } from "@effect/ai-openrouter/OpenRouterSchema";
3
+ //#endregion
4
+ //#region src-js/plugins/globals.d.ts
5
+ /**
6
+ * Globals for the file being linted.
7
+ *
8
+ * Globals are deserialized from JSON, so can only contain JSON-compatible values.
9
+ * Each global variable maps to "readonly", "writable", or "off".
10
+ */
11
+ type Globals = Record<string, "readonly" | "writable" | "off">;
12
+ /**
13
+ * Environments for the file being linted.
14
+ *
15
+ * Only includes environments that are enabled, so all properties are `true`.
16
+ */
17
+ type Envs = Record<string, true>;
18
+ //#endregion
19
+ //#region src-js/plugins/json.d.ts
20
+ /**
21
+ * A JSON value.
22
+ */
23
+ type JsonValue = JsonObject | JsonValue[] | string | number | boolean | null;
24
+ /**
25
+ * A JSON object.
26
+ */
27
+ type JsonObject = {
28
+ [key: string]: JsonValue;
29
+ };
30
+ //#endregion
31
+ //#region src-js/plugins/options.d.ts
32
+ /**
33
+ * Options for a rule on a file.
34
+ */
35
+ type Options = JsonValue[];
36
+ //#endregion
37
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-any.d.ts
38
+ /**
39
+ Returns a boolean for whether the given type is `any`.
40
+
41
+ @link https://stackoverflow.com/a/49928360/1490091
42
+
43
+ Useful in type utilities, such as disallowing `any`s to be passed to a function.
44
+
45
+ @example
46
+ ```
47
+ import type {IsAny} from 'type-fest';
48
+
49
+ const typedObject = {a: 1, b: 2} as const;
50
+ const anyObject: any = {a: 1, b: 2};
51
+
52
+ function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(object: O, key: K) {
53
+ return object[key];
54
+ }
55
+
56
+ const typedA = get(typedObject, 'a');
57
+ //=> 1
58
+
59
+ const anyA = get(anyObject, 'a');
60
+ //=> any
61
+ ```
62
+
63
+ @category Type Guard
64
+ @category Utilities
65
+ */
66
+ type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
67
+ //#endregion
68
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-optional-key-of.d.ts
69
+ /**
70
+ Returns a boolean for whether the given key is an optional key of type.
71
+
72
+ This is useful when writing utility types or schema validators that need to differentiate `optional` keys.
73
+
74
+ @example
75
+ ```
76
+ import type {IsOptionalKeyOf} from 'type-fest';
77
+
78
+ type User = {
79
+ name: string;
80
+ surname: string;
81
+
82
+ luckyNumber?: number;
83
+ };
84
+
85
+ type Admin = {
86
+ name: string;
87
+ surname?: string;
88
+ };
89
+
90
+ type T1 = IsOptionalKeyOf<User, 'luckyNumber'>;
91
+ //=> true
92
+
93
+ type T2 = IsOptionalKeyOf<User, 'name'>;
94
+ //=> false
95
+
96
+ type T3 = IsOptionalKeyOf<User, 'name' | 'luckyNumber'>;
97
+ //=> boolean
98
+
99
+ type T4 = IsOptionalKeyOf<User | Admin, 'name'>;
100
+ //=> false
101
+
102
+ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
103
+ //=> boolean
104
+ ```
105
+
106
+ @category Type Guard
107
+ @category Utilities
108
+ */
109
+ type IsOptionalKeyOf<Type extends object, Key extends keyof Type> = IsAny<Type | Key> extends true ? never : Key extends keyof Type ? Type extends Record<Key, Type[Key]> ? false : true : false;
110
+ //#endregion
111
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/optional-keys-of.d.ts
112
+ /**
113
+ Extract all optional keys from the given type.
114
+
115
+ This is useful when you want to create a new type that contains different type values for the optional keys only.
116
+
117
+ @example
118
+ ```
119
+ import type {OptionalKeysOf, Except} from 'type-fest';
120
+
121
+ type User = {
122
+ name: string;
123
+ surname: string;
124
+
125
+ luckyNumber?: number;
126
+ };
127
+
128
+ const REMOVE_FIELD = Symbol('remove field symbol');
129
+ type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKeysOf<Entity>> & {
130
+ [Key in OptionalKeysOf<Entity>]?: Entity[Key] | typeof REMOVE_FIELD;
131
+ };
132
+
133
+ const update1: UpdateOperation<User> = {
134
+ name: 'Alice',
135
+ };
136
+
137
+ const update2: UpdateOperation<User> = {
138
+ name: 'Bob',
139
+ luckyNumber: REMOVE_FIELD,
140
+ };
141
+ ```
142
+
143
+ @category Utilities
144
+ */
145
+ type OptionalKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
146
+ ? (keyof { [Key in keyof Type as IsOptionalKeyOf<Type, Key> extends false ? never : Key]: never; }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
147
+ : never; // Should never happen
148
+ //#endregion
149
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/required-keys-of.d.ts
150
+ /**
151
+ Extract all required keys from the given type.
152
+
153
+ This is useful when you want to create a new type that contains different type values for the required keys only or use the list of keys for validation purposes, etc...
154
+
155
+ @example
156
+ ```
157
+ import type {RequiredKeysOf} from 'type-fest';
158
+
159
+ declare function createValidation<
160
+ Entity extends object,
161
+ Key extends RequiredKeysOf<Entity> = RequiredKeysOf<Entity>,
162
+ >(field: Key, validator: (value: Entity[Key]) => boolean): (entity: Entity) => boolean;
163
+
164
+ type User = {
165
+ name: string;
166
+ surname: string;
167
+ luckyNumber?: number;
168
+ };
169
+
170
+ const validator1 = createValidation<User>('name', value => value.length < 25);
171
+ const validator2 = createValidation<User>('surname', value => value.length < 25);
172
+
173
+ // @ts-expect-error
174
+ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
175
+ // Error: Argument of type '"luckyNumber"' is not assignable to parameter of type '"name" | "surname"'.
176
+ ```
177
+
178
+ @category Utilities
179
+ */
180
+ type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
181
+ ? Exclude<keyof Type, OptionalKeysOf<Type>> : never; // Should never happen
182
+ //#endregion
183
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-never.d.ts
184
+ /**
185
+ Returns a boolean for whether the given type is `never`.
186
+
187
+ @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
188
+ @link https://stackoverflow.com/a/53984913/10292952
189
+ @link https://www.zhenghao.io/posts/ts-never
190
+
191
+ Useful in type utilities, such as checking if something does not occur.
192
+
193
+ @example
194
+ ```
195
+ import type {IsNever, And} from 'type-fest';
196
+
197
+ type A = IsNever<never>;
198
+ //=> true
199
+
200
+ type B = IsNever<any>;
201
+ //=> false
202
+
203
+ type C = IsNever<unknown>;
204
+ //=> false
205
+
206
+ type D = IsNever<never[]>;
207
+ //=> false
208
+
209
+ type E = IsNever<object>;
210
+ //=> false
211
+
212
+ type F = IsNever<string>;
213
+ //=> false
214
+ ```
215
+
216
+ @example
217
+ ```
218
+ import type {IsNever} from 'type-fest';
219
+
220
+ type IsTrue<T> = T extends true ? true : false;
221
+
222
+ // When a distributive conditional is instantiated with `never`, the entire conditional results in `never`.
223
+ type A = IsTrue<never>;
224
+ //=> never
225
+
226
+ // If you don't want that behaviour, you can explicitly add an `IsNever` check before the distributive conditional.
227
+ type IsTrueFixed<T> =
228
+ IsNever<T> extends true ? false : T extends true ? true : false;
229
+
230
+ type B = IsTrueFixed<never>;
231
+ //=> false
232
+ ```
233
+
234
+ @category Type Guard
235
+ @category Utilities
236
+ */
237
+ type IsNever<T> = [T] extends [never] ? true : false;
238
+ //#endregion
239
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/if.d.ts
240
+ /**
241
+ An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
242
+
243
+ Use-cases:
244
+ - You can use this in combination with `Is*` types to create an if-else-like experience. For example, `If<IsAny<any>, 'is any', 'not any'>`.
245
+
246
+ Note:
247
+ - Returns a union of if branch and else branch if the given type is `boolean` or `any`. For example, `If<boolean, 'Y', 'N'>` will return `'Y' | 'N'`.
248
+ - Returns the else branch if the given type is `never`. For example, `If<never, 'Y', 'N'>` will return `'N'`.
249
+
250
+ @example
251
+ ```
252
+ import type {If} from 'type-fest';
253
+
254
+ type A = If<true, 'yes', 'no'>;
255
+ //=> 'yes'
256
+
257
+ type B = If<false, 'yes', 'no'>;
258
+ //=> 'no'
259
+
260
+ type C = If<boolean, 'yes', 'no'>;
261
+ //=> 'yes' | 'no'
262
+
263
+ type D = If<any, 'yes', 'no'>;
264
+ //=> 'yes' | 'no'
265
+
266
+ type E = If<never, 'yes', 'no'>;
267
+ //=> 'no'
268
+ ```
269
+
270
+ @example
271
+ ```
272
+ import type {If, IsAny, IsNever} from 'type-fest';
273
+
274
+ type A = If<IsAny<unknown>, 'is any', 'not any'>;
275
+ //=> 'not any'
276
+
277
+ type B = If<IsNever<never>, 'is never', 'not never'>;
278
+ //=> 'is never'
279
+ ```
280
+
281
+ @example
282
+ ```
283
+ import type {If, IsEqual} from 'type-fest';
284
+
285
+ type IfEqual<T, U, IfBranch, ElseBranch> = If<IsEqual<T, U>, IfBranch, ElseBranch>;
286
+
287
+ type A = IfEqual<string, string, 'equal', 'not equal'>;
288
+ //=> 'equal'
289
+
290
+ type B = IfEqual<string, number, 'equal', 'not equal'>;
291
+ //=> 'not equal'
292
+ ```
293
+
294
+ Note: Sometimes using the `If` type can make an implementation non–tail-recursive, which can impact performance. In such cases, it’s better to use a conditional directly. Refer to the following example:
295
+
296
+ @example
297
+ ```
298
+ import type {If, IsEqual, StringRepeat} from 'type-fest';
299
+
300
+ type HundredZeroes = StringRepeat<'0', 100>;
301
+
302
+ // The following implementation is not tail recursive
303
+ type Includes<S extends string, Char extends string> =
304
+ S extends `${infer First}${infer Rest}`
305
+ ? If<IsEqual<First, Char>,
306
+ 'found',
307
+ Includes<Rest, Char>>
308
+ : 'not found';
309
+
310
+ // Hence, instantiations with long strings will fail
311
+ // @ts-expect-error
312
+ type Fails = Includes<HundredZeroes, '1'>;
313
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
314
+ // Error: Type instantiation is excessively deep and possibly infinite.
315
+
316
+ // However, if we use a simple conditional instead of `If`, the implementation becomes tail-recursive
317
+ type IncludesWithoutIf<S extends string, Char extends string> =
318
+ S extends `${infer First}${infer Rest}`
319
+ ? IsEqual<First, Char> extends true
320
+ ? 'found'
321
+ : IncludesWithoutIf<Rest, Char>
322
+ : 'not found';
323
+
324
+ // Now, instantiations with long strings will work
325
+ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
326
+ //=> 'not found'
327
+ ```
328
+
329
+ @category Type Guard
330
+ @category Utilities
331
+ */
332
+ type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
333
+ //#endregion
334
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/internal/type.d.ts
335
+ /**
336
+ An if-else-like type that resolves depending on whether the given type is `any` or `never`.
337
+
338
+ @example
339
+ ```
340
+ // When `T` is neither `any` nor `never` (like `string`) => Returns `IfNot` branch
341
+ type A = IfNotAnyOrNever<string, {ifNot: 'VALID'; ifAny: 'IS_ANY'; ifNever: 'IS_NEVER'}>;
342
+ //=> 'VALID'
343
+
344
+ // When `T` is `any` => Returns `IfAny` branch
345
+ type B = IfNotAnyOrNever<any, {ifNot: 'VALID'; ifAny: 'IS_ANY'; ifNever: 'IS_NEVER'}>;
346
+ //=> 'IS_ANY'
347
+
348
+ // When `T` is `never` => Returns `IfNever` branch
349
+ type C = IfNotAnyOrNever<never, {ifNot: 'VALID'; ifAny: 'IS_ANY'; ifNever: 'IS_NEVER'}>;
350
+ //=> 'IS_NEVER'
351
+ ```
352
+
353
+ Note: Wrapping a tail-recursive type with `IfNotAnyOrNever` makes the implementation non-tail-recursive. To fix this, move the recursion into a helper type. Refer to the following example:
354
+
355
+ @example
356
+ ```ts
357
+ import type {StringRepeat} from 'type-fest';
358
+
359
+ type NineHundredNinetyNineSpaces = StringRepeat<' ', 999>;
360
+
361
+ // The following implementation is not tail recursive
362
+ type TrimLeft<S extends string> = IfNotAnyOrNever<S, {ifNot: S extends ` ${infer R}` ? TrimLeft<R> : S}>;
363
+
364
+ // Hence, instantiations with long strings will fail
365
+ // @ts-expect-error
366
+ type T1 = TrimLeft<NineHundredNinetyNineSpaces>;
367
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
368
+ // Error: Type instantiation is excessively deep and possibly infinite.
369
+
370
+ // To fix this, move the recursion into a helper type
371
+ type TrimLeftOptimised<S extends string> = IfNotAnyOrNever<S, {ifNot: _TrimLeftOptimised<S>}>;
372
+
373
+ type _TrimLeftOptimised<S extends string> = S extends ` ${infer R}` ? _TrimLeftOptimised<R> : S;
374
+
375
+ type T2 = TrimLeftOptimised<NineHundredNinetyNineSpaces>;
376
+ //=> ''
377
+ ```
378
+ */
379
+ type IfNotAnyOrNever<T, Cases extends {
380
+ ifNot: unknown;
381
+ ifAny?: unknown;
382
+ ifNever?: unknown;
383
+ }> = IsAny<T> extends true ? 'ifAny' extends keyof Cases ? Cases['ifAny'] : any : IsNever<T> extends true ? 'ifNever' extends keyof Cases ? Cases['ifNever'] : never : Cases['ifNot'];
384
+ //#endregion
385
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/simplify.d.ts
386
+ /**
387
+ Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
388
+
389
+ @example
390
+ ```
391
+ import type {Simplify} from 'type-fest';
392
+
393
+ type PositionProps = {
394
+ top: number;
395
+ left: number;
396
+ };
397
+
398
+ type SizeProps = {
399
+ width: number;
400
+ height: number;
401
+ };
402
+
403
+ // In your editor, hovering over `Props` will show a flattened object with all the properties.
404
+ type Props = Simplify<PositionProps & SizeProps>;
405
+ ```
406
+
407
+ Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record<string, unknown>`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface.
408
+
409
+ If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify<SomeInterface> = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify<SomeInterface>` if you can't re-declare the `value`.
410
+
411
+ @example
412
+ ```
413
+ import type {Simplify} from 'type-fest';
414
+
415
+ interface SomeInterface {
416
+ foo: number;
417
+ bar?: string;
418
+ baz: number | undefined;
419
+ }
420
+
421
+ type SomeType = {
422
+ foo: number;
423
+ bar?: string;
424
+ baz: number | undefined;
425
+ };
426
+
427
+ const literal = {foo: 123, bar: 'hello', baz: 456};
428
+ const someType: SomeType = literal;
429
+ const someInterface: SomeInterface = literal;
430
+
431
+ declare function fn(object: Record<string, unknown>): void;
432
+
433
+ fn(literal); // Good: literal object type is sealed
434
+ fn(someType); // Good: type is sealed
435
+ // @ts-expect-error
436
+ fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
437
+ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
438
+ ```
439
+
440
+ @link https://github.com/microsoft/TypeScript/issues/15300
441
+ @see {@link SimplifyDeep}
442
+ @category Object
443
+ */
444
+ type Simplify<T> = { [KeyType in keyof T]: T[KeyType]; } & {};
445
+ //#endregion
446
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/is-equal.d.ts
447
+ /**
448
+ Returns a boolean for whether the two given types are equal.
449
+
450
+ @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
451
+ @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
452
+
453
+ Use-cases:
454
+ - If you want to make a conditional branch based on the result of a comparison of two types.
455
+
456
+ @example
457
+ ```
458
+ import type {IsEqual} from 'type-fest';
459
+
460
+ // This type returns a boolean for whether the given array includes the given item.
461
+ // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
462
+ type Includes<Value extends readonly any[], Item> =
463
+ Value extends readonly [Value[0], ...infer rest]
464
+ ? IsEqual<Value[0], Item> extends true
465
+ ? true
466
+ : Includes<rest, Item>
467
+ : false;
468
+ ```
469
+
470
+ @category Type Guard
471
+ @category Utilities
472
+ */
473
+ type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false : false;
474
+ // This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
475
+ type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
476
+ //#endregion
477
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/omit-index-signature.d.ts
478
+ /**
479
+ Omit any index signatures from the given object type, leaving only explicitly defined properties.
480
+
481
+ This is the counterpart of `PickIndexSignature`.
482
+
483
+ Use-cases:
484
+ - Remove overly permissive signatures from third-party types.
485
+
486
+ This type was taken from this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).
487
+
488
+ It relies on the fact that an empty object (`{}`) is assignable to an object with just an index signature, like `Record<string, unknown>`, but not to an object with explicitly defined keys, like `Record<'foo' | 'bar', unknown>`.
489
+
490
+ (The actual value type, `unknown`, is irrelevant and could be any type. Only the key type matters.)
491
+
492
+ ```
493
+ const indexed: Record<string, unknown> = {}; // Allowed
494
+
495
+ // @ts-expect-error
496
+ const keyed: Record<'foo', unknown> = {}; // Error
497
+ // TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
498
+ ```
499
+
500
+ Instead of causing a type error like the above, you can also use a [conditional type](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html) to test whether a type is assignable to another:
501
+
502
+ ```
503
+ type Indexed = {} extends Record<string, unknown>
504
+ ? '✅ `{}` is assignable to `Record<string, unknown>`'
505
+ : '❌ `{}` is NOT assignable to `Record<string, unknown>`';
506
+
507
+ type IndexedResult = Indexed;
508
+ //=> '✅ `{}` is assignable to `Record<string, unknown>`'
509
+
510
+ type Keyed = {} extends Record<'foo' | 'bar', unknown>
511
+ ? '✅ `{}` is assignable to `Record<\'foo\' | \'bar\', unknown>`'
512
+ : '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`';
513
+
514
+ type KeyedResult = Keyed;
515
+ //=> '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`'
516
+ ```
517
+
518
+ Using a [mapped type](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#further-exploration), you can then check for each `KeyType` of `ObjectType`...
519
+
520
+ ```
521
+ type OmitIndexSignature<ObjectType> = {
522
+ [KeyType in keyof ObjectType // Map each key of `ObjectType`...
523
+ ]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature<Foo> == Foo`.
524
+ };
525
+ ```
526
+
527
+ ...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...
528
+
529
+ ```
530
+ type OmitIndexSignature<ObjectType> = {
531
+ [KeyType in keyof ObjectType
532
+ // Is `{}` assignable to `Record<KeyType, unknown>`?
533
+ as {} extends Record<KeyType, unknown>
534
+ ? never // ✅ `{}` is assignable to `Record<KeyType, unknown>`
535
+ : KeyType // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
536
+ ]: ObjectType[KeyType];
537
+ };
538
+ ```
539
+
540
+ If `{}` is assignable, it means that `KeyType` is an index signature and we want to remove it. If it is not assignable, `KeyType` is a "real" key and we want to keep it.
541
+
542
+ @example
543
+ ```
544
+ import type {OmitIndexSignature} from 'type-fest';
545
+
546
+ type Example = {
547
+ // These index signatures will be removed.
548
+ [x: string]: any;
549
+ [x: number]: any;
550
+ [x: symbol]: any;
551
+ [x: `head-${string}`]: string;
552
+ [x: `${string}-tail`]: string;
553
+ [x: `head-${string}-tail`]: string;
554
+ [x: `${bigint}`]: string;
555
+ [x: `embedded-${number}`]: string;
556
+
557
+ // These explicitly defined keys will remain.
558
+ foo: 'bar';
559
+ qux?: 'baz';
560
+ };
561
+
562
+ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
563
+ //=> {foo: 'bar'; qux?: 'baz'}
564
+ ```
565
+
566
+ @see {@link PickIndexSignature}
567
+ @category Object
568
+ */
569
+ type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType]; };
570
+ //#endregion
571
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/pick-index-signature.d.ts
572
+ /**
573
+ Pick only index signatures from the given object type, leaving out all explicitly defined properties.
574
+
575
+ This is the counterpart of `OmitIndexSignature`.
576
+
577
+ @example
578
+ ```
579
+ import type {PickIndexSignature} from 'type-fest';
580
+
581
+ declare const symbolKey: unique symbol;
582
+
583
+ type Example = {
584
+ // These index signatures will remain.
585
+ [x: string]: unknown;
586
+ [x: number]: unknown;
587
+ [x: symbol]: unknown;
588
+ [x: `head-${string}`]: string;
589
+ [x: `${string}-tail`]: string;
590
+ [x: `head-${string}-tail`]: string;
591
+ [x: `${bigint}`]: string;
592
+ [x: `embedded-${number}`]: string;
593
+
594
+ // These explicitly defined keys will be removed.
595
+ ['kebab-case-key']: string;
596
+ [symbolKey]: string;
597
+ foo: 'bar';
598
+ qux?: 'baz';
599
+ };
600
+
601
+ type ExampleIndexSignature = PickIndexSignature<Example>;
602
+ // {
603
+ // [x: string]: unknown;
604
+ // [x: number]: unknown;
605
+ // [x: symbol]: unknown;
606
+ // [x: `head-${string}`]: string;
607
+ // [x: `${string}-tail`]: string;
608
+ // [x: `head-${string}-tail`]: string;
609
+ // [x: `${bigint}`]: string;
610
+ // [x: `embedded-${number}`]: string;
611
+ // }
612
+ ```
613
+
614
+ @see {@link OmitIndexSignature}
615
+ @category Object
616
+ */
617
+ type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType]; };
618
+ //#endregion
619
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/merge.d.ts
620
+ // Merges two objects without worrying about index signatures.
621
+ type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key]; } & Source>;
622
+ /**
623
+ Merge two types into a new type. Keys of the second type overrides keys of the first type.
624
+
625
+ This is different from the TypeScript `&` (intersection) operator. With `&`, conflicting property types are intersected, which often results in `never`. For example, `{a: string} & {a: number}` makes `a` become `string & number`, which resolves to `never`. With `Merge`, the second type's keys cleanly override the first, so `Merge<{a: string}, {a: number}>` gives `{a: number}` as expected. `Merge` also produces a flattened type (via `Simplify`), making it more readable in IDE tooltips compared to `A & B`.
626
+
627
+ @example
628
+ ```
629
+ import type {Merge} from 'type-fest';
630
+
631
+ type Foo = {
632
+ a: string;
633
+ b: number;
634
+ };
635
+
636
+ type Bar = {
637
+ a: number; // Conflicts with Foo['a']
638
+ c: boolean;
639
+ };
640
+
641
+ // With `&`, `a` becomes `string & number` which is `never`. Not what you want.
642
+ type WithIntersection = (Foo & Bar)['a'];
643
+ //=> never
644
+
645
+ // With `Merge`, `a` is cleanly overridden to `number`.
646
+ type WithMerge = Merge<Foo, Bar>['a'];
647
+ //=> number
648
+ ```
649
+
650
+ @example
651
+ ```
652
+ import type {Merge} from 'type-fest';
653
+
654
+ type Foo = {
655
+ [x: string]: unknown;
656
+ [x: number]: unknown;
657
+ foo: string;
658
+ bar: symbol;
659
+ };
660
+
661
+ type Bar = {
662
+ [x: number]: number;
663
+ [x: symbol]: unknown;
664
+ bar: Date;
665
+ baz: boolean;
666
+ };
667
+
668
+ export type FooBar = Merge<Foo, Bar>;
669
+ //=> {
670
+ // [x: string]: unknown;
671
+ // [x: number]: number;
672
+ // [x: symbol]: unknown;
673
+ // foo: string;
674
+ // bar: Date;
675
+ // baz: boolean;
676
+ // }
677
+ ```
678
+
679
+ Note: If you want a merge type that more accurately reflects the runtime behavior of object spread or `Object.assign`, refer to the {@link ObjectMerge} type.
680
+
681
+ @see {@link ObjectMerge}
682
+ @category Object
683
+ */
684
+ type Merge<Destination, Source> = Destination extends unknown // For distributing `Destination`
685
+ ? Source extends unknown // For distributing `Source`
686
+ ? If<IsEqual<Destination, Source>, Destination, _Merge<Destination, Source>> : never // Should never happen
687
+ : never; // Should never happen
688
+ type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
689
+ //#endregion
690
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/internal/object.d.ts
691
+ /**
692
+ Merges user specified options with default options.
693
+
694
+ @example
695
+ ```
696
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
697
+ type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
698
+ type SpecifiedOptions = {leavesOnly: true};
699
+
700
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
701
+ //=> {maxRecursionDepth: 10; leavesOnly: true}
702
+ ```
703
+
704
+ @example
705
+ ```
706
+ // Complains if default values are not provided for optional options
707
+
708
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
709
+ type DefaultPathsOptions = {maxRecursionDepth: 10};
710
+ type SpecifiedOptions = {};
711
+
712
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
713
+ // ~~~~~~~~~~~~~~~~~~~
714
+ // Property 'leavesOnly' is missing in type 'DefaultPathsOptions' but required in type '{ maxRecursionDepth: number; leavesOnly: boolean; }'.
715
+ ```
716
+
717
+ @example
718
+ ```
719
+ // Complains if an option's default type does not conform to the expected type
720
+
721
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
722
+ type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: 'no'};
723
+ type SpecifiedOptions = {};
724
+
725
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
726
+ // ~~~~~~~~~~~~~~~~~~~
727
+ // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
728
+ ```
729
+
730
+ @example
731
+ ```
732
+ // Complains if an option's specified type does not conform to the expected type
733
+
734
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
735
+ type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
736
+ type SpecifiedOptions = {leavesOnly: 'yes'};
737
+
738
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
739
+ // ~~~~~~~~~~~~~~~~
740
+ // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
741
+ ```
742
+ */
743
+ type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = _ApplyDefaultOptions<Options, Defaults, SpecifiedOptions> extends (infer Result extends Required<Options> // `extends Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
744
+ ) ? Result : never;
745
+ type _ApplyDefaultOptions<Options, Defaults, SpecifiedOptions> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever<SpecifiedOptions>, Defaults, Merge<Defaults, { [Key in keyof SpecifiedOptions as undefined extends Required<Options>[Key & keyof Options] ? Key : undefined extends SpecifiedOptions[Key] ? never : Key]: SpecifiedOptions[Key]; }>>>;
746
+ //#endregion
747
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/except.d.ts
748
+ /**
749
+ Filter out keys from an object.
750
+
751
+ Returns `never` if `Exclude` is strictly equal to `Key`.
752
+ Returns `never` if `Key` extends `Exclude`.
753
+ Returns `Key` otherwise.
754
+
755
+ @example
756
+ ```
757
+ type Filtered = Filter<'foo', 'foo'>;
758
+ //=> never
759
+ ```
760
+
761
+ @example
762
+ ```
763
+ type Filtered = Filter<'bar', string>;
764
+ //=> never
765
+ ```
766
+
767
+ @example
768
+ ```
769
+ type Filtered = Filter<'bar', 'foo'>;
770
+ //=> 'bar'
771
+ ```
772
+
773
+ @see {Except}
774
+ */
775
+ type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
776
+ type ExceptOptions = {
777
+ /**
778
+ Disallow assigning non-specified properties.
779
+
780
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
781
+
782
+ @default false
783
+ */
784
+ requireExactProps?: boolean;
785
+ };
786
+ type DefaultExceptOptions = {
787
+ requireExactProps: false;
788
+ };
789
+ /**
790
+ Create a type from an object type without certain keys.
791
+
792
+ We recommend setting the `requireExactProps` option to `true`.
793
+
794
+ This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
795
+
796
+ This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
797
+
798
+ @example
799
+ ```
800
+ import type {Except} from 'type-fest';
801
+
802
+ type Foo = {
803
+ a: number;
804
+ b: string;
805
+ };
806
+
807
+ type FooWithoutA = Except<Foo, 'a'>;
808
+ //=> {b: string}
809
+
810
+ // @ts-expect-error
811
+ const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
812
+ // errors: 'a' does not exist in type '{ b: string; }'
813
+
814
+ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
815
+ //=> {a: number} & Partial<Record<'b', never>>
816
+
817
+ // @ts-expect-error
818
+ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
819
+ // errors at 'b': Type 'string' is not assignable to type 'undefined'.
820
+
821
+ // The `Omit` utility type doesn't work when omitting specific keys from objects containing index signatures.
822
+
823
+ // Consider the following example:
824
+
825
+ type UserData = {
826
+ [metadata: string]: string;
827
+ email: string;
828
+ name: string;
829
+ role: 'admin' | 'user';
830
+ };
831
+
832
+ // `Omit` clearly doesn't behave as expected in this case:
833
+ type PostPayload = Omit<UserData, 'email'>;
834
+ //=> {[x: string]: string; [x: number]: string}
835
+
836
+ // In situations like this, `Except` works better.
837
+ // It simply removes the `email` key while preserving all the other keys.
838
+ type PostPayloadFixed = Except<UserData, 'email'>;
839
+ //=> {[x: string]: string; name: string; role: 'admin' | 'user'}
840
+ ```
841
+
842
+ @category Object
843
+ */
844
+ type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> = _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
845
+ type _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Required<ExceptOptions>> = { [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType]; } & (Options['requireExactProps'] extends true ? Partial<Record<KeysType, never>> : {});
846
+ //#endregion
847
+ //#region ../../node_modules/.pnpm/type-fest@5.10.0/node_modules/type-fest/source/require-at-least-one.d.ts
848
+ /**
849
+ Create a type that requires at least one of the given keys, while keeping the remaining keys as is.
850
+
851
+ @example
852
+ ```
853
+ import type {RequireAtLeastOne} from 'type-fest';
854
+
855
+ type Responder = {
856
+ text?: () => string;
857
+ json?: () => string;
858
+ secure?: boolean;
859
+ };
860
+
861
+ const responder: RequireAtLeastOne<Responder, 'text' | 'json'> = {
862
+ json: () => '{"message": "ok"}',
863
+ secure: true,
864
+ };
865
+ ```
866
+
867
+ @category Object
868
+ */
869
+ type RequireAtLeastOne<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> = IfNotAnyOrNever<ObjectType, {
870
+ ifNot: If<IsNever<KeysType>, never, _RequireAtLeastOne<ObjectType, If<IsAny<KeysType>, keyof ObjectType, KeysType>>>;
871
+ }>;
872
+ type _RequireAtLeastOne<ObjectType, KeysType extends keyof ObjectType> = { [
873
+ // For each `Key` in `KeysType` make a mapped type:
874
+ Key in KeysType]-?: Required<Pick<ObjectType, Key>> // 1. Make `Key`'s type required
875
+ & Partial<Pick<ObjectType, Exclude<KeysType, Key>>> // 2. Make all other keys in `KeysType` optional
876
+ ; }[KeysType] & Except<ObjectType, KeysType>; // 3. Add the remaining keys not in `KeysType`
877
+ //#endregion
878
+ //#region src-js/plugins/tokens.d.ts
879
+ /**
880
+ * AST token type.
881
+ */
882
+ type TokenType = BooleanToken | IdentifierToken | JSXIdentifierToken | JSXTextToken | KeywordToken | NullToken | NumericToken | PrivateIdentifierToken | PunctuatorToken | RegularExpressionToken | StringToken | TemplateToken;
883
+ interface BaseToken extends Span {
884
+ value: string;
885
+ regex: undefined;
886
+ }
887
+ interface BooleanToken extends BaseToken {
888
+ type: "Boolean";
889
+ }
890
+ interface IdentifierToken extends BaseToken {
891
+ type: "Identifier";
892
+ }
893
+ interface JSXIdentifierToken extends BaseToken {
894
+ type: "JSXIdentifier";
895
+ }
896
+ interface JSXTextToken extends BaseToken {
897
+ type: "JSXText";
898
+ }
899
+ interface KeywordToken extends BaseToken {
900
+ type: "Keyword";
901
+ }
902
+ interface NullToken extends BaseToken {
903
+ type: "Null";
904
+ }
905
+ interface NumericToken extends BaseToken {
906
+ type: "Numeric";
907
+ }
908
+ interface PrivateIdentifierToken extends BaseToken {
909
+ type: "PrivateIdentifier";
910
+ }
911
+ interface PunctuatorToken extends BaseToken {
912
+ type: "Punctuator";
913
+ }
914
+ interface RegularExpressionToken extends Span {
915
+ type: "RegularExpression";
916
+ value: string;
917
+ regex: {
918
+ pattern: string;
919
+ flags: string;
920
+ };
921
+ }
922
+ interface StringToken extends BaseToken {
923
+ type: "String";
924
+ }
925
+ interface TemplateToken extends BaseToken {
926
+ type: "Template";
927
+ }
928
+ //#endregion
929
+ //#region src-js/plugins/comments.d.ts
930
+ /**
931
+ * Comment.
932
+ */
933
+ interface CommentType extends Span {
934
+ type: "Line" | "Block" | "Shebang";
935
+ value: string;
936
+ }
937
+ declare namespace types_d_exports {
938
+ export { AccessorProperty, AccessorPropertyType, Argument, ArrayAssignmentTarget, ArrayExpression, ArrayExpressionElement, ArrayPattern, ArrowFunctionExpression, AssignmentExpression, AssignmentOperator, AssignmentPattern, AssignmentTarget, AssignmentTargetMaybeDefault, AssignmentTargetPattern, AssignmentTargetProperty, AssignmentTargetPropertyIdentifier, AssignmentTargetPropertyProperty, AssignmentTargetRest, AssignmentTargetWithDefault, AwaitExpression, BigIntLiteral, BinaryExpression, BinaryOperator, BindingIdentifier, BindingPattern, BindingProperty, BindingRestElement, BlockStatement, BooleanLiteral, BreakStatement, CallExpression, CatchClause, ChainElement, ChainExpression, Class, ClassBody, ClassElement, ClassType, CommentType as Comment, ComputedMemberExpression, ConditionalExpression, ContinueStatement, DebuggerStatement, Declaration, Decorator, Directive$1 as Directive, DoWhileStatement, EmptyStatement, ExportAllDeclaration, ExportDefaultDeclaration, ExportDefaultDeclarationKind, ExportNamedDeclaration, ExportSpecifier, Expression, ExpressionStatement, ForInStatement, ForOfStatement, ForStatement, ForStatementInit, ForStatementLeft, FormalParameter, FormalParameterRest, Function$1 as Function, FunctionBody, FunctionType, Hashbang, IdentifierName, IdentifierReference, IfStatement, ImportAttribute, ImportAttributeKey, ImportDeclaration, ImportDeclarationSpecifier, ImportDefaultSpecifier, ImportExpression, ImportNamespaceSpecifier, ImportOrExportKind, ImportPhase, ImportSpecifier, JSDocNonNullableType, JSDocNullableType, JSDocUnknownType, JSXAttribute, JSXAttributeItem, JSXAttributeName, JSXAttributeValue, JSXChild, JSXClosingElement, JSXClosingFragment, JSXElement, JSXElementName, JSXEmptyExpression, JSXExpression, JSXExpressionContainer, JSXFragment, JSXIdentifier, JSXMemberExpression, JSXMemberExpressionObject, JSXNamespacedName, JSXOpeningElement, JSXOpeningFragment, JSXSpreadAttribute, JSXSpreadChild, JSXText, LabelIdentifier, LabeledStatement, LogicalExpression, LogicalOperator, MemberExpression, MetaProperty, MethodDefinition, MethodDefinitionKind, MethodDefinitionType, ModuleDeclaration, ModuleExportName, ModuleKind, NewExpression, Node$1 as Node, NullLiteral, NumericLiteral, ObjectAssignmentTarget, ObjectExpression, ObjectPattern, ObjectProperty, ObjectPropertyKind, ParamPattern, ParenthesizedExpression, PrivateFieldExpression, PrivateIdentifier, PrivateInExpression, Program, PropertyDefinition, PropertyDefinitionType, PropertyKey$1 as PropertyKey, PropertyKind, RegExpLiteral, ReturnStatement, SequenceExpression, SimpleAssignmentTarget, Span, SpreadElement, Statement, StaticBlock, StaticMemberExpression, StringLiteral, Super, SwitchCase, SwitchStatement, TSAccessibility, TSAnyKeyword, TSArrayType, TSAsExpression, TSBigIntKeyword, TSBooleanKeyword, TSCallSignatureDeclaration, TSClassImplements, TSConditionalType, TSConstructSignatureDeclaration, TSConstructorType, TSEnumBody, TSEnumDeclaration, TSEnumMember, TSEnumMemberName, TSExportAssignment, TSExternalModuleReference, TSFunctionType, TSGlobalDeclaration, TSImportEqualsDeclaration, TSImportType, TSImportTypeQualifiedName, TSImportTypeQualifier, TSIndexSignature, TSIndexSignatureName, TSIndexedAccessType, TSInferType, TSInstantiationExpression, TSInterfaceBody, TSInterfaceDeclaration, TSInterfaceHeritage, TSIntersectionType, TSIntrinsicKeyword, TSLiteral, TSLiteralType, TSMappedType, TSMappedTypeModifierOperator, TSMethodSignature, TSMethodSignatureKind, TSModuleBlock, TSModuleDeclaration, TSModuleDeclarationKind, TSModuleReference, TSNamedTupleMember, TSNamespaceExportDeclaration, TSNeverKeyword, TSNonNullExpression, TSNullKeyword, TSNumberKeyword, TSObjectKeyword, TSOptionalType, TSParameterProperty, TSParenthesizedType, TSPropertySignature, TSQualifiedName, TSRestType, TSSatisfiesExpression, TSSignature, TSStringKeyword, TSSymbolKeyword, TSTemplateLiteralType, TSThisParameter, TSThisType, TSTupleElement, TSTupleType, TSType, TSTypeAliasDeclaration, TSTypeAnnotation, TSTypeAssertion, TSTypeLiteral, TSTypeName, TSTypeOperator, TSTypeOperatorOperator, TSTypeParameter, TSTypeParameterDeclaration, TSTypeParameterInstantiation, TSTypePredicate, TSTypePredicateName, TSTypeQuery, TSTypeQueryExprName, TSTypeReference, TSUndefinedKeyword, TSUnionType, TSUnknownKeyword, TSVoidKeyword, TaggedTemplateExpression, TemplateElement, TemplateElementValue, TemplateLiteral, ThisExpression, ThrowStatement, TokenType as Token, TryStatement, UnaryExpression, UnaryOperator, UpdateExpression, UpdateOperator, V8IntrinsicExpression, VariableDeclaration, VariableDeclarationKind, VariableDeclarator, WhileStatement, WithStatement, YieldExpression };
939
+ }
940
+ interface Program extends Span {
941
+ type: "Program";
942
+ body: Array<Directive$1 | Statement>;
943
+ sourceType: ModuleKind;
944
+ comments: CommentType[];
945
+ tokens: TokenType[];
946
+ parent: null;
947
+ }
948
+ type Expression = BooleanLiteral | NullLiteral | NumericLiteral | BigIntLiteral | RegExpLiteral | StringLiteral | TemplateLiteral | IdentifierReference | Super | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | CallExpression | ChainExpression | Class | ConditionalExpression | Function$1 | ImportExpression | LogicalExpression | NewExpression | ObjectExpression | ParenthesizedExpression | SequenceExpression | TaggedTemplateExpression | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | PrivateInExpression | MetaProperty | JSXElement | JSXFragment | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression | TSInstantiationExpression | V8IntrinsicExpression | MemberExpression;
949
+ interface IdentifierName extends Span {
950
+ type: "Identifier";
951
+ decorators?: [];
952
+ name: string;
953
+ optional?: false;
954
+ typeAnnotation?: null;
955
+ parent: Node$1;
956
+ }
957
+ interface IdentifierReference extends Span {
958
+ type: "Identifier";
959
+ decorators?: [];
960
+ name: string;
961
+ optional?: false;
962
+ typeAnnotation?: null;
963
+ parent: Node$1;
964
+ }
965
+ interface BindingIdentifier extends Span {
966
+ type: "Identifier";
967
+ decorators?: [];
968
+ name: string;
969
+ optional?: false;
970
+ typeAnnotation?: TSTypeAnnotation | null;
971
+ parent: Node$1;
972
+ }
973
+ interface LabelIdentifier extends Span {
974
+ type: "Identifier";
975
+ decorators?: [];
976
+ name: string;
977
+ optional?: false;
978
+ typeAnnotation?: null;
979
+ parent: Node$1;
980
+ }
981
+ interface ThisExpression extends Span {
982
+ type: "ThisExpression";
983
+ parent: Node$1;
984
+ }
985
+ interface ArrayExpression extends Span {
986
+ type: "ArrayExpression";
987
+ elements: Array<ArrayExpressionElement>;
988
+ parent: Node$1;
989
+ }
990
+ type ArrayExpressionElement = SpreadElement | null | Expression;
991
+ interface ObjectExpression extends Span {
992
+ type: "ObjectExpression";
993
+ properties: Array<ObjectPropertyKind>;
994
+ parent: Node$1;
995
+ }
996
+ type ObjectPropertyKind = ObjectProperty | SpreadElement;
997
+ interface ObjectProperty extends Span {
998
+ type: "Property";
999
+ kind: PropertyKind;
1000
+ key: PropertyKey$1;
1001
+ value: Expression;
1002
+ method: boolean;
1003
+ shorthand: boolean;
1004
+ computed: boolean;
1005
+ optional?: false;
1006
+ parent: Node$1;
1007
+ }
1008
+ type PropertyKey$1 = IdentifierName | PrivateIdentifier | Expression;
1009
+ type PropertyKind = "init" | "get" | "set";
1010
+ interface TemplateLiteral extends Span {
1011
+ type: "TemplateLiteral";
1012
+ quasis: Array<TemplateElement>;
1013
+ expressions: Array<Expression>;
1014
+ parent: Node$1;
1015
+ }
1016
+ interface TaggedTemplateExpression extends Span {
1017
+ type: "TaggedTemplateExpression";
1018
+ tag: Expression;
1019
+ typeArguments?: TSTypeParameterInstantiation | null;
1020
+ quasi: TemplateLiteral;
1021
+ parent: Node$1;
1022
+ }
1023
+ interface TemplateElement extends Span {
1024
+ type: "TemplateElement";
1025
+ value: TemplateElementValue;
1026
+ tail: boolean;
1027
+ parent: Node$1;
1028
+ }
1029
+ interface TemplateElementValue {
1030
+ raw: string;
1031
+ cooked: string | null;
1032
+ }
1033
+ type MemberExpression = ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression;
1034
+ interface ComputedMemberExpression extends Span {
1035
+ type: "MemberExpression";
1036
+ object: Expression;
1037
+ property: Expression;
1038
+ optional: boolean;
1039
+ computed: true;
1040
+ parent: Node$1;
1041
+ }
1042
+ interface StaticMemberExpression extends Span {
1043
+ type: "MemberExpression";
1044
+ object: Expression;
1045
+ property: IdentifierName;
1046
+ optional: boolean;
1047
+ computed: false;
1048
+ parent: Node$1;
1049
+ }
1050
+ interface PrivateFieldExpression extends Span {
1051
+ type: "MemberExpression";
1052
+ object: Expression;
1053
+ property: PrivateIdentifier;
1054
+ optional: boolean;
1055
+ computed: false;
1056
+ parent: Node$1;
1057
+ }
1058
+ interface CallExpression extends Span {
1059
+ type: "CallExpression";
1060
+ callee: Expression;
1061
+ typeArguments?: TSTypeParameterInstantiation | null;
1062
+ arguments: Array<Argument>;
1063
+ optional: boolean;
1064
+ parent: Node$1;
1065
+ }
1066
+ interface NewExpression extends Span {
1067
+ type: "NewExpression";
1068
+ callee: Expression;
1069
+ typeArguments?: TSTypeParameterInstantiation | null;
1070
+ arguments: Array<Argument>;
1071
+ parent: Node$1;
1072
+ }
1073
+ interface MetaProperty extends Span {
1074
+ type: "MetaProperty";
1075
+ meta: IdentifierName;
1076
+ property: IdentifierName;
1077
+ parent: Node$1;
1078
+ }
1079
+ interface SpreadElement extends Span {
1080
+ type: "SpreadElement";
1081
+ argument: Expression;
1082
+ parent: Node$1;
1083
+ }
1084
+ type Argument = SpreadElement | Expression;
1085
+ interface UpdateExpression extends Span {
1086
+ type: "UpdateExpression";
1087
+ operator: UpdateOperator;
1088
+ prefix: boolean;
1089
+ argument: SimpleAssignmentTarget;
1090
+ parent: Node$1;
1091
+ }
1092
+ interface UnaryExpression extends Span {
1093
+ type: "UnaryExpression";
1094
+ operator: UnaryOperator;
1095
+ argument: Expression;
1096
+ prefix: true;
1097
+ parent: Node$1;
1098
+ }
1099
+ interface BinaryExpression extends Span {
1100
+ type: "BinaryExpression";
1101
+ left: Expression;
1102
+ operator: BinaryOperator;
1103
+ right: Expression;
1104
+ parent: Node$1;
1105
+ }
1106
+ interface PrivateInExpression extends Span {
1107
+ type: "BinaryExpression";
1108
+ left: PrivateIdentifier;
1109
+ operator: "in";
1110
+ right: Expression;
1111
+ parent: Node$1;
1112
+ }
1113
+ interface LogicalExpression extends Span {
1114
+ type: "LogicalExpression";
1115
+ left: Expression;
1116
+ operator: LogicalOperator;
1117
+ right: Expression;
1118
+ parent: Node$1;
1119
+ }
1120
+ interface ConditionalExpression extends Span {
1121
+ type: "ConditionalExpression";
1122
+ test: Expression;
1123
+ consequent: Expression;
1124
+ alternate: Expression;
1125
+ parent: Node$1;
1126
+ }
1127
+ interface AssignmentExpression extends Span {
1128
+ type: "AssignmentExpression";
1129
+ operator: AssignmentOperator;
1130
+ left: AssignmentTarget;
1131
+ right: Expression;
1132
+ parent: Node$1;
1133
+ }
1134
+ type AssignmentTarget = SimpleAssignmentTarget | AssignmentTargetPattern;
1135
+ type SimpleAssignmentTarget = IdentifierReference | TSAsExpression | TSSatisfiesExpression | TSNonNullExpression | TSTypeAssertion | MemberExpression;
1136
+ type AssignmentTargetPattern = ArrayAssignmentTarget | ObjectAssignmentTarget;
1137
+ interface ArrayAssignmentTarget extends Span {
1138
+ type: "ArrayPattern";
1139
+ decorators?: [];
1140
+ elements: Array<AssignmentTargetMaybeDefault | AssignmentTargetRest | null>;
1141
+ optional?: false;
1142
+ typeAnnotation?: null;
1143
+ parent: Node$1;
1144
+ }
1145
+ interface ObjectAssignmentTarget extends Span {
1146
+ type: "ObjectPattern";
1147
+ decorators?: [];
1148
+ properties: Array<AssignmentTargetProperty | AssignmentTargetRest>;
1149
+ optional?: false;
1150
+ typeAnnotation?: null;
1151
+ parent: Node$1;
1152
+ }
1153
+ interface AssignmentTargetRest extends Span {
1154
+ type: "RestElement";
1155
+ decorators?: [];
1156
+ argument: AssignmentTarget;
1157
+ optional?: false;
1158
+ typeAnnotation?: null;
1159
+ value?: null;
1160
+ parent: Node$1;
1161
+ }
1162
+ type AssignmentTargetMaybeDefault = AssignmentTargetWithDefault | AssignmentTarget;
1163
+ interface AssignmentTargetWithDefault extends Span {
1164
+ type: "AssignmentPattern";
1165
+ decorators?: [];
1166
+ left: AssignmentTarget;
1167
+ right: Expression;
1168
+ optional?: false;
1169
+ typeAnnotation?: null;
1170
+ parent: Node$1;
1171
+ }
1172
+ type AssignmentTargetProperty = AssignmentTargetPropertyIdentifier | AssignmentTargetPropertyProperty;
1173
+ interface AssignmentTargetPropertyIdentifier extends Span {
1174
+ type: "Property";
1175
+ kind: "init";
1176
+ key: IdentifierReference;
1177
+ value: IdentifierReference | AssignmentTargetWithDefault;
1178
+ method: false;
1179
+ shorthand: true;
1180
+ computed: false;
1181
+ optional?: false;
1182
+ parent: Node$1;
1183
+ }
1184
+ interface AssignmentTargetPropertyProperty extends Span {
1185
+ type: "Property";
1186
+ kind: "init";
1187
+ key: PropertyKey$1;
1188
+ value: AssignmentTargetMaybeDefault;
1189
+ method: false;
1190
+ shorthand: false;
1191
+ computed: boolean;
1192
+ optional?: false;
1193
+ parent: Node$1;
1194
+ }
1195
+ interface SequenceExpression extends Span {
1196
+ type: "SequenceExpression";
1197
+ expressions: Array<Expression>;
1198
+ parent: Node$1;
1199
+ }
1200
+ interface Super extends Span {
1201
+ type: "Super";
1202
+ parent: Node$1;
1203
+ }
1204
+ interface AwaitExpression extends Span {
1205
+ type: "AwaitExpression";
1206
+ argument: Expression;
1207
+ parent: Node$1;
1208
+ }
1209
+ interface ChainExpression extends Span {
1210
+ type: "ChainExpression";
1211
+ expression: ChainElement;
1212
+ parent: Node$1;
1213
+ }
1214
+ type ChainElement = CallExpression | TSNonNullExpression | MemberExpression;
1215
+ interface ParenthesizedExpression extends Span {
1216
+ type: "ParenthesizedExpression";
1217
+ expression: Expression;
1218
+ parent: Node$1;
1219
+ }
1220
+ type Statement = BlockStatement | BreakStatement | ContinueStatement | DebuggerStatement | DoWhileStatement | EmptyStatement | ExpressionStatement | ForInStatement | ForOfStatement | ForStatement | IfStatement | LabeledStatement | ReturnStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | WithStatement | Declaration | ModuleDeclaration;
1221
+ interface Directive$1 extends Span {
1222
+ type: "ExpressionStatement";
1223
+ expression: StringLiteral;
1224
+ directive: string;
1225
+ parent: Node$1;
1226
+ }
1227
+ interface Hashbang extends Span {
1228
+ type: "Hashbang";
1229
+ value: string;
1230
+ parent: Node$1;
1231
+ }
1232
+ interface BlockStatement extends Span {
1233
+ type: "BlockStatement";
1234
+ body: Array<Statement>;
1235
+ parent: Node$1;
1236
+ }
1237
+ type Declaration = VariableDeclaration | Function$1 | Class | TSTypeAliasDeclaration | TSInterfaceDeclaration | TSEnumDeclaration | TSModuleDeclaration | TSGlobalDeclaration | TSImportEqualsDeclaration;
1238
+ interface VariableDeclaration extends Span {
1239
+ type: "VariableDeclaration";
1240
+ kind: VariableDeclarationKind;
1241
+ declarations: Array<VariableDeclarator>;
1242
+ declare?: boolean;
1243
+ parent: Node$1;
1244
+ }
1245
+ type VariableDeclarationKind = "var" | "let" | "const" | "using" | "await using";
1246
+ interface VariableDeclarator extends Span {
1247
+ type: "VariableDeclarator";
1248
+ id: BindingPattern;
1249
+ init: Expression | null;
1250
+ definite?: boolean;
1251
+ parent: Node$1;
1252
+ }
1253
+ interface EmptyStatement extends Span {
1254
+ type: "EmptyStatement";
1255
+ parent: Node$1;
1256
+ }
1257
+ interface ExpressionStatement extends Span {
1258
+ type: "ExpressionStatement";
1259
+ expression: Expression;
1260
+ directive?: string | null;
1261
+ parent: Node$1;
1262
+ }
1263
+ interface IfStatement extends Span {
1264
+ type: "IfStatement";
1265
+ test: Expression;
1266
+ consequent: Statement;
1267
+ alternate: Statement | null;
1268
+ parent: Node$1;
1269
+ }
1270
+ interface DoWhileStatement extends Span {
1271
+ type: "DoWhileStatement";
1272
+ body: Statement;
1273
+ test: Expression;
1274
+ parent: Node$1;
1275
+ }
1276
+ interface WhileStatement extends Span {
1277
+ type: "WhileStatement";
1278
+ test: Expression;
1279
+ body: Statement;
1280
+ parent: Node$1;
1281
+ }
1282
+ interface ForStatement extends Span {
1283
+ type: "ForStatement";
1284
+ init: ForStatementInit | null;
1285
+ test: Expression | null;
1286
+ update: Expression | null;
1287
+ body: Statement;
1288
+ parent: Node$1;
1289
+ }
1290
+ type ForStatementInit = VariableDeclaration | Expression;
1291
+ interface ForInStatement extends Span {
1292
+ type: "ForInStatement";
1293
+ left: ForStatementLeft;
1294
+ right: Expression;
1295
+ body: Statement;
1296
+ parent: Node$1;
1297
+ }
1298
+ type ForStatementLeft = VariableDeclaration | AssignmentTarget;
1299
+ interface ForOfStatement extends Span {
1300
+ type: "ForOfStatement";
1301
+ await: boolean;
1302
+ left: ForStatementLeft;
1303
+ right: Expression;
1304
+ body: Statement;
1305
+ parent: Node$1;
1306
+ }
1307
+ interface ContinueStatement extends Span {
1308
+ type: "ContinueStatement";
1309
+ label: LabelIdentifier | null;
1310
+ parent: Node$1;
1311
+ }
1312
+ interface BreakStatement extends Span {
1313
+ type: "BreakStatement";
1314
+ label: LabelIdentifier | null;
1315
+ parent: Node$1;
1316
+ }
1317
+ interface ReturnStatement extends Span {
1318
+ type: "ReturnStatement";
1319
+ argument: Expression | null;
1320
+ parent: Node$1;
1321
+ }
1322
+ interface WithStatement extends Span {
1323
+ type: "WithStatement";
1324
+ object: Expression;
1325
+ body: Statement;
1326
+ parent: Node$1;
1327
+ }
1328
+ interface SwitchStatement extends Span {
1329
+ type: "SwitchStatement";
1330
+ discriminant: Expression;
1331
+ cases: Array<SwitchCase>;
1332
+ parent: Node$1;
1333
+ }
1334
+ interface SwitchCase extends Span {
1335
+ type: "SwitchCase";
1336
+ test: Expression | null;
1337
+ consequent: Array<Statement>;
1338
+ parent: Node$1;
1339
+ }
1340
+ interface LabeledStatement extends Span {
1341
+ type: "LabeledStatement";
1342
+ label: LabelIdentifier;
1343
+ body: Statement;
1344
+ parent: Node$1;
1345
+ }
1346
+ interface ThrowStatement extends Span {
1347
+ type: "ThrowStatement";
1348
+ argument: Expression;
1349
+ parent: Node$1;
1350
+ }
1351
+ interface TryStatement extends Span {
1352
+ type: "TryStatement";
1353
+ block: BlockStatement;
1354
+ handler: CatchClause | null;
1355
+ finalizer: BlockStatement | null;
1356
+ parent: Node$1;
1357
+ }
1358
+ interface CatchClause extends Span {
1359
+ type: "CatchClause";
1360
+ param: BindingPattern | null;
1361
+ body: BlockStatement;
1362
+ parent: Node$1;
1363
+ }
1364
+ interface DebuggerStatement extends Span {
1365
+ type: "DebuggerStatement";
1366
+ parent: Node$1;
1367
+ }
1368
+ type BindingPattern = BindingIdentifier | ObjectPattern | ArrayPattern | AssignmentPattern;
1369
+ interface AssignmentPattern extends Span {
1370
+ type: "AssignmentPattern";
1371
+ decorators?: [];
1372
+ left: BindingPattern;
1373
+ right: Expression;
1374
+ optional?: false;
1375
+ typeAnnotation?: null;
1376
+ parent: Node$1;
1377
+ }
1378
+ interface ObjectPattern extends Span {
1379
+ type: "ObjectPattern";
1380
+ decorators?: [];
1381
+ properties: Array<BindingProperty | BindingRestElement>;
1382
+ optional?: false;
1383
+ typeAnnotation?: TSTypeAnnotation | null;
1384
+ parent: Node$1;
1385
+ }
1386
+ interface BindingProperty extends Span {
1387
+ type: "Property";
1388
+ kind: "init";
1389
+ key: PropertyKey$1;
1390
+ value: BindingPattern;
1391
+ method: false;
1392
+ shorthand: boolean;
1393
+ computed: boolean;
1394
+ optional?: false;
1395
+ parent: Node$1;
1396
+ }
1397
+ interface ArrayPattern extends Span {
1398
+ type: "ArrayPattern";
1399
+ decorators?: [];
1400
+ elements: Array<BindingPattern | BindingRestElement | null>;
1401
+ optional?: false;
1402
+ typeAnnotation?: TSTypeAnnotation | null;
1403
+ parent: Node$1;
1404
+ }
1405
+ interface BindingRestElement extends Span {
1406
+ type: "RestElement";
1407
+ decorators?: [];
1408
+ argument: BindingPattern;
1409
+ optional?: false;
1410
+ typeAnnotation?: TSTypeAnnotation | null;
1411
+ value?: null;
1412
+ parent: Node$1;
1413
+ }
1414
+ interface Function$1 extends Span {
1415
+ type: FunctionType;
1416
+ id: BindingIdentifier | null;
1417
+ generator: boolean;
1418
+ async: boolean;
1419
+ declare?: boolean;
1420
+ typeParameters?: TSTypeParameterDeclaration | null;
1421
+ params: ParamPattern[];
1422
+ returnType?: TSTypeAnnotation | null;
1423
+ body: FunctionBody | null;
1424
+ expression: false;
1425
+ parent: Node$1;
1426
+ }
1427
+ type ParamPattern = FormalParameter | TSParameterProperty | FormalParameterRest;
1428
+ type FunctionType = "FunctionDeclaration" | "FunctionExpression" | "TSDeclareFunction" | "TSEmptyBodyFunctionExpression";
1429
+ interface FormalParameterRest extends Span {
1430
+ type: "RestElement";
1431
+ argument: BindingPattern;
1432
+ decorators?: Array<Decorator>;
1433
+ optional?: boolean;
1434
+ typeAnnotation?: TSTypeAnnotation | null;
1435
+ value?: null;
1436
+ parent: Node$1;
1437
+ }
1438
+ type FormalParameter = {
1439
+ decorators?: Array<Decorator>;
1440
+ } & BindingPattern;
1441
+ interface TSParameterProperty extends Span {
1442
+ type: "TSParameterProperty";
1443
+ accessibility: TSAccessibility | null;
1444
+ decorators: Array<Decorator>;
1445
+ override: boolean;
1446
+ parameter: FormalParameter;
1447
+ readonly: boolean;
1448
+ static: boolean;
1449
+ parent: Node$1;
1450
+ }
1451
+ interface FunctionBody extends Span {
1452
+ type: "BlockStatement";
1453
+ body: Array<Directive$1 | Statement>;
1454
+ parent: Node$1;
1455
+ }
1456
+ interface ArrowFunctionExpression extends Span {
1457
+ type: "ArrowFunctionExpression";
1458
+ expression: boolean;
1459
+ async: boolean;
1460
+ typeParameters?: TSTypeParameterDeclaration | null;
1461
+ params: ParamPattern[];
1462
+ returnType?: TSTypeAnnotation | null;
1463
+ body: FunctionBody | Expression;
1464
+ id: null;
1465
+ generator: false;
1466
+ parent: Node$1;
1467
+ }
1468
+ interface YieldExpression extends Span {
1469
+ type: "YieldExpression";
1470
+ delegate: boolean;
1471
+ argument: Expression | null;
1472
+ parent: Node$1;
1473
+ }
1474
+ interface Class extends Span {
1475
+ type: ClassType;
1476
+ decorators: Array<Decorator>;
1477
+ id: BindingIdentifier | null;
1478
+ typeParameters?: TSTypeParameterDeclaration | null;
1479
+ superClass: Expression | null;
1480
+ superTypeArguments?: TSTypeParameterInstantiation | null;
1481
+ implements?: Array<TSClassImplements>;
1482
+ body: ClassBody;
1483
+ abstract?: boolean;
1484
+ declare?: boolean;
1485
+ parent: Node$1;
1486
+ }
1487
+ type ClassType = "ClassDeclaration" | "ClassExpression";
1488
+ interface ClassBody extends Span {
1489
+ type: "ClassBody";
1490
+ body: Array<ClassElement>;
1491
+ parent: Node$1;
1492
+ }
1493
+ type ClassElement = StaticBlock | MethodDefinition | PropertyDefinition | AccessorProperty | TSIndexSignature;
1494
+ interface MethodDefinition extends Span {
1495
+ type: MethodDefinitionType;
1496
+ decorators: Array<Decorator>;
1497
+ key: PropertyKey$1;
1498
+ value: Function$1;
1499
+ kind: MethodDefinitionKind;
1500
+ computed: boolean;
1501
+ static: boolean;
1502
+ override?: boolean;
1503
+ optional?: boolean;
1504
+ accessibility?: TSAccessibility | null;
1505
+ parent: Node$1;
1506
+ }
1507
+ type MethodDefinitionType = "MethodDefinition" | "TSAbstractMethodDefinition";
1508
+ interface PropertyDefinition extends Span {
1509
+ type: PropertyDefinitionType;
1510
+ decorators: Array<Decorator>;
1511
+ key: PropertyKey$1;
1512
+ typeAnnotation?: TSTypeAnnotation | null;
1513
+ value: Expression | null;
1514
+ computed: boolean;
1515
+ static: boolean;
1516
+ declare?: boolean;
1517
+ override?: boolean;
1518
+ optional?: boolean;
1519
+ definite?: boolean;
1520
+ readonly?: boolean;
1521
+ accessibility?: TSAccessibility | null;
1522
+ parent: Node$1;
1523
+ }
1524
+ type PropertyDefinitionType = "PropertyDefinition" | "TSAbstractPropertyDefinition";
1525
+ type MethodDefinitionKind = "constructor" | "method" | "get" | "set";
1526
+ interface PrivateIdentifier extends Span {
1527
+ type: "PrivateIdentifier";
1528
+ name: string;
1529
+ parent: Node$1;
1530
+ }
1531
+ interface StaticBlock extends Span {
1532
+ type: "StaticBlock";
1533
+ body: Array<Statement>;
1534
+ parent: Node$1;
1535
+ }
1536
+ type ModuleDeclaration = ImportDeclaration | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | TSExportAssignment | TSNamespaceExportDeclaration;
1537
+ type AccessorPropertyType = "AccessorProperty" | "TSAbstractAccessorProperty";
1538
+ interface AccessorProperty extends Span {
1539
+ type: AccessorPropertyType;
1540
+ decorators: Array<Decorator>;
1541
+ key: PropertyKey$1;
1542
+ typeAnnotation?: TSTypeAnnotation | null;
1543
+ value: Expression | null;
1544
+ computed: boolean;
1545
+ static: boolean;
1546
+ override?: boolean;
1547
+ definite?: boolean;
1548
+ accessibility?: TSAccessibility | null;
1549
+ declare?: false;
1550
+ optional?: false;
1551
+ readonly?: false;
1552
+ parent: Node$1;
1553
+ }
1554
+ interface ImportExpression extends Span {
1555
+ type: "ImportExpression";
1556
+ source: Expression;
1557
+ options: Expression | null;
1558
+ phase: ImportPhase | null;
1559
+ parent: Node$1;
1560
+ }
1561
+ interface ImportDeclaration extends Span {
1562
+ type: "ImportDeclaration";
1563
+ specifiers: Array<ImportDeclarationSpecifier>;
1564
+ source: StringLiteral;
1565
+ phase: ImportPhase | null;
1566
+ attributes: Array<ImportAttribute>;
1567
+ importKind?: ImportOrExportKind;
1568
+ parent: Node$1;
1569
+ }
1570
+ type ImportPhase = "source" | "defer";
1571
+ type ImportDeclarationSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier;
1572
+ interface ImportSpecifier extends Span {
1573
+ type: "ImportSpecifier";
1574
+ imported: ModuleExportName;
1575
+ local: BindingIdentifier;
1576
+ importKind?: ImportOrExportKind;
1577
+ parent: Node$1;
1578
+ }
1579
+ interface ImportDefaultSpecifier extends Span {
1580
+ type: "ImportDefaultSpecifier";
1581
+ local: BindingIdentifier;
1582
+ parent: Node$1;
1583
+ }
1584
+ interface ImportNamespaceSpecifier extends Span {
1585
+ type: "ImportNamespaceSpecifier";
1586
+ local: BindingIdentifier;
1587
+ parent: Node$1;
1588
+ }
1589
+ interface ImportAttribute extends Span {
1590
+ type: "ImportAttribute";
1591
+ key: ImportAttributeKey;
1592
+ value: StringLiteral;
1593
+ parent: Node$1;
1594
+ }
1595
+ type ImportAttributeKey = IdentifierName | StringLiteral;
1596
+ interface ExportNamedDeclaration extends Span {
1597
+ type: "ExportNamedDeclaration";
1598
+ declaration: Declaration | null;
1599
+ specifiers: Array<ExportSpecifier>;
1600
+ source: StringLiteral | null;
1601
+ exportKind?: ImportOrExportKind;
1602
+ attributes: Array<ImportAttribute>;
1603
+ parent: Node$1;
1604
+ }
1605
+ interface ExportDefaultDeclaration extends Span {
1606
+ type: "ExportDefaultDeclaration";
1607
+ declaration: ExportDefaultDeclarationKind;
1608
+ exportKind?: "value";
1609
+ parent: Node$1;
1610
+ }
1611
+ interface ExportAllDeclaration extends Span {
1612
+ type: "ExportAllDeclaration";
1613
+ exported: ModuleExportName | null;
1614
+ source: StringLiteral;
1615
+ attributes: Array<ImportAttribute>;
1616
+ exportKind?: ImportOrExportKind;
1617
+ parent: Node$1;
1618
+ }
1619
+ interface ExportSpecifier extends Span {
1620
+ type: "ExportSpecifier";
1621
+ local: ModuleExportName;
1622
+ exported: ModuleExportName;
1623
+ exportKind?: ImportOrExportKind;
1624
+ parent: Node$1;
1625
+ }
1626
+ type ExportDefaultDeclarationKind = Function$1 | Class | TSInterfaceDeclaration | Expression;
1627
+ type ModuleExportName = IdentifierName | IdentifierReference | StringLiteral;
1628
+ interface V8IntrinsicExpression extends Span {
1629
+ type: "V8IntrinsicExpression";
1630
+ name: IdentifierName;
1631
+ arguments: Array<Argument>;
1632
+ parent: Node$1;
1633
+ }
1634
+ interface BooleanLiteral extends Span {
1635
+ type: "Literal";
1636
+ value: boolean;
1637
+ raw: string | null;
1638
+ parent: Node$1;
1639
+ }
1640
+ interface NullLiteral extends Span {
1641
+ type: "Literal";
1642
+ value: null;
1643
+ raw: "null" | null;
1644
+ parent: Node$1;
1645
+ }
1646
+ interface NumericLiteral extends Span {
1647
+ type: "Literal";
1648
+ value: number;
1649
+ raw: string | null;
1650
+ parent: Node$1;
1651
+ }
1652
+ interface StringLiteral extends Span {
1653
+ type: "Literal";
1654
+ value: string;
1655
+ raw: string | null;
1656
+ parent: Node$1;
1657
+ }
1658
+ interface BigIntLiteral extends Span {
1659
+ type: "Literal";
1660
+ value: bigint;
1661
+ raw: string | null;
1662
+ bigint: string;
1663
+ parent: Node$1;
1664
+ }
1665
+ interface RegExpLiteral extends Span {
1666
+ type: "Literal";
1667
+ value: RegExp | null;
1668
+ raw: string | null;
1669
+ regex: {
1670
+ pattern: string;
1671
+ flags: string;
1672
+ };
1673
+ parent: Node$1;
1674
+ }
1675
+ interface JSXElement extends Span {
1676
+ type: "JSXElement";
1677
+ openingElement: JSXOpeningElement;
1678
+ children: Array<JSXChild>;
1679
+ closingElement: JSXClosingElement | null;
1680
+ parent: Node$1;
1681
+ }
1682
+ interface JSXOpeningElement extends Span {
1683
+ type: "JSXOpeningElement";
1684
+ name: JSXElementName;
1685
+ typeArguments?: TSTypeParameterInstantiation | null;
1686
+ attributes: Array<JSXAttributeItem>;
1687
+ selfClosing: boolean;
1688
+ parent: Node$1;
1689
+ }
1690
+ interface JSXClosingElement extends Span {
1691
+ type: "JSXClosingElement";
1692
+ name: JSXElementName;
1693
+ parent: Node$1;
1694
+ }
1695
+ interface JSXFragment extends Span {
1696
+ type: "JSXFragment";
1697
+ openingFragment: JSXOpeningFragment;
1698
+ children: Array<JSXChild>;
1699
+ closingFragment: JSXClosingFragment;
1700
+ parent: Node$1;
1701
+ }
1702
+ interface JSXOpeningFragment extends Span {
1703
+ type: "JSXOpeningFragment";
1704
+ attributes?: [];
1705
+ selfClosing?: false;
1706
+ parent: Node$1;
1707
+ }
1708
+ interface JSXClosingFragment extends Span {
1709
+ type: "JSXClosingFragment";
1710
+ parent: Node$1;
1711
+ }
1712
+ type JSXElementName = JSXIdentifier | JSXNamespacedName | JSXMemberExpression;
1713
+ interface JSXNamespacedName extends Span {
1714
+ type: "JSXNamespacedName";
1715
+ namespace: JSXIdentifier;
1716
+ name: JSXIdentifier;
1717
+ parent: Node$1;
1718
+ }
1719
+ interface JSXMemberExpression extends Span {
1720
+ type: "JSXMemberExpression";
1721
+ object: JSXMemberExpressionObject;
1722
+ property: JSXIdentifier;
1723
+ parent: Node$1;
1724
+ }
1725
+ type JSXMemberExpressionObject = JSXIdentifier | JSXMemberExpression;
1726
+ interface JSXExpressionContainer extends Span {
1727
+ type: "JSXExpressionContainer";
1728
+ expression: JSXExpression;
1729
+ parent: Node$1;
1730
+ }
1731
+ type JSXExpression = JSXEmptyExpression | Expression;
1732
+ interface JSXEmptyExpression extends Span {
1733
+ type: "JSXEmptyExpression";
1734
+ parent: Node$1;
1735
+ }
1736
+ type JSXAttributeItem = JSXAttribute | JSXSpreadAttribute;
1737
+ interface JSXAttribute extends Span {
1738
+ type: "JSXAttribute";
1739
+ name: JSXAttributeName;
1740
+ value: JSXAttributeValue | null;
1741
+ parent: Node$1;
1742
+ }
1743
+ interface JSXSpreadAttribute extends Span {
1744
+ type: "JSXSpreadAttribute";
1745
+ argument: Expression;
1746
+ parent: Node$1;
1747
+ }
1748
+ type JSXAttributeName = JSXIdentifier | JSXNamespacedName;
1749
+ type JSXAttributeValue = StringLiteral | JSXExpressionContainer | JSXElement | JSXFragment;
1750
+ interface JSXIdentifier extends Span {
1751
+ type: "JSXIdentifier";
1752
+ name: string;
1753
+ parent: Node$1;
1754
+ }
1755
+ type JSXChild = JSXText | JSXElement | JSXFragment | JSXExpressionContainer | JSXSpreadChild;
1756
+ interface JSXSpreadChild extends Span {
1757
+ type: "JSXSpreadChild";
1758
+ expression: Expression;
1759
+ parent: Node$1;
1760
+ }
1761
+ interface JSXText extends Span {
1762
+ type: "JSXText";
1763
+ value: string;
1764
+ raw: string | null;
1765
+ parent: Node$1;
1766
+ }
1767
+ interface TSThisParameter extends Span {
1768
+ type: "Identifier";
1769
+ decorators: [];
1770
+ name: "this";
1771
+ optional: false;
1772
+ typeAnnotation: TSTypeAnnotation | null;
1773
+ parent: Node$1;
1774
+ }
1775
+ interface TSEnumDeclaration extends Span {
1776
+ type: "TSEnumDeclaration";
1777
+ id: BindingIdentifier;
1778
+ body: TSEnumBody;
1779
+ const: boolean;
1780
+ declare: boolean;
1781
+ parent: Node$1;
1782
+ }
1783
+ interface TSEnumBody extends Span {
1784
+ type: "TSEnumBody";
1785
+ members: Array<TSEnumMember>;
1786
+ parent: Node$1;
1787
+ }
1788
+ interface TSEnumMember extends Span {
1789
+ type: "TSEnumMember";
1790
+ id: TSEnumMemberName;
1791
+ initializer: Expression | null;
1792
+ computed: boolean;
1793
+ parent: Node$1;
1794
+ }
1795
+ type TSEnumMemberName = IdentifierName | StringLiteral | TemplateLiteral;
1796
+ interface TSTypeAnnotation extends Span {
1797
+ type: "TSTypeAnnotation";
1798
+ typeAnnotation: TSType;
1799
+ parent: Node$1;
1800
+ }
1801
+ interface TSLiteralType extends Span {
1802
+ type: "TSLiteralType";
1803
+ literal: TSLiteral;
1804
+ parent: Node$1;
1805
+ }
1806
+ type TSLiteral = BooleanLiteral | NumericLiteral | BigIntLiteral | StringLiteral | TemplateLiteral | UnaryExpression;
1807
+ type TSType = TSAnyKeyword | TSBigIntKeyword | TSBooleanKeyword | TSIntrinsicKeyword | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSStringKeyword | TSSymbolKeyword | TSUndefinedKeyword | TSUnknownKeyword | TSVoidKeyword | TSArrayType | TSConditionalType | TSConstructorType | TSFunctionType | TSImportType | TSIndexedAccessType | TSInferType | TSIntersectionType | TSLiteralType | TSMappedType | TSNamedTupleMember | TSTemplateLiteralType | TSThisType | TSTupleType | TSTypeLiteral | TSTypeOperator | TSTypePredicate | TSTypeQuery | TSTypeReference | TSUnionType | TSParenthesizedType | JSDocNullableType | JSDocNonNullableType | JSDocUnknownType;
1808
+ interface TSConditionalType extends Span {
1809
+ type: "TSConditionalType";
1810
+ checkType: TSType;
1811
+ extendsType: TSType;
1812
+ trueType: TSType;
1813
+ falseType: TSType;
1814
+ parent: Node$1;
1815
+ }
1816
+ interface TSUnionType extends Span {
1817
+ type: "TSUnionType";
1818
+ types: Array<TSType>;
1819
+ parent: Node$1;
1820
+ }
1821
+ interface TSIntersectionType extends Span {
1822
+ type: "TSIntersectionType";
1823
+ types: Array<TSType>;
1824
+ parent: Node$1;
1825
+ }
1826
+ interface TSParenthesizedType extends Span {
1827
+ type: "TSParenthesizedType";
1828
+ typeAnnotation: TSType;
1829
+ parent: Node$1;
1830
+ }
1831
+ interface TSTypeOperator extends Span {
1832
+ type: "TSTypeOperator";
1833
+ operator: TSTypeOperatorOperator;
1834
+ typeAnnotation: TSType;
1835
+ parent: Node$1;
1836
+ }
1837
+ type TSTypeOperatorOperator = "keyof" | "unique" | "readonly";
1838
+ interface TSArrayType extends Span {
1839
+ type: "TSArrayType";
1840
+ elementType: TSType;
1841
+ parent: Node$1;
1842
+ }
1843
+ interface TSIndexedAccessType extends Span {
1844
+ type: "TSIndexedAccessType";
1845
+ objectType: TSType;
1846
+ indexType: TSType;
1847
+ parent: Node$1;
1848
+ }
1849
+ interface TSTupleType extends Span {
1850
+ type: "TSTupleType";
1851
+ elementTypes: Array<TSTupleElement>;
1852
+ parent: Node$1;
1853
+ }
1854
+ interface TSNamedTupleMember extends Span {
1855
+ type: "TSNamedTupleMember";
1856
+ label: IdentifierName;
1857
+ elementType: TSTupleElement;
1858
+ optional: boolean;
1859
+ parent: Node$1;
1860
+ }
1861
+ interface TSOptionalType extends Span {
1862
+ type: "TSOptionalType";
1863
+ typeAnnotation: TSType;
1864
+ parent: Node$1;
1865
+ }
1866
+ interface TSRestType extends Span {
1867
+ type: "TSRestType";
1868
+ typeAnnotation: TSType;
1869
+ parent: Node$1;
1870
+ }
1871
+ type TSTupleElement = TSOptionalType | TSRestType | TSType;
1872
+ interface TSAnyKeyword extends Span {
1873
+ type: "TSAnyKeyword";
1874
+ parent: Node$1;
1875
+ }
1876
+ interface TSStringKeyword extends Span {
1877
+ type: "TSStringKeyword";
1878
+ parent: Node$1;
1879
+ }
1880
+ interface TSBooleanKeyword extends Span {
1881
+ type: "TSBooleanKeyword";
1882
+ parent: Node$1;
1883
+ }
1884
+ interface TSNumberKeyword extends Span {
1885
+ type: "TSNumberKeyword";
1886
+ parent: Node$1;
1887
+ }
1888
+ interface TSNeverKeyword extends Span {
1889
+ type: "TSNeverKeyword";
1890
+ parent: Node$1;
1891
+ }
1892
+ interface TSIntrinsicKeyword extends Span {
1893
+ type: "TSIntrinsicKeyword";
1894
+ parent: Node$1;
1895
+ }
1896
+ interface TSUnknownKeyword extends Span {
1897
+ type: "TSUnknownKeyword";
1898
+ parent: Node$1;
1899
+ }
1900
+ interface TSNullKeyword extends Span {
1901
+ type: "TSNullKeyword";
1902
+ parent: Node$1;
1903
+ }
1904
+ interface TSUndefinedKeyword extends Span {
1905
+ type: "TSUndefinedKeyword";
1906
+ parent: Node$1;
1907
+ }
1908
+ interface TSVoidKeyword extends Span {
1909
+ type: "TSVoidKeyword";
1910
+ parent: Node$1;
1911
+ }
1912
+ interface TSSymbolKeyword extends Span {
1913
+ type: "TSSymbolKeyword";
1914
+ parent: Node$1;
1915
+ }
1916
+ interface TSThisType extends Span {
1917
+ type: "TSThisType";
1918
+ parent: Node$1;
1919
+ }
1920
+ interface TSObjectKeyword extends Span {
1921
+ type: "TSObjectKeyword";
1922
+ parent: Node$1;
1923
+ }
1924
+ interface TSBigIntKeyword extends Span {
1925
+ type: "TSBigIntKeyword";
1926
+ parent: Node$1;
1927
+ }
1928
+ interface TSTypeReference extends Span {
1929
+ type: "TSTypeReference";
1930
+ typeName: TSTypeName;
1931
+ typeArguments: TSTypeParameterInstantiation | null;
1932
+ parent: Node$1;
1933
+ }
1934
+ type TSTypeName = IdentifierReference | TSQualifiedName | ThisExpression;
1935
+ interface TSQualifiedName extends Span {
1936
+ type: "TSQualifiedName";
1937
+ left: TSTypeName;
1938
+ right: IdentifierName;
1939
+ parent: Node$1;
1940
+ }
1941
+ interface TSTypeParameterInstantiation extends Span {
1942
+ type: "TSTypeParameterInstantiation";
1943
+ params: Array<TSType>;
1944
+ parent: Node$1;
1945
+ }
1946
+ interface TSTypeParameter extends Span {
1947
+ type: "TSTypeParameter";
1948
+ name: BindingIdentifier;
1949
+ constraint: TSType | null;
1950
+ default: TSType | null;
1951
+ in: boolean;
1952
+ out: boolean;
1953
+ const: boolean;
1954
+ parent: Node$1;
1955
+ }
1956
+ interface TSTypeParameterDeclaration extends Span {
1957
+ type: "TSTypeParameterDeclaration";
1958
+ params: Array<TSTypeParameter>;
1959
+ parent: Node$1;
1960
+ }
1961
+ interface TSTypeAliasDeclaration extends Span {
1962
+ type: "TSTypeAliasDeclaration";
1963
+ id: BindingIdentifier;
1964
+ typeParameters: TSTypeParameterDeclaration | null;
1965
+ typeAnnotation: TSType;
1966
+ declare: boolean;
1967
+ parent: Node$1;
1968
+ }
1969
+ type TSAccessibility = "private" | "protected" | "public";
1970
+ interface TSClassImplements extends Span {
1971
+ type: "TSClassImplements";
1972
+ expression: IdentifierReference | ThisExpression | MemberExpression;
1973
+ typeArguments: TSTypeParameterInstantiation | null;
1974
+ parent: Node$1;
1975
+ }
1976
+ interface TSInterfaceDeclaration extends Span {
1977
+ type: "TSInterfaceDeclaration";
1978
+ id: BindingIdentifier;
1979
+ typeParameters: TSTypeParameterDeclaration | null;
1980
+ extends: Array<TSInterfaceHeritage>;
1981
+ body: TSInterfaceBody;
1982
+ declare: boolean;
1983
+ parent: Node$1;
1984
+ }
1985
+ interface TSInterfaceBody extends Span {
1986
+ type: "TSInterfaceBody";
1987
+ body: Array<TSSignature>;
1988
+ parent: Node$1;
1989
+ }
1990
+ interface TSPropertySignature extends Span {
1991
+ type: "TSPropertySignature";
1992
+ computed: boolean;
1993
+ optional: boolean;
1994
+ readonly: boolean;
1995
+ key: PropertyKey$1;
1996
+ typeAnnotation: TSTypeAnnotation | null;
1997
+ accessibility: null;
1998
+ static: false;
1999
+ parent: Node$1;
2000
+ }
2001
+ type TSSignature = TSIndexSignature | TSPropertySignature | TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSMethodSignature;
2002
+ interface TSIndexSignature extends Span {
2003
+ type: "TSIndexSignature";
2004
+ parameters: Array<TSIndexSignatureName>;
2005
+ typeAnnotation: TSTypeAnnotation;
2006
+ readonly: boolean;
2007
+ static: boolean;
2008
+ accessibility: null;
2009
+ parent: Node$1;
2010
+ }
2011
+ interface TSCallSignatureDeclaration extends Span {
2012
+ type: "TSCallSignatureDeclaration";
2013
+ typeParameters: TSTypeParameterDeclaration | null;
2014
+ params: ParamPattern[];
2015
+ returnType: TSTypeAnnotation | null;
2016
+ parent: Node$1;
2017
+ }
2018
+ type TSMethodSignatureKind = "method" | "get" | "set";
2019
+ interface TSMethodSignature extends Span {
2020
+ type: "TSMethodSignature";
2021
+ key: PropertyKey$1;
2022
+ computed: boolean;
2023
+ optional: boolean;
2024
+ kind: TSMethodSignatureKind;
2025
+ typeParameters: TSTypeParameterDeclaration | null;
2026
+ params: ParamPattern[];
2027
+ returnType: TSTypeAnnotation | null;
2028
+ accessibility: null;
2029
+ readonly: false;
2030
+ static: false;
2031
+ parent: Node$1;
2032
+ }
2033
+ interface TSConstructSignatureDeclaration extends Span {
2034
+ type: "TSConstructSignatureDeclaration";
2035
+ typeParameters: TSTypeParameterDeclaration | null;
2036
+ params: ParamPattern[];
2037
+ returnType: TSTypeAnnotation | null;
2038
+ parent: Node$1;
2039
+ }
2040
+ interface TSIndexSignatureName extends Span {
2041
+ type: "Identifier";
2042
+ decorators: [];
2043
+ name: string;
2044
+ optional: false;
2045
+ typeAnnotation: TSTypeAnnotation;
2046
+ parent: Node$1;
2047
+ }
2048
+ interface TSInterfaceHeritage extends Span {
2049
+ type: "TSInterfaceHeritage";
2050
+ expression: Expression;
2051
+ typeArguments: TSTypeParameterInstantiation | null;
2052
+ parent: Node$1;
2053
+ }
2054
+ interface TSTypePredicate extends Span {
2055
+ type: "TSTypePredicate";
2056
+ parameterName: TSTypePredicateName;
2057
+ asserts: boolean;
2058
+ typeAnnotation: TSTypeAnnotation | null;
2059
+ parent: Node$1;
2060
+ }
2061
+ type TSTypePredicateName = IdentifierName | TSThisType;
2062
+ type TSModuleDeclarationKind = "module" | "namespace";
2063
+ interface TSModuleDeclaration extends Span {
2064
+ type: "TSModuleDeclaration";
2065
+ id: BindingIdentifier | StringLiteral | TSQualifiedName;
2066
+ body: TSModuleBlock | null;
2067
+ kind: TSModuleDeclarationKind;
2068
+ declare: boolean;
2069
+ global: false;
2070
+ parent: Node$1;
2071
+ }
2072
+ interface TSGlobalDeclaration extends Span {
2073
+ type: "TSModuleDeclaration";
2074
+ id: IdentifierName;
2075
+ body: TSModuleBlock;
2076
+ kind: "global";
2077
+ declare: boolean;
2078
+ global: true;
2079
+ parent: Node$1;
2080
+ }
2081
+ interface TSModuleBlock extends Span {
2082
+ type: "TSModuleBlock";
2083
+ body: Array<Directive$1 | Statement>;
2084
+ parent: Node$1;
2085
+ }
2086
+ interface TSTypeLiteral extends Span {
2087
+ type: "TSTypeLiteral";
2088
+ members: Array<TSSignature>;
2089
+ parent: Node$1;
2090
+ }
2091
+ interface TSInferType extends Span {
2092
+ type: "TSInferType";
2093
+ typeParameter: TSTypeParameter;
2094
+ parent: Node$1;
2095
+ }
2096
+ interface TSTypeQuery extends Span {
2097
+ type: "TSTypeQuery";
2098
+ exprName: TSTypeQueryExprName;
2099
+ typeArguments: TSTypeParameterInstantiation | null;
2100
+ parent: Node$1;
2101
+ }
2102
+ type TSTypeQueryExprName = TSImportType | TSTypeName;
2103
+ interface TSImportType extends Span {
2104
+ type: "TSImportType";
2105
+ source: StringLiteral;
2106
+ options: ObjectExpression | null;
2107
+ qualifier: TSImportTypeQualifier | null;
2108
+ typeArguments: TSTypeParameterInstantiation | null;
2109
+ parent: Node$1;
2110
+ }
2111
+ type TSImportTypeQualifier = IdentifierName | TSImportTypeQualifiedName;
2112
+ interface TSImportTypeQualifiedName extends Span {
2113
+ type: "TSQualifiedName";
2114
+ left: TSImportTypeQualifier;
2115
+ right: IdentifierName;
2116
+ parent: Node$1;
2117
+ }
2118
+ interface TSFunctionType extends Span {
2119
+ type: "TSFunctionType";
2120
+ typeParameters: TSTypeParameterDeclaration | null;
2121
+ params: ParamPattern[];
2122
+ returnType: TSTypeAnnotation;
2123
+ parent: Node$1;
2124
+ }
2125
+ interface TSConstructorType extends Span {
2126
+ type: "TSConstructorType";
2127
+ abstract: boolean;
2128
+ typeParameters: TSTypeParameterDeclaration | null;
2129
+ params: ParamPattern[];
2130
+ returnType: TSTypeAnnotation;
2131
+ parent: Node$1;
2132
+ }
2133
+ interface TSMappedType extends Span {
2134
+ type: "TSMappedType";
2135
+ key: BindingIdentifier;
2136
+ constraint: TSType;
2137
+ nameType: TSType | null;
2138
+ typeAnnotation: TSType | null;
2139
+ optional: TSMappedTypeModifierOperator | false;
2140
+ readonly: TSMappedTypeModifierOperator | null;
2141
+ parent: Node$1;
2142
+ }
2143
+ type TSMappedTypeModifierOperator = true | "+" | "-";
2144
+ interface TSTemplateLiteralType extends Span {
2145
+ type: "TSTemplateLiteralType";
2146
+ quasis: Array<TemplateElement>;
2147
+ types: Array<TSType>;
2148
+ parent: Node$1;
2149
+ }
2150
+ interface TSAsExpression extends Span {
2151
+ type: "TSAsExpression";
2152
+ expression: Expression;
2153
+ typeAnnotation: TSType;
2154
+ parent: Node$1;
2155
+ }
2156
+ interface TSSatisfiesExpression extends Span {
2157
+ type: "TSSatisfiesExpression";
2158
+ expression: Expression;
2159
+ typeAnnotation: TSType;
2160
+ parent: Node$1;
2161
+ }
2162
+ interface TSTypeAssertion extends Span {
2163
+ type: "TSTypeAssertion";
2164
+ typeAnnotation: TSType;
2165
+ expression: Expression;
2166
+ parent: Node$1;
2167
+ }
2168
+ interface TSImportEqualsDeclaration extends Span {
2169
+ type: "TSImportEqualsDeclaration";
2170
+ id: BindingIdentifier;
2171
+ moduleReference: TSModuleReference;
2172
+ importKind: ImportOrExportKind;
2173
+ parent: Node$1;
2174
+ }
2175
+ type TSModuleReference = TSExternalModuleReference | IdentifierReference | TSQualifiedName;
2176
+ interface TSExternalModuleReference extends Span {
2177
+ type: "TSExternalModuleReference";
2178
+ expression: StringLiteral;
2179
+ parent: Node$1;
2180
+ }
2181
+ interface TSNonNullExpression extends Span {
2182
+ type: "TSNonNullExpression";
2183
+ expression: Expression;
2184
+ parent: Node$1;
2185
+ }
2186
+ interface Decorator extends Span {
2187
+ type: "Decorator";
2188
+ expression: Expression;
2189
+ parent: Node$1;
2190
+ }
2191
+ interface TSExportAssignment extends Span {
2192
+ type: "TSExportAssignment";
2193
+ expression: Expression;
2194
+ parent: Node$1;
2195
+ }
2196
+ interface TSNamespaceExportDeclaration extends Span {
2197
+ type: "TSNamespaceExportDeclaration";
2198
+ id: IdentifierName;
2199
+ parent: Node$1;
2200
+ }
2201
+ interface TSInstantiationExpression extends Span {
2202
+ type: "TSInstantiationExpression";
2203
+ expression: Expression;
2204
+ typeArguments: TSTypeParameterInstantiation;
2205
+ parent: Node$1;
2206
+ }
2207
+ type ImportOrExportKind = "value" | "type";
2208
+ interface JSDocNullableType extends Span {
2209
+ type: "TSJSDocNullableType";
2210
+ typeAnnotation: TSType;
2211
+ postfix: boolean;
2212
+ parent: Node$1;
2213
+ }
2214
+ interface JSDocNonNullableType extends Span {
2215
+ type: "TSJSDocNonNullableType";
2216
+ typeAnnotation: TSType;
2217
+ postfix: boolean;
2218
+ parent: Node$1;
2219
+ }
2220
+ interface JSDocUnknownType extends Span {
2221
+ type: "TSJSDocUnknownType";
2222
+ parent: Node$1;
2223
+ }
2224
+ type ModuleKind = "script" | "module" | "commonjs";
2225
+ type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "||=" | "&&=" | "??=";
2226
+ type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "+" | "-" | "*" | "/" | "%" | "**" | "<<" | ">>" | ">>>" | "|" | "^" | "&" | "in" | "instanceof";
2227
+ type LogicalOperator = "||" | "&&" | "??";
2228
+ type UnaryOperator = "+" | "-" | "!" | "~" | "typeof" | "void" | "delete";
2229
+ type UpdateOperator = "++" | "--";
2230
+ type Node$1 = Program | IdentifierName | IdentifierReference | BindingIdentifier | LabelIdentifier | ThisExpression | ArrayExpression | ObjectExpression | ObjectProperty | TemplateLiteral | TaggedTemplateExpression | TemplateElement | ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression | CallExpression | NewExpression | MetaProperty | SpreadElement | UpdateExpression | UnaryExpression | BinaryExpression | PrivateInExpression | LogicalExpression | ConditionalExpression | AssignmentExpression | ArrayAssignmentTarget | ObjectAssignmentTarget | AssignmentTargetRest | AssignmentTargetWithDefault | AssignmentTargetPropertyIdentifier | AssignmentTargetPropertyProperty | SequenceExpression | Super | AwaitExpression | ChainExpression | ParenthesizedExpression | Directive$1 | Hashbang | BlockStatement | VariableDeclaration | VariableDeclarator | EmptyStatement | ExpressionStatement | IfStatement | DoWhileStatement | WhileStatement | ForStatement | ForInStatement | ForOfStatement | ContinueStatement | BreakStatement | ReturnStatement | WithStatement | SwitchStatement | SwitchCase | LabeledStatement | ThrowStatement | TryStatement | CatchClause | DebuggerStatement | AssignmentPattern | ObjectPattern | BindingProperty | ArrayPattern | BindingRestElement | Function$1 | FunctionBody | ArrowFunctionExpression | YieldExpression | Class | ClassBody | MethodDefinition | PropertyDefinition | PrivateIdentifier | StaticBlock | AccessorProperty | ImportExpression | ImportDeclaration | ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportAttribute | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration | ExportSpecifier | V8IntrinsicExpression | BooleanLiteral | NullLiteral | NumericLiteral | StringLiteral | BigIntLiteral | RegExpLiteral | JSXElement | JSXOpeningElement | JSXClosingElement | JSXFragment | JSXOpeningFragment | JSXClosingFragment | JSXNamespacedName | JSXMemberExpression | JSXExpressionContainer | JSXEmptyExpression | JSXAttribute | JSXSpreadAttribute | JSXIdentifier | JSXSpreadChild | JSXText | TSThisParameter | TSEnumDeclaration | TSEnumBody | TSEnumMember | TSTypeAnnotation | TSLiteralType | TSConditionalType | TSUnionType | TSIntersectionType | TSParenthesizedType | TSTypeOperator | TSArrayType | TSIndexedAccessType | TSTupleType | TSNamedTupleMember | TSOptionalType | TSRestType | TSAnyKeyword | TSStringKeyword | TSBooleanKeyword | TSNumberKeyword | TSNeverKeyword | TSIntrinsicKeyword | TSUnknownKeyword | TSNullKeyword | TSUndefinedKeyword | TSVoidKeyword | TSSymbolKeyword | TSThisType | TSObjectKeyword | TSBigIntKeyword | TSTypeReference | TSQualifiedName | TSTypeParameterInstantiation | TSTypeParameter | TSTypeParameterDeclaration | TSTypeAliasDeclaration | TSClassImplements | TSInterfaceDeclaration | TSInterfaceBody | TSPropertySignature | TSIndexSignature | TSCallSignatureDeclaration | TSMethodSignature | TSConstructSignatureDeclaration | TSIndexSignatureName | TSInterfaceHeritage | TSTypePredicate | TSModuleDeclaration | TSGlobalDeclaration | TSModuleBlock | TSTypeLiteral | TSInferType | TSTypeQuery | TSImportType | TSImportTypeQualifiedName | TSFunctionType | TSConstructorType | TSMappedType | TSTemplateLiteralType | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSImportEqualsDeclaration | TSExternalModuleReference | TSNonNullExpression | Decorator | TSExportAssignment | TSNamespaceExportDeclaration | TSInstantiationExpression | JSDocNullableType | JSDocNonNullableType | JSDocUnknownType | ParamPattern;
2231
+ interface Node extends Span {}
2232
+ type NodeOrToken = Node | TokenType | CommentType;
2233
+ /**
2234
+ * Range of source offsets.
2235
+ */
2236
+ type Range = [number, number];
2237
+ /**
2238
+ * Interface for any type which has `range` field.
2239
+ */
2240
+ interface Ranged {
2241
+ range: Range;
2242
+ }
2243
+ /**
2244
+ * Interface for any type which has location properties.
2245
+ */
2246
+ interface Span extends Ranged {
2247
+ start: number;
2248
+ end: number;
2249
+ loc: Location;
2250
+ }
2251
+ /**
2252
+ * Source code location.
2253
+ */
2254
+ interface Location {
2255
+ start: LineColumn;
2256
+ end: LineColumn;
2257
+ }
2258
+ /**
2259
+ * Line number + column number pair.
2260
+ * `line` is 1-indexed, `column` is 0-indexed.
2261
+ */
2262
+ interface LineColumn {
2263
+ line: number;
2264
+ column: number;
2265
+ }
2266
+ /**
2267
+ * Convert a source text index into a (line, column) pair.
2268
+ * @param offset - The index of a character in a file.
2269
+ * @returns `{line, column}` location object with 1-indexed line and 0-indexed column.
2270
+ * @throws {TypeError|RangeError} If non-numeric `offset`, or `offset` out of range.
2271
+ */
2272
+ declare function getLineColumnFromOffset(offset: number): LineColumn;
2273
+ /**
2274
+ * Convert a `{ line, column }` pair into a range index.
2275
+ * @param loc - A line/column location.
2276
+ * @returns The character index of the location in the file.
2277
+ * @throws {TypeError|RangeError} If `loc` is not an object with a numeric `line` and `column`,
2278
+ * or if the `line` is less than or equal to zero, or the line or column is out of the expected range.
2279
+ */
2280
+ declare function getOffsetFromLineColumn(loc: LineColumn): number;
2281
+ /**
2282
+ * Get the range of the given node or token.
2283
+ * @param nodeOrToken - Node or token to get the range of
2284
+ * @returns Range of the node or token
2285
+ */
2286
+ declare function getRange(nodeOrToken: NodeOrToken): Range;
2287
+ /**
2288
+ * Get the location of the given node or token.
2289
+ * @param nodeOrToken - Node or token to get the location of
2290
+ * @returns Location of the node or token
2291
+ */
2292
+ declare function getLoc(nodeOrToken: NodeOrToken): Location;
2293
+ /**
2294
+ * Get the deepest node containing a range index.
2295
+ * @param offset - Range index of the desired node
2296
+ * @returns The node if found, or `null` if not found
2297
+ */
2298
+ declare function getNodeByRangeIndex(offset: number): Node$1 | null;
2299
+ //#endregion
2300
+ //#region src-js/plugins/fix.d.ts
2301
+ type FixFn = (fixer: Fixer) => Fix | Array<Fix | null | undefined> | IterableIterator<Fix | null | undefined> | null | undefined;
2302
+ /**
2303
+ * Fix, as returned by `fix` function.
2304
+ *
2305
+ * `range` offsets are relative to start of the source text.
2306
+ * When the file has a BOM, they are relative to the start of the source text *without* the BOM.
2307
+ *
2308
+ * To represent a position *before* a BOM, -1 is used to mean "before the BOM".
2309
+ * ESLint's `unicode-bom` rule produces a fix `{ range: [-1, 0], text: "" }` to remove a BOM.
2310
+ */
2311
+ interface Fix {
2312
+ range: Range;
2313
+ text: string;
2314
+ }
2315
+ declare const FIXER: Readonly<{
2316
+ insertTextBefore(nodeOrToken: Ranged, text: string): Fix;
2317
+ insertTextBeforeRange(range: Range, text: string): Fix;
2318
+ insertTextAfter(nodeOrToken: Ranged, text: string): Fix;
2319
+ insertTextAfterRange(range: Range, text: string): Fix;
2320
+ remove(nodeOrToken: Ranged): Fix;
2321
+ removeRange(range: Range): Fix;
2322
+ replaceText(nodeOrToken: Ranged, text: string): Fix;
2323
+ replaceTextRange(range: Range, text: string): Fix;
2324
+ }>;
2325
+ type Fixer = typeof FIXER;
2326
+ //#endregion
2327
+ //#region src-js/plugins/report.d.ts
2328
+ /**
2329
+ * Diagnostic object.
2330
+ * Passed to `Context#report()`.
2331
+ *
2332
+ * - Either `message` or `messageId` property must be provided.
2333
+ * - Either `node` or `loc` property must be provided.
2334
+ */
2335
+ type Diagnostic = RequireAtLeastOne<RequireAtLeastOne<DiagnosticBase, "node" | "loc">, "message" | "messageId">;
2336
+ interface DiagnosticBase {
2337
+ message?: string | null | undefined;
2338
+ messageId?: string | null | undefined;
2339
+ node?: Ranged;
2340
+ loc?: LocationWithOptionalEnd | LineColumn;
2341
+ data?: DiagnosticData | null | undefined;
2342
+ fix?: FixFn;
2343
+ suggest?: Suggestion[] | null | undefined;
2344
+ }
2345
+ /**
2346
+ * Location with `end` property optional.
2347
+ */
2348
+ interface LocationWithOptionalEnd {
2349
+ start: LineColumn;
2350
+ end?: LineColumn | null | undefined;
2351
+ }
2352
+ /**
2353
+ * Data to interpolate into a diagnostic message.
2354
+ */
2355
+ type DiagnosticData = Record<string, string | number | boolean | bigint | null | undefined>;
2356
+ /**
2357
+ * Suggested fix.
2358
+ */
2359
+ type Suggestion = RequireAtLeastOne<SuggestionBase, "desc" | "messageId">;
2360
+ interface SuggestionBase {
2361
+ desc?: string;
2362
+ messageId?: string;
2363
+ data?: DiagnosticData | null | undefined;
2364
+ fix: FixFn;
2365
+ }
2366
+ //#endregion
2367
+ //#region src-js/plugins/settings.d.ts
2368
+ /**
2369
+ * Settings for the file being linted.
2370
+ *
2371
+ * Settings are deserialized from JSON, so can only contain JSON-compatible values.
2372
+ */
2373
+ type Settings = JsonObject;
2374
+ /**
2375
+ * Retrieve an array containing all comments in the source code.
2376
+ * @returns Array of `Comment`s in order they appear in source.
2377
+ */
2378
+ declare function getAllComments(): CommentType[];
2379
+ /**
2380
+ * Get all comments directly before the given node or token.
2381
+ *
2382
+ * "Directly before" means only comments before this node, and after the preceding token.
2383
+ *
2384
+ * ```js
2385
+ * // Define `x`
2386
+ * const x = 1;
2387
+ * // Define `y`
2388
+ * const y = 2;
2389
+ * ```
2390
+ *
2391
+ * `sourceCode.getCommentsBefore(varDeclY)` will only return "Define `y`" comment, not also "Define `x`".
2392
+ *
2393
+ * @param nodeOrToken - The AST node or token to check for adjacent comment tokens.
2394
+ * @returns Array of `Comment`s in occurrence order.
2395
+ */
2396
+ declare function getCommentsBefore(nodeOrToken: NodeOrToken): CommentType[];
2397
+ /**
2398
+ * Get all comment tokens directly after the given node or token.
2399
+ *
2400
+ * "Directly after" means only comments between end of this node, and the next token following it.
2401
+ *
2402
+ * ```js
2403
+ * const x = 1;
2404
+ * // Define `y`
2405
+ * const y = 2;
2406
+ * // Define `z`
2407
+ * const z = 3;
2408
+ * ```
2409
+ *
2410
+ * `sourceCode.getCommentsAfter(varDeclX)` will only return "Define `y`" comment, not also "Define `z`".
2411
+ *
2412
+ * @param nodeOrToken - The AST node or token to check for adjacent comment tokens.
2413
+ * @returns Array of `Comment`s in occurrence order.
2414
+ */
2415
+ declare function getCommentsAfter(nodeOrToken: NodeOrToken): CommentType[];
2416
+ /**
2417
+ * Get all comment tokens inside the given node.
2418
+ * @param node - The AST node to get the comments for.
2419
+ * @returns Array of `Comment`s in occurrence order.
2420
+ */
2421
+ declare function getCommentsInside(node: Node): CommentType[];
2422
+ /**
2423
+ * Check whether any comments exist or not between the given 2 nodes.
2424
+ * @param nodeOrToken1 - Start node/token.
2425
+ * @param nodeOrToken2 - End node/token.
2426
+ * @returns `true` if one or more comments exist between the two.
2427
+ */
2428
+ declare function commentsExistBetween(nodeOrToken1: NodeOrToken, nodeOrToken2: NodeOrToken): boolean;
2429
+ /**
2430
+ * Retrieve the JSDoc comment for a given node.
2431
+ *
2432
+ * @deprecated
2433
+ *
2434
+ * @param node - The AST node to get the comment for.
2435
+ * @returns The JSDoc comment for the given node, or `null` if not found.
2436
+ */
2437
+ declare function getJSDocComment(node: Node): CommentType | null;
2438
+ interface Problem {
2439
+ ruleId: string | null;
2440
+ message: string;
2441
+ loc: Location;
2442
+ }
2443
+ type DirectiveType = "disable" | "enable" | "disable-line" | "disable-next-line";
2444
+ interface Directive {
2445
+ type: DirectiveType;
2446
+ node: CommentType;
2447
+ value: string;
2448
+ justification: string;
2449
+ }
2450
+ declare function getDisableDirectives(): {
2451
+ problems: Problem[];
2452
+ directives: Directive[];
2453
+ };
2454
+ interface Scope {
2455
+ type: ScopeType;
2456
+ isStrict: boolean;
2457
+ upper: Scope | null;
2458
+ childScopes: Scope[];
2459
+ variableScope: Scope;
2460
+ block: Node$1;
2461
+ variables: Variable[];
2462
+ set: Map<string, Variable>;
2463
+ references: Reference[];
2464
+ through: Reference[];
2465
+ functionExpressionScope: boolean;
2466
+ implicit?: {
2467
+ variables: Variable[];
2468
+ set: Map<string, Variable>;
2469
+ };
2470
+ }
2471
+ type ScopeType = "block" | "catch" | "class" | "class-field-initializer" | "class-static-block" | "for" | "function" | "function-expression-name" | "global" | "module" | "switch" | "with";
2472
+ interface Variable {
2473
+ name: string;
2474
+ scope: Scope;
2475
+ identifiers: Identifier[];
2476
+ references: Reference[];
2477
+ defs: Definition[];
2478
+ }
2479
+ interface Reference {
2480
+ identifier: Identifier;
2481
+ from: Scope;
2482
+ resolved: Variable | null;
2483
+ writeExpr: Expression | null;
2484
+ init: boolean;
2485
+ isWrite(): boolean;
2486
+ isRead(): boolean;
2487
+ isReadOnly(): boolean;
2488
+ isWriteOnly(): boolean;
2489
+ isReadWrite(): boolean;
2490
+ }
2491
+ interface Definition {
2492
+ type: DefinitionType;
2493
+ name: Identifier;
2494
+ node: Node$1;
2495
+ parent: Node$1 | null;
2496
+ }
2497
+ type DefinitionType = "CatchClause" | "ClassName" | "FunctionName" | "ImplicitGlobalVariable" | "ImportBinding" | "Parameter" | "Variable";
2498
+ type Identifier = IdentifierName | IdentifierReference | BindingIdentifier | LabelIdentifier | TSThisParameter | TSIndexSignatureName;
2499
+ declare const SCOPE_MANAGER: Readonly<{
2500
+ /**
2501
+ * All scopes.
2502
+ */
2503
+ readonly scopes: Scope[];
2504
+ /**
2505
+ * The root scope.
2506
+ */
2507
+ readonly globalScope: Scope | null;
2508
+ /**
2509
+ * Get the variables that a given AST node defines.
2510
+ * The returned variables' `def[].node` / `def[].parent` property is the node.
2511
+ * If the node does not define any variable, this returns an empty array.
2512
+ * @param node AST node to get variables of.
2513
+ */
2514
+ getDeclaredVariables(node: Node$1): Variable[];
2515
+ /**
2516
+ * Get the scope of a given AST node. The returned scope's `block` property is the node.
2517
+ * This method never returns `function-expression-name` scope.
2518
+ * If the node does not have a scope, returns `null`.
2519
+ *
2520
+ * @param node An AST node to get their scope.
2521
+ * @param inner If the node has multiple scopes, this returns the outermost scope normally.
2522
+ * If `inner` is `true` then this returns the innermost scope.
2523
+ */
2524
+ acquire(node: Node$1, inner?: boolean): Scope | null;
2525
+ }>;
2526
+ type ScopeManager = typeof SCOPE_MANAGER;
2527
+ /**
2528
+ * Determine whether the given identifier node is a reference to a global variable.
2529
+ * @param node - `Identifier` node to check.
2530
+ * @returns `true` if the identifier is a reference to a global variable.
2531
+ */
2532
+ declare function isGlobalReference(node: Node$1): boolean;
2533
+ /**
2534
+ * Get the variables that `node` defines.
2535
+ * This is a convenience method that passes through to the same method on the `ScopeManager`.
2536
+ * @param node - The node for which the variables are obtained.
2537
+ * @returns An array of variable nodes representing the variables that `node` defines.
2538
+ */
2539
+ declare function getDeclaredVariables(node: Node$1): Variable[];
2540
+ /**
2541
+ * Get the scope for the given node.
2542
+ * @param node - The node to get the scope of.
2543
+ * @returns The scope information for this node.
2544
+ */
2545
+ declare function getScope(node: Node$1): Scope;
2546
+ /**
2547
+ * Marks as used a variable with the given name in a scope indicated by the given reference node.
2548
+ *
2549
+ * IMPORTANT: At present marking variables as used only affects other JS plugins.
2550
+ * It does *not* get communicated to Oxlint's rules which are implemented on Rust side e.g. `no-unused-vars`.
2551
+ * This is a known shortcoming, and will be addressed in a future release.
2552
+ * https://github.com/oxc-project/oxc/issues/20350
2553
+ *
2554
+ * @param name - Variable name
2555
+ * @param refNode - Reference node. Defaults to `Program` node if not provided.
2556
+ * @returns `true` if a variable with the given name was found and marked as used, otherwise `false`
2557
+ */
2558
+ declare function markVariableAsUsed(name: string, refNode?: Node$1): boolean;
2559
+ //#endregion
2560
+ //#region src-js/plugins/tokens_and_comments.d.ts
2561
+ type TokenOrComment = TokenType | CommentType;
2562
+ /**
2563
+ * Options for various `SourceCode` methods e.g. `getFirstToken`.
2564
+ */
2565
+ interface SkipOptions {
2566
+ /** Number of skipping tokens */
2567
+ skip?: number;
2568
+ /** `true` to include comment tokens in the result */
2569
+ includeComments?: boolean;
2570
+ /** Function to filter tokens */
2571
+ filter?: FilterFn | null;
2572
+ }
2573
+ /**
2574
+ * Options for various `SourceCode` methods e.g. `getFirstTokens`.
2575
+ */
2576
+ interface CountOptions {
2577
+ /** Maximum number of tokens to return */
2578
+ count?: number;
2579
+ /** `true` to include comment tokens in the result */
2580
+ includeComments?: boolean;
2581
+ /** Function to filter tokens */
2582
+ filter?: FilterFn | null;
2583
+ }
2584
+ /**
2585
+ * Options for `getTokenByRangeStart`.
2586
+ */
2587
+ interface RangeOptions {
2588
+ /** `true` to include comment tokens in the result */
2589
+ includeComments?: boolean;
2590
+ }
2591
+ /**
2592
+ * Filter function, passed as `filter` property of `SkipOptions` and `CountOptions`.
2593
+ */
2594
+ type FilterFn = (token: TokenOrComment) => boolean;
2595
+ /**
2596
+ * Whether `Options` may include comment tokens in the result.
2597
+ * Resolves to `true` if `Options` has an `includeComments` property whose type includes `true`
2598
+ * (i.e. it's `true`, `boolean`, or `boolean | undefined`), and `false` otherwise.
2599
+ */
2600
+ type MayIncludeComments<Options> = Options extends {
2601
+ includeComments: false;
2602
+ } ? false : "includeComments" extends keyof Options ? true : false;
2603
+ /**
2604
+ * Resolves to `TokenOrComment` if `Options` may include comments, `Token` otherwise.
2605
+ */
2606
+ type TokenResult<Options> = MayIncludeComments<Options> extends true ? TokenOrComment : TokenType;
2607
+ /**
2608
+ * Get all tokens that are related to the given node.
2609
+ * @param node - The AST node.
2610
+ * @param countOptions? - Options object. If is a function, equivalent to `{ filter: fn }`.
2611
+ * @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
2612
+ */
2613
+ /**
2614
+ * Get all tokens that are related to the given node.
2615
+ * @param node - The AST node.
2616
+ * @param beforeCount? - The number of tokens before the node to retrieve.
2617
+ * @param afterCount? - The number of tokens after the node to retrieve.
2618
+ * @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
2619
+ */
2620
+ declare function getTokens<Options extends CountOptions | number | FilterFn | null | undefined>(node: Node, countOptions?: Options, afterCount?: number | null): TokenResult<Options>[];
2621
+ /**
2622
+ * Get the first token of the given node.
2623
+ * @param node - The AST node.
2624
+ * @param skipOptions? - Options object.
2625
+ * If is a number, equivalent to `{ skip: n }`.
2626
+ * If is a function, equivalent to `{ filter: fn }`.
2627
+ * @returns `Token` (or `Token | Comment` if `includeComments` is `true`), or `null` if none found.
2628
+ */
2629
+ declare function getFirstToken<Options extends SkipOptions | number | FilterFn | null | undefined>(node: Node, skipOptions?: Options): TokenResult<Options> | null;
2630
+ /**
2631
+ * Get the first tokens of the given node.
2632
+ * @param node - The AST node.
2633
+ * @param countOptions? - Options object.
2634
+ * If is a number, equivalent to `{ count: n }`.
2635
+ * If is a function, equivalent to `{ filter: fn }`.
2636
+ * @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
2637
+ */
2638
+ declare function getFirstTokens<Options extends CountOptions | number | FilterFn | null | undefined>(node: Node, countOptions?: Options): TokenResult<Options>[];
2639
+ /**
2640
+ * Get the last token of the given node.
2641
+ * @param node - The AST node.
2642
+ * @param skipOptions? - Options object.
2643
+ * If is a number, equivalent to `{ skip: n }`.
2644
+ * If is a function, equivalent to `{ filter: fn }`.
2645
+ * @returns `Token` (or `Token | Comment` if `includeComments` is `true`), or `null` if none found.
2646
+ */
2647
+ declare function getLastToken<Options extends SkipOptions | number | FilterFn | null | undefined>(node: Node, skipOptions?: Options): TokenResult<Options> | null;
2648
+ /**
2649
+ * Get the last tokens of the given node.
2650
+ * @param node - The AST node.
2651
+ * @param countOptions? - Options object.
2652
+ * If is a number, equivalent to `{ count: n }`.
2653
+ * If is a function, equivalent to `{ filter: fn }`.
2654
+ * @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
2655
+ */
2656
+ declare function getLastTokens<Options extends CountOptions | number | FilterFn | null | undefined>(node: Node, countOptions?: Options): TokenResult<Options>[];
2657
+ /**
2658
+ * Get the token that precedes a given node or token.
2659
+ * @param nodeOrToken - The AST node or token.
2660
+ * @param skipOptions? - Options object.
2661
+ * If is a number, equivalent to `{ skip: n }`.
2662
+ * If is a function, equivalent to `{ filter: fn }`.
2663
+ * @returns `Token` (or `Token | Comment` if `includeComments` is `true`), or `null` if none found.
2664
+ */
2665
+ declare function getTokenBefore<Options extends SkipOptions | number | FilterFn | null | undefined>(nodeOrToken: NodeOrToken, skipOptions?: Options): TokenResult<Options> | null;
2666
+ /**
2667
+ * Get the token that precedes a given node or token.
2668
+ *
2669
+ * @deprecated Use `sourceCode.getTokenBefore` with `includeComments: true` instead.
2670
+ *
2671
+ * @param nodeOrToken The AST node or token.
2672
+ * @param skip - Number of tokens to skip.
2673
+ * @returns `TokenOrComment | null`.
2674
+ */
2675
+ declare function getTokenOrCommentBefore(nodeOrToken: NodeOrToken, skip?: number): TokenOrComment | null;
2676
+ /**
2677
+ * Get the tokens that precede a given node or token.
2678
+ * @param nodeOrToken - The AST node or token.
2679
+ * @param countOptions? - Options object.
2680
+ * If is a number, equivalent to `{ count: n }`.
2681
+ * If is a function, equivalent to `{ filter: fn }`.
2682
+ * @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
2683
+ */
2684
+ declare function getTokensBefore<Options extends CountOptions | number | FilterFn | null | undefined>(nodeOrToken: NodeOrToken, countOptions?: Options): TokenResult<Options>[];
2685
+ /**
2686
+ * Get the token that follows a given node or token.
2687
+ * @param nodeOrToken - The AST node or token.
2688
+ * @param skipOptions? - Options object.
2689
+ * If is a number, equivalent to `{ skip: n }`.
2690
+ * If is a function, equivalent to `{ filter: fn }`.
2691
+ * @returns `Token` (or `Token | Comment` if `includeComments` is `true`), or `null` if none found.
2692
+ */
2693
+ declare function getTokenAfter<Options extends SkipOptions | number | FilterFn | null | undefined>(nodeOrToken: NodeOrToken, skipOptions?: Options): TokenResult<Options> | null;
2694
+ /**
2695
+ * Get the token that follows a given node or token.
2696
+ *
2697
+ * @deprecated Use `sourceCode.getTokenAfter` with `includeComments: true` instead.
2698
+ *
2699
+ * @param nodeOrToken The AST node or token.
2700
+ * @param skip - Number of tokens to skip.
2701
+ * @returns `TokenOrComment | null`.
2702
+ */
2703
+ declare function getTokenOrCommentAfter(nodeOrToken: NodeOrToken, skip?: number): TokenOrComment | null;
2704
+ /**
2705
+ * Get the tokens that follow a given node or token.
2706
+ * @param nodeOrToken - The AST node or token.
2707
+ * @param countOptions? - Options object.
2708
+ * If is a number, equivalent to `{ count: n }`.
2709
+ * If is a function, equivalent to `{ filter: fn }`.
2710
+ * @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
2711
+ */
2712
+ declare function getTokensAfter<Options extends CountOptions | number | FilterFn | null | undefined>(nodeOrToken: NodeOrToken, countOptions?: Options): TokenResult<Options>[];
2713
+ /**
2714
+ * Get all of the tokens between two non-overlapping nodes.
2715
+ * @param left - Node or token before the desired token range.
2716
+ * @param right - Node or token after the desired token range.
2717
+ * @param countOptions? - Options object. If is a function, equivalent to `{ filter: fn }`.
2718
+ * @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
2719
+ */
2720
+ /**
2721
+ * Get all of the tokens between two non-overlapping nodes.
2722
+ * @param left - Node or token before the desired token range.
2723
+ * @param right - Node or token after the desired token range.
2724
+ * @param padding - Number of extra tokens on either side of center.
2725
+ * @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
2726
+ */
2727
+ declare function getTokensBetween<Options extends CountOptions | number | FilterFn | null | undefined>(left: NodeOrToken, right: NodeOrToken, countOptions?: Options): TokenResult<Options>[];
2728
+ /**
2729
+ * Get the first token between two non-overlapping nodes.
2730
+ * @param left - Node or token before the desired token range.
2731
+ * @param right - Node or token after the desired token range.
2732
+ * @param skipOptions? - Options object.
2733
+ * If is a number, equivalent to `{ skip: n }`.
2734
+ * If is a function, equivalent to `{ filter: fn }`.
2735
+ * @returns `Token` (or `Token | Comment` if `includeComments` is `true`), or `null` if none found.
2736
+ */
2737
+ declare function getFirstTokenBetween<Options extends SkipOptions | number | FilterFn | null | undefined>(left: NodeOrToken, right: NodeOrToken, skipOptions?: Options): TokenResult<Options> | null;
2738
+ /**
2739
+ * Get the first tokens between two non-overlapping nodes.
2740
+ * @param left - Node or token before the desired token range.
2741
+ * @param right - Node or token after the desired token range.
2742
+ * @param countOptions? - Options object.
2743
+ * If is a number, equivalent to `{ count: n }`.
2744
+ * If is a function, equivalent to `{ filter: fn }`.
2745
+ * @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
2746
+ */
2747
+ declare function getFirstTokensBetween<Options extends CountOptions | number | FilterFn | null | undefined>(left: NodeOrToken, right: NodeOrToken, countOptions?: Options): TokenResult<Options>[];
2748
+ /**
2749
+ * Get the last token between two non-overlapping nodes.
2750
+ * @param left - Node or token before the desired token range.
2751
+ * @param right - Node or token after the desired token range.
2752
+ * @param skipOptions? - Options object.
2753
+ * If is a number, equivalent to `{ skip: n }`.
2754
+ * If is a function, equivalent to `{ filter: fn }`.
2755
+ * @returns `Token` (or `Token | Comment` if `includeComments` is `true`), or `null` if none found.
2756
+ */
2757
+ declare function getLastTokenBetween<Options extends SkipOptions | number | FilterFn | null | undefined>(left: NodeOrToken, right: NodeOrToken, skipOptions?: Options): TokenResult<Options> | null;
2758
+ /**
2759
+ * Get the last tokens between two non-overlapping nodes.
2760
+ * @param left - Node or token before the desired token range.
2761
+ * @param right - Node or token after the desired token range.
2762
+ * @param countOptions? - Options object.
2763
+ * If is a number, equivalent to `{ count: n }`.
2764
+ * If is a function, equivalent to `{ filter: fn }`.
2765
+ * @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
2766
+ */
2767
+ declare function getLastTokensBetween<Options extends CountOptions | number | FilterFn | null | undefined>(left: NodeOrToken, right: NodeOrToken, countOptions?: Options): TokenResult<Options>[];
2768
+ /**
2769
+ * Get the token starting at the specified index.
2770
+ * @param offset - Start offset of the token.
2771
+ * @param rangeOptions - Options object.
2772
+ * @returns `Token` (or `Token | Comment` if `includeComments` is `true`), or `null` if none found.
2773
+ */
2774
+ declare function getTokenByRangeStart<Options extends RangeOptions | null | undefined>(offset: number, rangeOptions?: Options): TokenResult<Options> | null;
2775
+ /**
2776
+ * Determine if two nodes or tokens have at least one whitespace character between them.
2777
+ * Order does not matter.
2778
+ *
2779
+ * Returns `false` if the given nodes or tokens overlap.
2780
+ *
2781
+ * Checks for whitespace *between tokens*, not including whitespace *inside tokens*.
2782
+ * e.g. Returns `false` for `isSpaceBetween(x, y)` in `x+" "+y`.
2783
+ *
2784
+ * @param first - The first node or token to check between.
2785
+ * @param second - The second node or token to check between.
2786
+ * @returns `true` if there is a whitespace character between
2787
+ * any of the tokens found between the two given nodes or tokens.
2788
+ */
2789
+ declare function isSpaceBetween(first: NodeOrToken, second: NodeOrToken): boolean;
2790
+ /**
2791
+ * Determine if two nodes or tokens have at least one whitespace character between them.
2792
+ * Order does not matter.
2793
+ *
2794
+ * Returns `false` if the given nodes or tokens overlap.
2795
+ *
2796
+ * Checks for whitespace *between tokens*, not including whitespace *inside tokens*.
2797
+ * e.g. Returns `false` for `isSpaceBetween(x, y)` in `x+" "+y`.
2798
+ *
2799
+ * Unlike `SourceCode#isSpaceBetween`, this function does return `true` if there is a `JSText` token between the two
2800
+ * input tokens, and it contains whitespace.
2801
+ * e.g. Returns `true` for `isSpaceBetweenTokens(x, slash)` in `<X>a b</X>`.
2802
+ *
2803
+ * @deprecated Use `sourceCode.isSpaceBetween` instead.
2804
+ *
2805
+ * @param first - The first node or token to check between.
2806
+ * @param second - The second node or token to check between.
2807
+ * @returns `true` if there is a whitespace character between
2808
+ * any of the tokens found between the two given nodes or tokens.
2809
+ */
2810
+ declare function isSpaceBetweenTokens(first: NodeOrToken, second: NodeOrToken): boolean;
2811
+ //#endregion
2812
+ //#region src-js/plugins/source_code.d.ts
2813
+ declare const SOURCE_CODE: Readonly<{
2814
+ /**
2815
+ * Source text.
2816
+ */
2817
+ readonly text: string;
2818
+ /**
2819
+ * `true` if file has Unicode BOM.
2820
+ */
2821
+ readonly hasBOM: boolean;
2822
+ /**
2823
+ * AST of the file.
2824
+ */
2825
+ readonly ast: Program;
2826
+ /**
2827
+ * `true` if the AST is in ESTree format.
2828
+ */
2829
+ isESTree: true;
2830
+ /**
2831
+ * `ScopeManager` for the file.
2832
+ */
2833
+ readonly scopeManager: ScopeManager;
2834
+ /**
2835
+ * Visitor keys to traverse this AST.
2836
+ */
2837
+ readonly visitorKeys: Readonly<Record<string, readonly string[]>>;
2838
+ /**
2839
+ * Parser services for the file.
2840
+ *
2841
+ * Oxlint does not offer any parser services.
2842
+ */
2843
+ parserServices: Readonly<Record<string, unknown>>;
2844
+ /**
2845
+ * Source text as array of lines, split according to specification's definition of line breaks.
2846
+ */
2847
+ readonly lines: string[];
2848
+ /**
2849
+ * Character offset of the first character of each line in source text,
2850
+ * split according to specification's definition of line breaks.
2851
+ */
2852
+ readonly lineStartIndices: number[];
2853
+ /**
2854
+ * Array of all tokens and comments in the file, in source order.
2855
+ */
2856
+ readonly tokensAndComments: (TokenType | CommentType)[];
2857
+ /**
2858
+ * Get the source code for the given node.
2859
+ * @param node? - The AST node to get the text for.
2860
+ * @param beforeCount? - The number of characters before the node to retrieve.
2861
+ * @param afterCount? - The number of characters after the node to retrieve.
2862
+ * @returns Source text representing the AST node.
2863
+ */
2864
+ getText(node?: Ranged | null, beforeCount?: number | null, afterCount?: number | null): string;
2865
+ /**
2866
+ * Get all the ancestors of a given node.
2867
+ * @param node - AST node
2868
+ * @returns All the ancestor nodes in the AST, not including the provided node,
2869
+ * starting from the root node at index 0 and going inwards to the parent node.
2870
+ */
2871
+ getAncestors(node: Node): Node[];
2872
+ /**
2873
+ * Get source text as array of lines, split according to specification's definition of line breaks.
2874
+ */
2875
+ getLines(): string[];
2876
+ getRange: typeof getRange;
2877
+ getLoc: typeof getLoc;
2878
+ getNodeByRangeIndex: typeof getNodeByRangeIndex;
2879
+ getLocFromIndex: typeof getLineColumnFromOffset;
2880
+ getIndexFromLoc: typeof getOffsetFromLineColumn;
2881
+ getAllComments: typeof getAllComments;
2882
+ getCommentsBefore: typeof getCommentsBefore;
2883
+ getCommentsAfter: typeof getCommentsAfter;
2884
+ getCommentsInside: typeof getCommentsInside;
2885
+ commentsExistBetween: typeof commentsExistBetween;
2886
+ getJSDocComment: typeof getJSDocComment;
2887
+ isGlobalReference: typeof isGlobalReference;
2888
+ getDeclaredVariables: typeof getDeclaredVariables;
2889
+ getScope: typeof getScope;
2890
+ markVariableAsUsed: typeof markVariableAsUsed;
2891
+ getTokens: typeof getTokens;
2892
+ getFirstToken: typeof getFirstToken;
2893
+ getFirstTokens: typeof getFirstTokens;
2894
+ getLastToken: typeof getLastToken;
2895
+ getLastTokens: typeof getLastTokens;
2896
+ getTokenBefore: typeof getTokenBefore;
2897
+ getTokenOrCommentBefore: typeof getTokenOrCommentBefore;
2898
+ getTokensBefore: typeof getTokensBefore;
2899
+ getTokenAfter: typeof getTokenAfter;
2900
+ getTokenOrCommentAfter: typeof getTokenOrCommentAfter;
2901
+ getTokensAfter: typeof getTokensAfter;
2902
+ getTokensBetween: typeof getTokensBetween;
2903
+ getFirstTokenBetween: typeof getFirstTokenBetween;
2904
+ getFirstTokensBetween: typeof getFirstTokensBetween;
2905
+ getLastTokenBetween: typeof getLastTokenBetween;
2906
+ getLastTokensBetween: typeof getLastTokensBetween;
2907
+ getTokenByRangeStart: typeof getTokenByRangeStart;
2908
+ isSpaceBetween: typeof isSpaceBetween;
2909
+ isSpaceBetweenTokens: typeof isSpaceBetweenTokens;
2910
+ getDisableDirectives: typeof getDisableDirectives;
2911
+ }>;
2912
+ type SourceCode = typeof SOURCE_CODE;
2913
+ //#endregion
2914
+ //#region src-js/plugins/context.d.ts
2915
+ declare const LANGUAGE_OPTIONS: {
2916
+ /**
2917
+ * Source type of the file being linted.
2918
+ */
2919
+ readonly sourceType: ModuleKind;
2920
+ /**
2921
+ * ECMAScript version of the file being linted.
2922
+ */
2923
+ ecmaVersion: number;
2924
+ /**
2925
+ * Parser used to parse the file being linted.
2926
+ */
2927
+ parser: Readonly<{
2928
+ /**
2929
+ * Parser name.
2930
+ */
2931
+ name: "oxlint";
2932
+ /**
2933
+ * Parser version.
2934
+ */
2935
+ version: string;
2936
+ /**
2937
+ * Parse code into an AST.
2938
+ * @param code - Code to parse
2939
+ * @param options? - Parser options
2940
+ * @returns AST
2941
+ */
2942
+ parse(code: string, options?: Record<string, unknown>): Program;
2943
+ /**
2944
+ * Visitor keys for AST nodes.
2945
+ */
2946
+ VisitorKeys: Readonly<{
2947
+ DebuggerStatement: readonly never[];
2948
+ EmptyStatement: readonly never[];
2949
+ Literal: readonly never[];
2950
+ PrivateIdentifier: readonly never[];
2951
+ Super: readonly never[];
2952
+ TemplateElement: readonly never[];
2953
+ ThisExpression: readonly never[];
2954
+ JSXClosingFragment: readonly never[];
2955
+ JSXEmptyExpression: readonly never[];
2956
+ JSXIdentifier: readonly never[];
2957
+ JSXOpeningFragment: readonly never[];
2958
+ JSXText: readonly never[];
2959
+ TSAnyKeyword: readonly never[];
2960
+ TSBigIntKeyword: readonly never[];
2961
+ TSBooleanKeyword: readonly never[];
2962
+ TSIntrinsicKeyword: readonly never[];
2963
+ TSJSDocUnknownType: readonly never[];
2964
+ TSNeverKeyword: readonly never[];
2965
+ TSNullKeyword: readonly never[];
2966
+ TSNumberKeyword: readonly never[];
2967
+ TSObjectKeyword: readonly never[];
2968
+ TSStringKeyword: readonly never[];
2969
+ TSSymbolKeyword: readonly never[];
2970
+ TSThisType: readonly never[];
2971
+ TSUndefinedKeyword: readonly never[];
2972
+ TSUnknownKeyword: readonly never[];
2973
+ TSVoidKeyword: readonly never[];
2974
+ AccessorProperty: readonly string[];
2975
+ ArrayExpression: readonly string[];
2976
+ ArrayPattern: readonly string[];
2977
+ ArrowFunctionExpression: readonly string[];
2978
+ AssignmentExpression: readonly string[];
2979
+ AssignmentPattern: readonly string[];
2980
+ AwaitExpression: readonly string[];
2981
+ BinaryExpression: readonly string[];
2982
+ BlockStatement: readonly string[];
2983
+ BreakStatement: readonly string[];
2984
+ CallExpression: readonly string[];
2985
+ CatchClause: readonly string[];
2986
+ ChainExpression: readonly string[];
2987
+ ClassBody: readonly string[];
2988
+ ClassDeclaration: readonly string[];
2989
+ ClassExpression: readonly string[];
2990
+ ConditionalExpression: readonly string[];
2991
+ ContinueStatement: readonly string[];
2992
+ Decorator: readonly string[];
2993
+ DoWhileStatement: readonly string[];
2994
+ ExportAllDeclaration: readonly string[];
2995
+ ExportDefaultDeclaration: readonly string[];
2996
+ ExportNamedDeclaration: readonly string[];
2997
+ ExportSpecifier: readonly string[];
2998
+ ExpressionStatement: readonly string[];
2999
+ ForInStatement: readonly string[];
3000
+ ForOfStatement: readonly string[];
3001
+ ForStatement: readonly string[];
3002
+ FunctionDeclaration: readonly string[];
3003
+ FunctionExpression: readonly string[];
3004
+ Identifier: readonly string[];
3005
+ IfStatement: readonly string[];
3006
+ ImportAttribute: readonly string[];
3007
+ ImportDeclaration: readonly string[];
3008
+ ImportDefaultSpecifier: readonly string[];
3009
+ ImportExpression: readonly string[];
3010
+ ImportNamespaceSpecifier: readonly string[];
3011
+ ImportSpecifier: readonly string[];
3012
+ LabeledStatement: readonly string[];
3013
+ LogicalExpression: readonly string[];
3014
+ MemberExpression: readonly string[];
3015
+ MetaProperty: readonly string[];
3016
+ MethodDefinition: readonly string[];
3017
+ NewExpression: readonly string[];
3018
+ ObjectExpression: readonly string[];
3019
+ ObjectPattern: readonly string[];
3020
+ ParenthesizedExpression: readonly string[];
3021
+ Program: readonly string[];
3022
+ Property: readonly string[];
3023
+ PropertyDefinition: readonly string[];
3024
+ RestElement: readonly string[];
3025
+ ReturnStatement: readonly string[];
3026
+ SequenceExpression: readonly string[];
3027
+ SpreadElement: readonly string[];
3028
+ StaticBlock: readonly string[];
3029
+ SwitchCase: readonly string[];
3030
+ SwitchStatement: readonly string[];
3031
+ TaggedTemplateExpression: readonly string[];
3032
+ TemplateLiteral: readonly string[];
3033
+ ThrowStatement: readonly string[];
3034
+ TryStatement: readonly string[];
3035
+ UnaryExpression: readonly string[];
3036
+ UpdateExpression: readonly string[];
3037
+ V8IntrinsicExpression: readonly string[];
3038
+ VariableDeclaration: readonly string[];
3039
+ VariableDeclarator: readonly string[];
3040
+ WhileStatement: readonly string[];
3041
+ WithStatement: readonly string[];
3042
+ YieldExpression: readonly string[];
3043
+ JSXAttribute: readonly string[];
3044
+ JSXClosingElement: readonly string[];
3045
+ JSXElement: readonly string[];
3046
+ JSXExpressionContainer: readonly string[];
3047
+ JSXFragment: readonly string[];
3048
+ JSXMemberExpression: readonly string[];
3049
+ JSXNamespacedName: readonly string[];
3050
+ JSXOpeningElement: readonly string[];
3051
+ JSXSpreadAttribute: readonly string[];
3052
+ JSXSpreadChild: readonly string[];
3053
+ TSAbstractAccessorProperty: readonly string[];
3054
+ TSAbstractMethodDefinition: readonly string[];
3055
+ TSAbstractPropertyDefinition: readonly string[];
3056
+ TSArrayType: readonly string[];
3057
+ TSAsExpression: readonly string[];
3058
+ TSCallSignatureDeclaration: readonly string[];
3059
+ TSClassImplements: readonly string[];
3060
+ TSConditionalType: readonly string[];
3061
+ TSConstructSignatureDeclaration: readonly string[];
3062
+ TSConstructorType: readonly string[];
3063
+ TSDeclareFunction: readonly string[];
3064
+ TSEmptyBodyFunctionExpression: readonly string[];
3065
+ TSEnumBody: readonly string[];
3066
+ TSEnumDeclaration: readonly string[];
3067
+ TSEnumMember: readonly string[];
3068
+ TSExportAssignment: readonly string[];
3069
+ TSExternalModuleReference: readonly string[];
3070
+ TSFunctionType: readonly string[];
3071
+ TSImportEqualsDeclaration: readonly string[];
3072
+ TSImportType: readonly string[];
3073
+ TSIndexSignature: readonly string[];
3074
+ TSIndexedAccessType: readonly string[];
3075
+ TSInferType: readonly string[];
3076
+ TSInstantiationExpression: readonly string[];
3077
+ TSInterfaceBody: readonly string[];
3078
+ TSInterfaceDeclaration: readonly string[];
3079
+ TSInterfaceHeritage: readonly string[];
3080
+ TSIntersectionType: readonly string[];
3081
+ TSJSDocNonNullableType: readonly string[];
3082
+ TSJSDocNullableType: readonly string[];
3083
+ TSLiteralType: readonly string[];
3084
+ TSMappedType: readonly string[];
3085
+ TSMethodSignature: readonly string[];
3086
+ TSModuleBlock: readonly string[];
3087
+ TSModuleDeclaration: readonly string[];
3088
+ TSNamedTupleMember: readonly string[];
3089
+ TSNamespaceExportDeclaration: readonly string[];
3090
+ TSNonNullExpression: readonly string[];
3091
+ TSOptionalType: readonly string[];
3092
+ TSParameterProperty: readonly string[];
3093
+ TSParenthesizedType: readonly string[];
3094
+ TSPropertySignature: readonly string[];
3095
+ TSQualifiedName: readonly string[];
3096
+ TSRestType: readonly string[];
3097
+ TSSatisfiesExpression: readonly string[];
3098
+ TSTemplateLiteralType: readonly string[];
3099
+ TSTupleType: readonly string[];
3100
+ TSTypeAliasDeclaration: readonly string[];
3101
+ TSTypeAnnotation: readonly string[];
3102
+ TSTypeAssertion: readonly string[];
3103
+ TSTypeLiteral: readonly string[];
3104
+ TSTypeOperator: readonly string[];
3105
+ TSTypeParameter: readonly string[];
3106
+ TSTypeParameterDeclaration: readonly string[];
3107
+ TSTypeParameterInstantiation: readonly string[];
3108
+ TSTypePredicate: readonly string[];
3109
+ TSTypeQuery: readonly string[];
3110
+ TSTypeReference: readonly string[];
3111
+ TSUnionType: readonly string[];
3112
+ }>;
3113
+ /**
3114
+ * Ast node types.
3115
+ */
3116
+ readonly Syntax: Readonly<Record<string, string>>;
3117
+ /**
3118
+ * Latest ECMAScript version supported by parser.
3119
+ */
3120
+ latestEcmaVersion: 17;
3121
+ /**
3122
+ * ECMAScript versions supported by parser.
3123
+ */
3124
+ supportedEcmaVersions: readonly number[];
3125
+ }>;
3126
+ /**
3127
+ * Parser options used to parse the file being linted.
3128
+ */
3129
+ parserOptions: Readonly<{
3130
+ /**
3131
+ * Source type of the file being linted.
3132
+ */
3133
+ readonly sourceType: ModuleKind;
3134
+ /**
3135
+ * ECMA features.
3136
+ */
3137
+ ecmaFeatures: Readonly<{
3138
+ /**
3139
+ * `true` if file was parsed as JSX.
3140
+ */
3141
+ readonly jsx: boolean;
3142
+ /**
3143
+ * `true` if file was parsed with top-level `return` statements allowed.
3144
+ */
3145
+ readonly globalReturn: boolean;
3146
+ /**
3147
+ * `true` if file was parsed as strict mode code.
3148
+ */
3149
+ readonly impliedStrict: boolean;
3150
+ }>;
3151
+ }>;
3152
+ /**
3153
+ * Globals defined for the file being linted.
3154
+ */
3155
+ readonly globals: Readonly<Globals>;
3156
+ /**
3157
+ * Environments defined for the file being linted.
3158
+ */
3159
+ readonly env: Readonly<Envs>;
3160
+ };
3161
+ /**
3162
+ * Language options used when parsing a file.
3163
+ */
3164
+ type LanguageOptions = Readonly<typeof LANGUAGE_OPTIONS>;
3165
+ declare const FILE_CONTEXT: Readonly<{
3166
+ /**
3167
+ * Absolute path of the file being linted.
3168
+ */
3169
+ readonly filename: string;
3170
+ /**
3171
+ * Get absolute path of the file being linted.
3172
+ * @returns Absolute path of the file being linted.
3173
+ * @deprecated Use `context.filename` property instead.
3174
+ */
3175
+ getFilename(): string;
3176
+ /**
3177
+ * Physical absolute path of the file being linted.
3178
+ */
3179
+ readonly physicalFilename: string;
3180
+ /**
3181
+ * Get physical absolute path of the file being linted.
3182
+ * @returns Physical absolute path of the file being linted.
3183
+ * @deprecated Use `context.physicalFilename` property instead.
3184
+ */
3185
+ getPhysicalFilename(): string;
3186
+ /**
3187
+ * Current working directory.
3188
+ */
3189
+ readonly cwd: string;
3190
+ /**
3191
+ * Get current working directory.
3192
+ * @returns The current working directory.
3193
+ * @deprecated Use `context.cwd` property instead.
3194
+ */
3195
+ getCwd(): string;
3196
+ /**
3197
+ * Source code of the file being linted.
3198
+ */
3199
+ readonly sourceCode: SourceCode;
3200
+ /**
3201
+ * Get source code of the file being linted.
3202
+ * @returns Source code of the file being linted.
3203
+ * @deprecated Use `context.sourceCode` property instead.
3204
+ */
3205
+ getSourceCode(): SourceCode;
3206
+ /**
3207
+ * Language options used when parsing this file.
3208
+ */
3209
+ readonly languageOptions: LanguageOptions;
3210
+ /**
3211
+ * Settings for the file being linted.
3212
+ */
3213
+ readonly settings: Readonly<Settings>;
3214
+ /**
3215
+ * Create a new object with the current object as the prototype and
3216
+ * the specified properties as its own properties.
3217
+ * @param extension - The properties to add to the new object.
3218
+ * @returns A new object with the current object as the prototype
3219
+ * and the specified properties as its own properties.
3220
+ */
3221
+ extend(this: FileContext, extension: Record<string | number | symbol, unknown>): FileContext;
3222
+ /**
3223
+ * Parser options used to parse the file being linted.
3224
+ * @deprecated Use `languageOptions.parserOptions` instead.
3225
+ */
3226
+ readonly parserOptions: Record<string, unknown>;
3227
+ /**
3228
+ * The path to the parser used to parse this file.
3229
+ * @deprecated No longer supported.
3230
+ */
3231
+ readonly parserPath: string | undefined;
3232
+ }>;
3233
+ /**
3234
+ * Context object for a file.
3235
+ * Is the prototype for `Context` objects for each rule.
3236
+ */
3237
+ type FileContext = typeof FILE_CONTEXT;
3238
+ /**
3239
+ * Context object for a rule.
3240
+ * Passed to `create` and `createOnce` functions.
3241
+ */
3242
+ interface Context extends FileContext {
3243
+ /**
3244
+ * Rule ID, in form `<plugin>/<rule>`.
3245
+ */
3246
+ id: string;
3247
+ /**
3248
+ * Rule options for this rule on this file.
3249
+ */
3250
+ options: Readonly<Options>;
3251
+ /**
3252
+ * Report an error/warning.
3253
+ */
3254
+ report(this: void, diagnostic: Diagnostic): void;
3255
+ }
3256
+ declare const TargetSchema: Schema.Literals<readonly ["function", "call", "jsx", "file"]>;
3257
+ declare const CiBehaviorSchema: Schema.Literals<readonly ["skip", "fail"]>;
3258
+ declare const ExplainSettingSchema: Schema.Union<readonly [Schema.Boolean, Schema.Literals<readonly ["text", "json"]>]>;
3259
+ declare const EnclosingKindSchema: Schema.Literals<readonly ["function", "class", "block"]>;
3260
+ declare const RuleContextSchema: Schema.Union<readonly [Schema.Struct<{
3261
+ readonly scope: Schema.Literals<readonly ["node", "file", "comment"]>;
3262
+ }>, Schema.Struct<{
3263
+ readonly scope: Schema.Literal<"lines">;
3264
+ readonly before: Schema.optionalKey<Schema.Int>;
3265
+ readonly after: Schema.optionalKey<Schema.Int>;
3266
+ }>, Schema.Struct<{
3267
+ readonly scope: Schema.Literal<"enclosing">;
3268
+ readonly kind: Schema.Literals<readonly ["function", "class", "block"]>;
3269
+ }>]>;
3270
+ declare const SeveritySchema: Schema.Literals<readonly ["info", "warn", "error"]>;
3271
+ declare const RuleAnswerSchema: Schema.Union<readonly [Schema.Struct<{
3272
+ readonly kind: Schema.Literal<"boolean">;
3273
+ }>, Schema.Struct<{
3274
+ readonly kind: Schema.Literal<"classify">;
3275
+ readonly labels: Schema.$Record<Schema.NonEmptyString, Schema.String>;
3276
+ readonly report: Schema.NonEmptyArray<Schema.NonEmptyString>;
3277
+ }>, Schema.Struct<{
3278
+ readonly kind: Schema.Literal<"severity">;
3279
+ readonly minimum: Schema.optionalKey<Schema.Literals<readonly ["info", "warn", "error"]>>;
3280
+ }>]>;
3281
+ type Frozen<Value> = Value extends ((...args: never) => unknown) ? Value : Value extends object ? { readonly [Key in keyof Value]: Frozen<Value[Key]>; } : Value;
3282
+ type SelectedNode = Frozen<types_d_exports.Node>;
3283
+ interface SelectMatch {
3284
+ readonly name: string | undefined;
3285
+ readonly context: Context;
3286
+ }
3287
+ type Target = typeof TargetSchema.Type;
3288
+ type CiBehavior = typeof CiBehaviorSchema.Type;
3289
+ type ModelSpec = string | readonly string[];
3290
+ type ExplainSetting = typeof ExplainSettingSchema.Type;
3291
+ interface RuleLocation {
3292
+ readonly question: string;
3293
+ readonly cutoff: number;
3294
+ }
3295
+ type EnclosingKind = typeof EnclosingKindSchema.Type;
3296
+ type RuleContext = typeof RuleContextSchema.Type;
3297
+ type Severity = typeof SeveritySchema.Type;
3298
+ type RuleAnswer = typeof RuleAnswerSchema.Type;
3299
+ interface DecisionRule {
3300
+ readonly id: string;
3301
+ readonly target: Target;
3302
+ readonly question: string;
3303
+ readonly cutoff: number;
3304
+ readonly message?: string;
3305
+ readonly select?: (node: SelectedNode, match: SelectMatch) => boolean;
3306
+ readonly location?: RuleLocation;
3307
+ readonly model?: ModelSpec;
3308
+ readonly context?: RuleContext;
3309
+ readonly answer?: RuleAnswer;
3310
+ }
3311
+ interface DecisionOptions {
3312
+ readonly ci?: CiBehavior;
3313
+ readonly timeoutMs?: number;
3314
+ readonly maxSnippetChars?: number;
3315
+ readonly model?: ModelSpec;
3316
+ readonly env?: Readonly<Record<string, string>>;
3317
+ readonly explain?: ExplainSetting;
3318
+ }
3319
+ interface NoulQuestion$1 extends Readonly<Pick<typeof NoulQuestion.Encoded, "type" | "instructions">> {
3320
+ readonly instructions: string;
3321
+ }
3322
+ interface ChoiceQuestion$1 extends Readonly<Pick<typeof ChoiceQuestion.Encoded, "type" | "instructions" | "criteria">> {
3323
+ readonly instructions: string;
3324
+ readonly criteria: Readonly<Record<string, string | null>>;
3325
+ }
3326
+ type Question = NoulQuestion$1 | ChoiceQuestion$1;
3327
+ interface DecisionRequest extends Readonly<Pick<typeof DecisionsRequest.Encoded, "model" | "state" | "questions">> {
3328
+ readonly state: {
3329
+ readonly snippets: Readonly<Record<string, string>>;
3330
+ readonly contexts?: Readonly<Record<string, string>>;
3331
+ };
3332
+ readonly questions: Readonly<Record<string, Question>>;
3333
+ }
3334
+ type DecisionResponse = Pick<typeof DecisionsResponse.Type, "model" | "answers">;
3335
+ type DecideResult = {
3336
+ readonly ok: true;
3337
+ readonly response: DecisionResponse;
3338
+ readonly cached?: boolean;
3339
+ } | {
3340
+ readonly ok: false;
3341
+ readonly reason: string;
3342
+ };
3343
+ interface DecideInput {
3344
+ readonly request: DecisionRequest;
3345
+ readonly timeoutMs: number;
3346
+ readonly env: Readonly<Record<string, string>>;
3347
+ }
3348
+ interface DecisionProvider {
3349
+ readonly name: string;
3350
+ readonly requiredEnv: readonly string[];
3351
+ readonly models?: RegExp;
3352
+ readonly yesNo?: boolean;
3353
+ readonly decide: (input: DecideInput) => DecideResult;
3354
+ readonly decideAll?: (inputs: readonly DecideInput[]) => readonly DecideResult[];
3355
+ }
3356
+ interface DecisionPluginSetup extends DecisionOptions {
3357
+ readonly name?: string;
3358
+ readonly rules: readonly DecisionRule[];
3359
+ readonly providers?: readonly DecisionProvider[];
3360
+ }
3361
+ interface DecisionPlugin {
3362
+ readonly meta: {
3363
+ readonly name: string;
3364
+ };
3365
+ readonly rules: Readonly<Record<string, object>>;
3366
+ }
3367
+ declare const defineDecisionRule: <const Rule extends DecisionRule>(rule: Rule) => Rule;
3368
+ declare const defineProvider: <const Provider extends DecisionProvider>(provider: Provider) => Provider;
3369
+ export { SelectMatch as C, Target as E, RuleLocation as S, Severity as T, ModelSpec as _, DecideInput as a, RuleAnswer as b, DecisionPlugin as c, DecisionRequest as d, DecisionResponse as f, Frozen as g, ExplainSetting as h, CiBehavior as i, DecisionPluginSetup as l, EnclosingKind as m, defineProvider as n, DecideResult as o, DecisionRule as p, ChoiceQuestion$1 as r, DecisionOptions as s, defineDecisionRule as t, DecisionProvider as u, NoulQuestion$1 as v, SelectedNode as w, RuleContext as x, Question as y };
3370
+ //# sourceMappingURL=index-Cgg-w0hb.d.mts.map