@patronage/software-factory 1.0.0-alpha.35 → 1.0.0-alpha.37

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