vue-eslint-parser
Version:
The ESLint custom parser for `.vue` files.
1,359 lines (1,358 loc) • 123 kB
text/typescript
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
import { ScopeManager } from "eslint-scope";
import { Rule, SourceCode } from "eslint";
import { VisitorKeys as VisitorKeys$1 } from "eslint-visitor-keys";
//#region \0rolldown/runtime.js
//#endregion
//#region src/ast/errors.d.ts
/**
* HTML parse errors.
*/
declare class ParseError extends SyntaxError {
code?: ErrorCode;
index: number;
lineNumber: number;
column: number;
/**
* Create new parser error object.
* @param code The error code. See also: https://html.spec.whatwg.org/multipage/parsing.html#parse-errors
* @param offset The offset number of this error.
* @param line The line number of this error.
* @param column The column number of this error.
*/
static fromCode(code: ErrorCode, offset: number, line: number, column: number): ParseError;
/**
* Normalize the error object.
* @param x The error object to normalize.
*/
static normalize(x: any): ParseError | null;
/**
* Initialize this ParseError instance.
* @param message The error message.
* @param code The error code. See also: https://html.spec.whatwg.org/multipage/parsing.html#parse-errors
* @param offset The offset number of this error.
* @param line The line number of this error.
* @param column The column number of this error.
*/
constructor(message: string, code: ErrorCode | undefined, offset: number, line: number, column: number);
/**
* Type guard for ParseError.
* @param x The value to check.
* @returns `true` if the value has `message`, `pos`, `loc` properties.
*/
static isParseError(x: any): x is ParseError;
}
/**
* The error codes of HTML syntax errors.
* https://html.spec.whatwg.org/multipage/parsing.html#parse-errors
*/
type ErrorCode = "abrupt-closing-of-empty-comment" | "absence-of-digits-in-numeric-character-reference" | "cdata-in-html-content" | "character-reference-outside-unicode-range" | "control-character-in-input-stream" | "control-character-reference" | "eof-before-tag-name" | "eof-in-cdata" | "eof-in-comment" | "eof-in-tag" | "incorrectly-closed-comment" | "incorrectly-opened-comment" | "invalid-first-character-of-tag-name" | "missing-attribute-value" | "missing-end-tag-name" | "missing-semicolon-after-character-reference" | "missing-whitespace-between-attributes" | "nested-comment" | "noncharacter-character-reference" | "noncharacter-in-input-stream" | "null-character-reference" | "surrogate-character-reference" | "surrogate-in-input-stream" | "unexpected-character-in-attribute-name" | "unexpected-character-in-unquoted-attribute-value" | "unexpected-equals-sign-before-attribute-name" | "unexpected-null-character" | "unexpected-question-mark-instead-of-tag-name" | "unexpected-solidus-in-tag" | "unknown-named-character-reference" | "end-tag-with-attributes" | "duplicate-attribute" | "end-tag-with-trailing-solidus" | "non-void-html-element-start-tag-with-trailing-solidus" | "x-invalid-end-tag" | "x-invalid-namespace" | "x-missing-interpolation-end";
//#endregion
//#region src/ast/locations.d.ts
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* @copyright 2017 Toru Nagashima. All rights reserved.
* See LICENSE file in root directory for full license.
*/
/**
* Location information in lines and columns.
*/
interface Location {
/**
* The line number. This is 1-based.
*/
line: number;
/**
* The column number. This is 0-based.
*/
column: number;
}
/**
* Range information in lines and columns.
*/
interface LocationRange {
/**
* The start location.
*/
start: Location;
/**
* The end location.
*/
end: Location;
}
/**
* Location information in offsets.
* This is 0-based.
*/
type Offset = number;
/**
* Range information in offsets.
* The 1st element is the start offset.
* The 2nd element is the end offset.
*
* This is 0-based.
*/
type OffsetRange = [Offset, Offset];
/**
* Objects which have their location.
*/
interface HasLocation {
range: OffsetRange;
loc: LocationRange;
start?: number;
end?: number;
}
//#endregion
//#region src/ast/tokens.d.ts
/**
* Tokens.
*/
interface Token$1 extends HasLocation {
/**
* Token types.
*/
type: string;
/**
* Processed values.
*/
value: string;
}
//#endregion
//#region node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts
declare type Accessibility = 'private' | 'protected' | 'public';
declare type AccessorProperty = AccessorPropertyComputedName | AccessorPropertyNonComputedName;
declare interface AccessorPropertyComputedName extends PropertyDefinitionComputedNameBase {
type: AST_NODE_TYPES.AccessorProperty;
}
declare interface AccessorPropertyNonComputedName extends PropertyDefinitionNonComputedNameBase {
type: AST_NODE_TYPES.AccessorProperty;
}
declare interface ArrayExpression extends BaseNode {
type: AST_NODE_TYPES.ArrayExpression;
/**
* an element will be `null` in the case of a sparse array: `[1, ,3]`
*/
elements: (Expression | SpreadElement | null)[];
}
declare interface ArrayPattern extends BaseNode {
type: AST_NODE_TYPES.ArrayPattern;
decorators: Decorator[];
elements: (DestructuringPattern | null)[];
optional: boolean;
typeAnnotation: TSTypeAnnotation | undefined;
}
declare interface ArrowFunctionExpression extends BaseNode {
type: AST_NODE_TYPES.ArrowFunctionExpression;
async: boolean;
body: BlockStatement | Expression;
expression: boolean;
generator: false;
id: null;
params: Parameter[];
returnType: TSTypeAnnotation | undefined;
typeParameters: TSTypeParameterDeclaration | undefined;
}
declare interface AssignmentExpression extends BaseNode {
type: AST_NODE_TYPES.AssignmentExpression;
left: Expression;
operator: ValueOf<AssignmentOperatorToText>;
right: Expression;
}
declare interface AssignmentOperatorToText {
[SyntaxKind.AmpersandAmpersandEqualsToken]: '&&=';
[SyntaxKind.AmpersandEqualsToken]: '&=';
[SyntaxKind.AsteriskAsteriskEqualsToken]: '**=';
[SyntaxKind.AsteriskEqualsToken]: '*=';
[SyntaxKind.BarBarEqualsToken]: '||=';
[SyntaxKind.BarEqualsToken]: '|=';
[SyntaxKind.CaretEqualsToken]: '^=';
[SyntaxKind.EqualsToken]: '=';
[SyntaxKind.GreaterThanGreaterThanEqualsToken]: '>>=';
[SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken]: '>>>=';
[SyntaxKind.LessThanLessThanEqualsToken]: '<<=';
[SyntaxKind.MinusEqualsToken]: '-=';
[SyntaxKind.PercentEqualsToken]: '%=';
[SyntaxKind.PlusEqualsToken]: '+=';
[SyntaxKind.QuestionQuestionEqualsToken]: '??=';
[SyntaxKind.SlashEqualsToken]: '/=';
}
declare interface AssignmentPattern extends BaseNode {
type: AST_NODE_TYPES.AssignmentPattern;
decorators: Decorator[];
left: BindingName;
optional: boolean;
right: Expression;
typeAnnotation: TSTypeAnnotation | undefined;
}
declare enum AST_NODE_TYPES {
AccessorProperty = "AccessorProperty",
ArrayExpression = "ArrayExpression",
ArrayPattern = "ArrayPattern",
ArrowFunctionExpression = "ArrowFunctionExpression",
AssignmentExpression = "AssignmentExpression",
AssignmentPattern = "AssignmentPattern",
AwaitExpression = "AwaitExpression",
BinaryExpression = "BinaryExpression",
BlockStatement = "BlockStatement",
BreakStatement = "BreakStatement",
CallExpression = "CallExpression",
CatchClause = "CatchClause",
ChainExpression = "ChainExpression",
ClassBody = "ClassBody",
ClassDeclaration = "ClassDeclaration",
ClassExpression = "ClassExpression",
ConditionalExpression = "ConditionalExpression",
ContinueStatement = "ContinueStatement",
DebuggerStatement = "DebuggerStatement",
Decorator = "Decorator",
DoWhileStatement = "DoWhileStatement",
EmptyStatement = "EmptyStatement",
ExportAllDeclaration = "ExportAllDeclaration",
ExportDefaultDeclaration = "ExportDefaultDeclaration",
ExportNamedDeclaration = "ExportNamedDeclaration",
ExportSpecifier = "ExportSpecifier",
ExpressionStatement = "ExpressionStatement",
ForInStatement = "ForInStatement",
ForOfStatement = "ForOfStatement",
ForStatement = "ForStatement",
FunctionDeclaration = "FunctionDeclaration",
FunctionExpression = "FunctionExpression",
Identifier = "Identifier",
IfStatement = "IfStatement",
ImportAttribute = "ImportAttribute",
ImportDeclaration = "ImportDeclaration",
ImportDefaultSpecifier = "ImportDefaultSpecifier",
ImportExpression = "ImportExpression",
ImportNamespaceSpecifier = "ImportNamespaceSpecifier",
ImportSpecifier = "ImportSpecifier",
JSXAttribute = "JSXAttribute",
JSXClosingElement = "JSXClosingElement",
JSXClosingFragment = "JSXClosingFragment",
JSXElement = "JSXElement",
JSXEmptyExpression = "JSXEmptyExpression",
JSXExpressionContainer = "JSXExpressionContainer",
JSXFragment = "JSXFragment",
JSXIdentifier = "JSXIdentifier",
JSXMemberExpression = "JSXMemberExpression",
JSXNamespacedName = "JSXNamespacedName",
JSXOpeningElement = "JSXOpeningElement",
JSXOpeningFragment = "JSXOpeningFragment",
JSXSpreadAttribute = "JSXSpreadAttribute",
JSXSpreadChild = "JSXSpreadChild",
JSXText = "JSXText",
LabeledStatement = "LabeledStatement",
Literal = "Literal",
LogicalExpression = "LogicalExpression",
MemberExpression = "MemberExpression",
MetaProperty = "MetaProperty",
MethodDefinition = "MethodDefinition",
NewExpression = "NewExpression",
ObjectExpression = "ObjectExpression",
ObjectPattern = "ObjectPattern",
PrivateIdentifier = "PrivateIdentifier",
Program = "Program",
Property = "Property",
PropertyDefinition = "PropertyDefinition",
RestElement = "RestElement",
ReturnStatement = "ReturnStatement",
SequenceExpression = "SequenceExpression",
SpreadElement = "SpreadElement",
StaticBlock = "StaticBlock",
Super = "Super",
SwitchCase = "SwitchCase",
SwitchStatement = "SwitchStatement",
TaggedTemplateExpression = "TaggedTemplateExpression",
TemplateElement = "TemplateElement",
TemplateLiteral = "TemplateLiteral",
ThisExpression = "ThisExpression",
ThrowStatement = "ThrowStatement",
TryStatement = "TryStatement",
UnaryExpression = "UnaryExpression",
UpdateExpression = "UpdateExpression",
VariableDeclaration = "VariableDeclaration",
VariableDeclarator = "VariableDeclarator",
WhileStatement = "WhileStatement",
WithStatement = "WithStatement",
YieldExpression = "YieldExpression",
TSAbstractAccessorProperty = "TSAbstractAccessorProperty",
TSAbstractKeyword = "TSAbstractKeyword",
TSAbstractMethodDefinition = "TSAbstractMethodDefinition",
TSAbstractPropertyDefinition = "TSAbstractPropertyDefinition",
TSAnyKeyword = "TSAnyKeyword",
TSArrayType = "TSArrayType",
TSAsExpression = "TSAsExpression",
TSAsyncKeyword = "TSAsyncKeyword",
TSBigIntKeyword = "TSBigIntKeyword",
TSBooleanKeyword = "TSBooleanKeyword",
TSCallSignatureDeclaration = "TSCallSignatureDeclaration",
TSClassImplements = "TSClassImplements",
TSConditionalType = "TSConditionalType",
TSConstructorType = "TSConstructorType",
TSConstructSignatureDeclaration = "TSConstructSignatureDeclaration",
TSDeclareFunction = "TSDeclareFunction",
TSDeclareKeyword = "TSDeclareKeyword",
TSEmptyBodyFunctionExpression = "TSEmptyBodyFunctionExpression",
TSEnumBody = "TSEnumBody",
TSEnumDeclaration = "TSEnumDeclaration",
TSEnumMember = "TSEnumMember",
TSExportAssignment = "TSExportAssignment",
TSExportKeyword = "TSExportKeyword",
TSExternalModuleReference = "TSExternalModuleReference",
TSFunctionType = "TSFunctionType",
TSImportEqualsDeclaration = "TSImportEqualsDeclaration",
TSImportType = "TSImportType",
TSIndexedAccessType = "TSIndexedAccessType",
TSIndexSignature = "TSIndexSignature",
TSInferType = "TSInferType",
TSInstantiationExpression = "TSInstantiationExpression",
TSInterfaceBody = "TSInterfaceBody",
TSInterfaceDeclaration = "TSInterfaceDeclaration",
TSInterfaceHeritage = "TSInterfaceHeritage",
TSIntersectionType = "TSIntersectionType",
TSIntrinsicKeyword = "TSIntrinsicKeyword",
TSLiteralType = "TSLiteralType",
TSMappedType = "TSMappedType",
TSMethodSignature = "TSMethodSignature",
TSModuleBlock = "TSModuleBlock",
TSModuleDeclaration = "TSModuleDeclaration",
TSNamedTupleMember = "TSNamedTupleMember",
TSNamespaceExportDeclaration = "TSNamespaceExportDeclaration",
TSNeverKeyword = "TSNeverKeyword",
TSNonNullExpression = "TSNonNullExpression",
TSNullKeyword = "TSNullKeyword",
TSNumberKeyword = "TSNumberKeyword",
TSObjectKeyword = "TSObjectKeyword",
TSOptionalType = "TSOptionalType",
TSParameterProperty = "TSParameterProperty",
TSPrivateKeyword = "TSPrivateKeyword",
TSPropertySignature = "TSPropertySignature",
TSProtectedKeyword = "TSProtectedKeyword",
TSPublicKeyword = "TSPublicKeyword",
TSQualifiedName = "TSQualifiedName",
TSReadonlyKeyword = "TSReadonlyKeyword",
TSRestType = "TSRestType",
TSSatisfiesExpression = "TSSatisfiesExpression",
TSStaticKeyword = "TSStaticKeyword",
TSStringKeyword = "TSStringKeyword",
TSSymbolKeyword = "TSSymbolKeyword",
TSTemplateLiteralType = "TSTemplateLiteralType",
TSThisType = "TSThisType",
TSTupleType = "TSTupleType",
TSTypeAliasDeclaration = "TSTypeAliasDeclaration",
TSTypeAnnotation = "TSTypeAnnotation",
TSTypeAssertion = "TSTypeAssertion",
TSTypeLiteral = "TSTypeLiteral",
TSTypeOperator = "TSTypeOperator",
TSTypeParameter = "TSTypeParameter",
TSTypeParameterDeclaration = "TSTypeParameterDeclaration",
TSTypeParameterInstantiation = "TSTypeParameterInstantiation",
TSTypePredicate = "TSTypePredicate",
TSTypeQuery = "TSTypeQuery",
TSTypeReference = "TSTypeReference",
TSUndefinedKeyword = "TSUndefinedKeyword",
TSUnionType = "TSUnionType",
TSUnknownKeyword = "TSUnknownKeyword",
TSVoidKeyword = "TSVoidKeyword"
}
declare enum AST_TOKEN_TYPES {
Boolean = "Boolean",
Identifier = "Identifier",
JSXIdentifier = "JSXIdentifier",
PrivateIdentifier = "PrivateIdentifier",
JSXText = "JSXText",
Keyword = "Keyword",
Null = "Null",
Numeric = "Numeric",
Punctuator = "Punctuator",
RegularExpression = "RegularExpression",
String = "String",
Template = "Template",
Block = "Block",
Line = "Line"
}
declare interface AwaitExpression extends BaseNode {
type: AST_NODE_TYPES.AwaitExpression;
argument: Expression;
}
declare interface BaseNode extends NodeOrTokenData {
type: AST_NODE_TYPES;
}
declare interface BaseToken extends NodeOrTokenData {
type: AST_TOKEN_TYPES;
value: string;
}
declare interface BigIntLiteral extends LiteralBase {
bigint: string;
value: bigint | null;
}
declare type BinaryExpression = PrivateInExpression | SymmetricBinaryExpression;
declare interface BinaryOperatorToText {
[SyntaxKind.AmpersandAmpersandToken]: '&&';
[SyntaxKind.AmpersandToken]: '&';
[SyntaxKind.AsteriskAsteriskToken]: '**';
[SyntaxKind.AsteriskToken]: '*';
[SyntaxKind.BarBarToken]: '||';
[SyntaxKind.BarToken]: '|';
[SyntaxKind.CaretToken]: '^';
[SyntaxKind.EqualsEqualsEqualsToken]: '===';
[SyntaxKind.EqualsEqualsToken]: '==';
[SyntaxKind.ExclamationEqualsEqualsToken]: '!==';
[SyntaxKind.ExclamationEqualsToken]: '!=';
[SyntaxKind.GreaterThanEqualsToken]: '>=';
[SyntaxKind.GreaterThanGreaterThanGreaterThanToken]: '>>>';
[SyntaxKind.GreaterThanGreaterThanToken]: '>>';
[SyntaxKind.GreaterThanToken]: '>';
[SyntaxKind.InKeyword]: 'in';
[SyntaxKind.InstanceOfKeyword]: 'instanceof';
[SyntaxKind.LessThanEqualsToken]: '<=';
[SyntaxKind.LessThanLessThanToken]: '<<';
[SyntaxKind.LessThanToken]: '<';
[SyntaxKind.MinusToken]: '-';
[SyntaxKind.PercentToken]: '%';
[SyntaxKind.PlusToken]: '+';
[SyntaxKind.SlashToken]: '/';
}
declare type BindingName = BindingPattern | Identifier;
declare type BindingPattern = ArrayPattern | ObjectPattern;
declare interface BlockComment extends BaseToken {
type: AST_TOKEN_TYPES.Block;
}
declare interface BlockStatement extends BaseNode {
type: AST_NODE_TYPES.BlockStatement;
body: Statement[];
}
declare interface BooleanLiteral extends LiteralBase {
raw: 'false' | 'true';
value: boolean;
}
declare interface BooleanToken extends BaseToken {
type: AST_TOKEN_TYPES.Boolean;
}
declare interface BreakStatement extends BaseNode {
type: AST_NODE_TYPES.BreakStatement;
label: Identifier | null;
}
declare interface CallExpression extends BaseNode {
type: AST_NODE_TYPES.CallExpression;
arguments: CallExpressionArgument[];
callee: Expression;
optional: boolean;
typeArguments: TSTypeParameterInstantiation | undefined;
}
declare type CallExpressionArgument = Expression | SpreadElement;
declare interface CatchClause extends BaseNode {
type: AST_NODE_TYPES.CatchClause;
body: BlockStatement;
param: BindingName | null;
}
declare type ChainElement = CallExpression | MemberExpression | TSNonNullExpression;
declare interface ChainExpression extends BaseNode {
type: AST_NODE_TYPES.ChainExpression;
expression: ChainElement;
}
declare interface ClassBase extends BaseNode {
/**
* Whether the class is an abstract class.
* @example
* ```ts
* abstract class Foo {}
* ```
*/
abstract: boolean;
/**
* The class body.
*/
body: ClassBody;
/**
* Whether the class has been `declare`d:
* @example
* ```ts
* declare class Foo {}
* ```
*/
declare: boolean;
/**
* The decorators declared for the class.
* @example
* ```ts
* @deco
* class Foo {}
* ```
*/
decorators: Decorator[];
/**
* The class's name.
* - For a `ClassExpression` this may be `null` if the name is omitted.
* - For a `ClassDeclaration` this may be `null` if and only if the parent is
* an `ExportDefaultDeclaration`.
*/
id: Identifier | null;
/**
* The implemented interfaces for the class.
*/
implements: TSClassImplements[];
/**
* The super class this class extends.
*/
superClass: LeftHandSideExpression | null;
/**
* The generic type parameters passed to the superClass.
*/
superTypeArguments: TSTypeParameterInstantiation | undefined;
/**
* The generic type parameters declared for the class.
*/
typeParameters: TSTypeParameterDeclaration | undefined;
}
declare interface ClassBody extends BaseNode {
type: AST_NODE_TYPES.ClassBody;
body: ClassElement[];
}
declare type ClassDeclaration = ClassDeclarationWithName | ClassDeclarationWithOptionalName;
declare interface ClassDeclarationBase extends ClassBase {
type: AST_NODE_TYPES.ClassDeclaration;
}
/**
* A normal class declaration:
* ```
* class A {}
* ```
*/
declare interface ClassDeclarationWithName extends ClassDeclarationBase {
id: Identifier;
}
/**
* Default-exported class declarations have optional names:
* ```
* export default class {}
* ```
*/
declare interface ClassDeclarationWithOptionalName extends ClassDeclarationBase {
id: Identifier | null;
}
declare type ClassElement = AccessorProperty | MethodDefinition | PropertyDefinition | StaticBlock | TSAbstractAccessorProperty | TSAbstractMethodDefinition | TSAbstractPropertyDefinition | TSIndexSignature;
declare interface ClassExpression extends ClassBase {
type: AST_NODE_TYPES.ClassExpression;
abstract: false;
declare: false;
}
declare interface ClassMethodDefinitionNonComputedNameBase extends MethodDefinitionBase {
computed: false;
key: ClassPropertyNameNonComputed;
}
declare interface ClassPropertyDefinitionNonComputedNameBase extends PropertyDefinitionBase {
computed: false;
key: ClassPropertyNameNonComputed;
}
declare type ClassPropertyNameNonComputed = PrivateIdentifier | PropertyNameNonComputed;
declare type Comment = BlockComment | LineComment;
declare interface ConditionalExpression extends BaseNode {
type: AST_NODE_TYPES.ConditionalExpression;
alternate: Expression;
consequent: Expression;
test: Expression;
}
declare interface ConstDeclaration extends LetOrConstOrVarDeclarationBase {
/**
* In a `declare const` declaration, the declarators may have initializers, but
* not definite assignment assertions. Each declarator cannot have both an
* initializer and a type annotation.
*
* Even if the declaration has no `declare`, it may still be ambient and have
* no initializer.
*/
declarations: VariableDeclaratorMaybeInit[];
kind: 'const';
}
declare interface ContinueStatement extends BaseNode {
type: AST_NODE_TYPES.ContinueStatement;
label: Identifier | null;
}
declare interface DebuggerStatement extends BaseNode {
type: AST_NODE_TYPES.DebuggerStatement;
}
declare interface Decorator extends BaseNode {
type: AST_NODE_TYPES.Decorator;
expression: LeftHandSideExpression;
}
declare type DefaultExportDeclarations = ClassDeclarationWithOptionalName | Expression | FunctionDeclarationWithName | FunctionDeclarationWithOptionalName | TSDeclareFunction | TSEnumDeclaration | TSInterfaceDeclaration | TSModuleDeclaration | TSTypeAliasDeclaration | VariableDeclaration;
declare type DestructuringPattern = ArrayPattern | AssignmentPattern | Identifier | MemberExpression | ObjectPattern | RestElement;
declare interface DoWhileStatement extends BaseNode {
type: AST_NODE_TYPES.DoWhileStatement;
body: Statement;
test: Expression;
}
declare interface EmptyStatement extends BaseNode {
type: AST_NODE_TYPES.EmptyStatement;
}
declare type EntityName = Identifier | ThisExpression | TSQualifiedName;
declare interface ExportAllDeclaration extends BaseNode {
type: AST_NODE_TYPES.ExportAllDeclaration;
/**
* The assertions declared for the export.
* @example
* ```ts
* export * from 'mod' assert \{ type: 'json' \};
* ```
* @deprecated Replaced with {@link `attributes`}.
*/
assertions: ImportAttribute[];
/**
* The attributes declared for the export.
* @example
* ```ts
* export * from 'mod' with \{ type: 'json' \};
* ```
*/
attributes: ImportAttribute[];
/**
* The name for the exported items (`as X`). `null` if no name is assigned.
*/
exported: Identifier | null;
/**
* The kind of the export.
*/
exportKind: ExportKind;
/**
* The source module being exported from.
*/
source: StringLiteral;
}
declare type ExportAndImportKind = 'type' | 'value';
declare interface ExportDefaultDeclaration extends BaseNode {
type: AST_NODE_TYPES.ExportDefaultDeclaration;
/**
* The declaration being exported.
*/
declaration: DefaultExportDeclarations;
/**
* The kind of the export. Always `value` for default exports.
*/
exportKind: 'value';
}
declare type ExportKind = ExportAndImportKind;
declare type ExportNamedDeclaration = ExportNamedDeclarationWithoutSourceWithMultiple | ExportNamedDeclarationWithoutSourceWithSingle | ExportNamedDeclarationWithSource;
declare interface ExportNamedDeclarationBase extends BaseNode {
type: AST_NODE_TYPES.ExportNamedDeclaration;
/**
* The assertions declared for the export.
* @example
* ```ts
* export { foo } from 'mod' assert \{ type: 'json' \};
* ```
* This will be an empty array if `source` is `null`
* @deprecated Replaced with {@link `attributes`}.
*/
assertions: ImportAttribute[];
/**
* The attributes declared for the export.
* @example
* ```ts
* export { foo } from 'mod' with \{ type: 'json' \};
* ```
* This will be an empty array if `source` is `null`
*/
attributes: ImportAttribute[];
/**
* The exported declaration.
* @example
* ```ts
* export const x = 1;
* ```
* This will be `null` if `source` is not `null`, or if there are `specifiers`
*/
declaration: NamedExportDeclarations | null;
/**
* The kind of the export.
*/
exportKind: ExportKind;
/**
* The source module being exported from.
*/
source: StringLiteral | null;
/**
* The specifiers being exported.
* @example
* ```ts
* export { a, b };
* ```
* This will be an empty array if `declaration` is not `null`
*/
specifiers: ExportSpecifier[];
}
/**
* Exporting names from the current module.
* ```
* export {};
* export { a, b };
* ```
*/
declare interface ExportNamedDeclarationWithoutSourceWithMultiple extends ExportNamedDeclarationBase {
/**
* This will always be an empty array.
* @deprecated Replaced with {@link `attributes`}.
*/
assertions: ImportAttribute[];
/**
* This will always be an empty array.
*/
attributes: ImportAttribute[];
declaration: null;
source: null;
specifiers: ExportSpecifierWithIdentifierLocal[];
}
/**
* Exporting a single named declaration.
* ```
* export const x = 1;
* ```
*/
declare interface ExportNamedDeclarationWithoutSourceWithSingle extends ExportNamedDeclarationBase {
/**
* This will always be an empty array.
* @deprecated Replaced with {@link `attributes`}.
*/
assertions: ImportAttribute[];
/**
* This will always be an empty array.
*/
attributes: ImportAttribute[];
declaration: NamedExportDeclarations;
source: null;
/**
* This will always be an empty array.
*/
specifiers: ExportSpecifierWithIdentifierLocal[];
}
/**
* Export names from another module.
* ```
* export { a, b } from 'mod';
* ```
*/
declare interface ExportNamedDeclarationWithSource extends ExportNamedDeclarationBase {
declaration: null;
source: StringLiteral;
}
declare type ExportSpecifier = ExportSpecifierWithIdentifierLocal | ExportSpecifierWithStringOrLiteralLocal;
declare interface ExportSpecifierBase extends BaseNode {
type: AST_NODE_TYPES.ExportSpecifier;
exported: Identifier | StringLiteral;
exportKind: ExportKind;
local: Identifier | StringLiteral;
}
declare interface ExportSpecifierWithIdentifierLocal extends ExportSpecifierBase {
local: Identifier;
}
declare interface ExportSpecifierWithStringOrLiteralLocal extends ExportSpecifierBase {
local: Identifier | StringLiteral;
}
declare type Expression = ArrayExpression | ArrayPattern | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | CallExpression | ChainExpression | ClassExpression | ConditionalExpression | FunctionExpression | Identifier | ImportExpression | JSXElement | JSXFragment | LiteralExpression | LogicalExpression | MemberExpression | MetaProperty | NewExpression | ObjectExpression | ObjectPattern | SequenceExpression | Super | TaggedTemplateExpression | TemplateLiteral | ThisExpression | TSAsExpression | TSInstantiationExpression | TSNonNullExpression | TSSatisfiesExpression | TSTypeAssertion | UnaryExpression | UpdateExpression | YieldExpression;
declare interface ExpressionStatement extends BaseNode {
type: AST_NODE_TYPES.ExpressionStatement;
directive: string | undefined;
expression: Expression;
}
declare type ForInitialiser = Expression | LetOrConstOrVarDeclaration;
declare interface ForInStatement extends BaseNode {
type: AST_NODE_TYPES.ForInStatement;
body: Statement;
left: ForInitialiser;
right: Expression;
}
declare type ForOfInitialiser = Expression | LetOrConstOrVarDeclaration | UsingInForOfDeclaration;
declare interface ForOfStatement extends BaseNode {
type: AST_NODE_TYPES.ForOfStatement;
await: boolean;
body: Statement;
left: ForOfInitialiser;
right: Expression;
}
declare interface ForStatement extends BaseNode {
type: AST_NODE_TYPES.ForStatement;
body: Statement;
init: Expression | ForInitialiser | null;
test: Expression | null;
update: Expression | null;
}
declare interface FunctionBase extends BaseNode {
/**
* Whether the function is async:
* ```
* async function foo() {}
* const x = async function () {}
* const x = async () => {}
* ```
*/
async: boolean;
/**
* The body of the function.
* - For an `ArrowFunctionExpression` this may be an `Expression` or `BlockStatement`.
* - For a `FunctionDeclaration` or `FunctionExpression` this is always a `BlockStatement`.
* - For a `TSDeclareFunction` this is always `undefined`.
* - For a `TSEmptyBodyFunctionExpression` this is always `null`.
*/
body: BlockStatement | Expression | null | undefined;
/**
* This is only `true` if and only if the node is a `TSDeclareFunction` and it has `declare`:
* ```
* declare function foo() {}
* ```
*/
declare: boolean;
/**
* This is only ever `true` if and only the node is an `ArrowFunctionExpression` and the body
* is an expression:
* ```
* (() => 1)
* ```
*/
expression: boolean;
/**
* Whether the function is a generator function:
* ```
* function *foo() {}
* const x = function *() {}
* ```
* This is always `false` for arrow functions as they cannot be generators.
*/
generator: boolean;
/**
* The function's name.
* - For an `ArrowFunctionExpression` this is always `null`.
* - For a `FunctionExpression` this may be `null` if the name is omitted.
* - For a `FunctionDeclaration` or `TSDeclareFunction` this may be `null` if
* and only if the parent is an `ExportDefaultDeclaration`.
*/
id: Identifier | null;
/**
* The list of parameters declared for the function.
*/
params: Parameter[];
/**
* The return type annotation for the function.
*/
returnType: TSTypeAnnotation | undefined;
/**
* The generic type parameter declaration for the function.
*/
typeParameters: TSTypeParameterDeclaration | undefined;
}
declare type FunctionDeclaration = FunctionDeclarationWithName | FunctionDeclarationWithOptionalName;
declare interface FunctionDeclarationBase extends FunctionBase {
type: AST_NODE_TYPES.FunctionDeclaration;
body: BlockStatement;
declare: false;
expression: false;
}
/**
* A normal function declaration:
* ```
* function f() {}
* ```
*/
declare interface FunctionDeclarationWithName extends FunctionDeclarationBase {
id: Identifier;
}
/**
* Default-exported function declarations have optional names:
* ```
* export default function () {}
* ```
*/
declare interface FunctionDeclarationWithOptionalName extends FunctionDeclarationBase {
id: Identifier | null;
}
declare interface FunctionExpression extends FunctionBase {
type: AST_NODE_TYPES.FunctionExpression;
body: BlockStatement;
expression: false;
}
declare type FunctionLike = ArrowFunctionExpression | FunctionDeclaration | FunctionExpression | TSDeclareFunction | TSEmptyBodyFunctionExpression;
declare interface Identifier extends BaseNode {
type: AST_NODE_TYPES.Identifier;
decorators: Decorator[];
name: string;
optional: boolean;
typeAnnotation: TSTypeAnnotation | undefined;
}
declare interface IdentifierToken extends BaseToken {
type: AST_TOKEN_TYPES.Identifier;
}
declare interface IfStatement extends BaseNode {
type: AST_NODE_TYPES.IfStatement;
alternate: Statement | null;
consequent: Statement;
test: Expression;
}
declare interface ImportAttribute extends BaseNode {
type: AST_NODE_TYPES.ImportAttribute;
key: Identifier | Literal;
value: Literal;
}
declare type ImportClause = ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier;
declare interface ImportDeclaration extends BaseNode {
type: AST_NODE_TYPES.ImportDeclaration;
/**
* The assertions declared for the export.
* @example
* ```ts
* import * from 'mod' assert \{ type: 'json' \};
* ```
* @deprecated Replaced with {@link `attributes`}.
*/
assertions: ImportAttribute[];
/**
* The attributes declared for the export.
* @example
* ```ts
* import * from 'mod' with \{ type: 'json' \};
* ```
*/
attributes: ImportAttribute[];
/**
* The kind of the import.
*/
importKind: ImportKind;
/**
* The source module being imported from.
*/
source: StringLiteral;
/**
* The specifiers being imported.
* If this is an empty array then either there are no specifiers:
* ```
* import {} from 'mod';
* ```
* Or it is a side-effect import:
* ```
* import 'mod';
* ```
*/
specifiers: ImportClause[];
}
declare interface ImportDefaultSpecifier extends BaseNode {
type: AST_NODE_TYPES.ImportDefaultSpecifier;
local: Identifier;
}
declare interface ImportExpression extends BaseNode {
type: AST_NODE_TYPES.ImportExpression;
/**
* The attributes declared for the dynamic import.
* @example
* ```ts
* import('mod', \{ assert: \{ type: 'json' \} \});
* ```
* @deprecated Replaced with {@link `options`}.
*/
attributes: Expression | null;
/**
* The options bag declared for the dynamic import.
* @example
* ```ts
* import('mod', \{ assert: \{ type: 'json' \} \});
* ```
*/
options: Expression | null;
source: Expression;
}
declare type ImportKind = ExportAndImportKind;
declare interface ImportNamespaceSpecifier extends BaseNode {
type: AST_NODE_TYPES.ImportNamespaceSpecifier;
local: Identifier;
}
declare interface ImportSpecifier extends BaseNode {
type: AST_NODE_TYPES.ImportSpecifier;
imported: Identifier | StringLiteral;
importKind: ImportKind;
local: Identifier;
}
declare interface JSXAttribute extends BaseNode {
type: AST_NODE_TYPES.JSXAttribute;
name: JSXIdentifier | JSXNamespacedName;
value: JSXElement | JSXExpression | Literal | null;
}
declare type JSXChild = JSXElement | JSXExpression | JSXFragment | JSXText;
declare interface JSXClosingElement extends BaseNode {
type: AST_NODE_TYPES.JSXClosingElement;
name: JSXTagNameExpression;
}
declare interface JSXClosingFragment extends BaseNode {
type: AST_NODE_TYPES.JSXClosingFragment;
}
declare interface JSXElement extends BaseNode {
type: AST_NODE_TYPES.JSXElement;
children: JSXChild[];
closingElement: JSXClosingElement | null;
openingElement: JSXOpeningElement;
}
declare interface JSXEmptyExpression extends BaseNode {
type: AST_NODE_TYPES.JSXEmptyExpression;
}
declare type JSXExpression = JSXExpressionContainer | JSXSpreadChild;
declare interface JSXExpressionContainer extends BaseNode {
type: AST_NODE_TYPES.JSXExpressionContainer;
expression: Expression | JSXEmptyExpression;
}
declare interface JSXFragment extends BaseNode {
type: AST_NODE_TYPES.JSXFragment;
children: JSXChild[];
closingFragment: JSXClosingFragment;
openingFragment: JSXOpeningFragment;
}
declare interface JSXIdentifier extends BaseNode {
type: AST_NODE_TYPES.JSXIdentifier;
name: string;
}
declare interface JSXIdentifierToken extends BaseToken {
type: AST_TOKEN_TYPES.JSXIdentifier;
}
declare interface JSXMemberExpression extends BaseNode {
type: AST_NODE_TYPES.JSXMemberExpression;
object: JSXTagNameExpression;
property: JSXIdentifier;
}
declare interface JSXNamespacedName extends BaseNode {
type: AST_NODE_TYPES.JSXNamespacedName;
name: JSXIdentifier;
namespace: JSXIdentifier;
}
declare interface JSXOpeningElement extends BaseNode {
type: AST_NODE_TYPES.JSXOpeningElement;
attributes: (JSXAttribute | JSXSpreadAttribute)[];
name: JSXTagNameExpression;
selfClosing: boolean;
typeArguments: TSTypeParameterInstantiation | undefined;
}
declare interface JSXOpeningFragment extends BaseNode {
type: AST_NODE_TYPES.JSXOpeningFragment;
}
declare interface JSXSpreadAttribute extends BaseNode {
type: AST_NODE_TYPES.JSXSpreadAttribute;
argument: Expression;
}
declare interface JSXSpreadChild extends BaseNode {
type: AST_NODE_TYPES.JSXSpreadChild;
expression: Expression | JSXEmptyExpression;
}
declare type JSXTagNameExpression = JSXIdentifier | JSXMemberExpression | JSXNamespacedName;
declare interface JSXText extends BaseNode {
type: AST_NODE_TYPES.JSXText;
raw: string;
value: string;
}
declare interface JSXTextToken extends BaseToken {
type: AST_TOKEN_TYPES.JSXText;
}
declare interface KeywordToken extends BaseToken {
type: AST_TOKEN_TYPES.Keyword;
}
declare interface LabeledStatement extends BaseNode {
type: AST_NODE_TYPES.LabeledStatement;
body: Statement;
label: Identifier;
}
declare type LeftHandSideExpression = ArrayExpression | ArrayPattern | ArrowFunctionExpression | CallExpression | ClassExpression | FunctionExpression | Identifier | JSXElement | JSXFragment | LiteralExpression | MemberExpression | MetaProperty | ObjectExpression | ObjectPattern | SequenceExpression | Super | TaggedTemplateExpression | ThisExpression | TSAsExpression | TSNonNullExpression | TSTypeAssertion;
declare type LetOrConstOrVarDeclaration = ConstDeclaration | LetOrVarDeclaredDeclaration | LetOrVarNonDeclaredDeclaration;
declare interface LetOrConstOrVarDeclarationBase extends BaseNode {
type: AST_NODE_TYPES.VariableDeclaration;
/**
* The variables declared by this declaration.
* Always non-empty.
* @example
* ```ts
* let x;
* let y, z;
* ```
*/
declarations: LetOrConstOrVarDeclarator[];
/**
* Whether the declaration is `declare`d
* @example
* ```ts
* declare const x = 1;
* ```
*/
declare: boolean;
/**
* The keyword used to declare the variable(s)
* @example
* ```ts
* const x = 1;
* let y = 2;
* var z = 3;
* ```
*/
kind: 'const' | 'let' | 'var';
}
declare type LetOrConstOrVarDeclarator = VariableDeclaratorDefiniteAssignment | VariableDeclaratorMaybeInit | VariableDeclaratorNoInit;
declare interface LetOrVarDeclaredDeclaration extends LetOrConstOrVarDeclarationBase {
/**
* In a `declare let` declaration, the declarators must not have definite assignment
* assertions or initializers.
*
* @example
* ```ts
* using x = 1;
* using y =1, z = 2;
* ```
*/
declarations: VariableDeclaratorNoInit[];
declare: true;
kind: 'let' | 'var';
}
declare interface LetOrVarNonDeclaredDeclaration extends LetOrConstOrVarDeclarationBase {
/**
* In a `let`/`var` declaration, the declarators may have definite assignment
* assertions or initializers, but not both.
*/
declarations: (VariableDeclaratorDefiniteAssignment | VariableDeclaratorMaybeInit)[];
declare: false;
kind: 'let' | 'var';
}
declare interface LineComment extends BaseToken {
type: AST_TOKEN_TYPES.Line;
}
declare type Literal = BigIntLiteral | BooleanLiteral | NullLiteral | NumberLiteral | RegExpLiteral | StringLiteral;
declare interface LiteralBase extends BaseNode {
type: AST_NODE_TYPES.Literal;
raw: string;
value: bigint | boolean | number | string | RegExp | null;
}
declare type LiteralExpression = Literal | TemplateLiteral;
declare interface LogicalExpression extends BaseNode {
type: AST_NODE_TYPES.LogicalExpression;
left: Expression;
operator: '&&' | '??' | '||';
right: Expression;
}
declare type MemberExpression = MemberExpressionComputedName | MemberExpressionNonComputedName;
declare interface MemberExpressionBase extends BaseNode {
computed: boolean;
object: Expression;
optional: boolean;
property: Expression | Identifier | PrivateIdentifier;
}
declare interface MemberExpressionComputedName extends MemberExpressionBase {
type: AST_NODE_TYPES.MemberExpression;
computed: true;
property: Expression;
}
declare interface MemberExpressionNonComputedName extends MemberExpressionBase {
type: AST_NODE_TYPES.MemberExpression;
computed: false;
property: Identifier | PrivateIdentifier;
}
declare interface MetaProperty extends BaseNode {
type: AST_NODE_TYPES.MetaProperty;
meta: Identifier;
property: Identifier;
}
declare type MethodDefinition = MethodDefinitionComputedName | MethodDefinitionNonComputedName;
/** this should not be directly used - instead use MethodDefinitionComputedNameBase or MethodDefinitionNonComputedNameBase */
declare interface MethodDefinitionBase extends BaseNode {
accessibility: Accessibility | undefined;
computed: boolean;
decorators: Decorator[];
key: PropertyName;
kind: 'constructor' | 'get' | 'method' | 'set';
optional: boolean;
override: boolean;
static: boolean;
value: FunctionExpression | TSEmptyBodyFunctionExpression;
}
declare interface MethodDefinitionComputedName extends MethodDefinitionComputedNameBase {
type: AST_NODE_TYPES.MethodDefinition;
}
declare interface MethodDefinitionComputedNameBase extends MethodDefinitionBase {
computed: true;
key: PropertyNameComputed;
}
declare interface MethodDefinitionNonComputedName extends ClassMethodDefinitionNonComputedNameBase {
type: AST_NODE_TYPES.MethodDefinition;
}
declare interface MethodDefinitionNonComputedNameBase extends MethodDefinitionBase {
computed: false;
key: PropertyNameNonComputed;
}
declare type NamedExportDeclarations = ClassDeclarationWithName | ClassDeclarationWithOptionalName | FunctionDeclarationWithName | FunctionDeclarationWithOptionalName | TSDeclareFunction | TSEnumDeclaration | TSImportEqualsDeclaration | TSInterfaceDeclaration | TSModuleDeclaration | TSTypeAliasDeclaration | VariableDeclaration;
declare interface NewExpression extends BaseNode {
type: AST_NODE_TYPES.NewExpression;
arguments: CallExpressionArgument[];
callee: Expression;
typeArguments: TSTypeParameterInstantiation | undefined;
}
declare type Node$1 = AccessorProperty | ArrayExpression | ArrayPattern | ArrowFunctionExpression | AssignmentExpression | AssignmentPattern | AwaitExpression | BinaryExpression | BlockStatement | BreakStatement | CallExpression | CatchClause | ChainExpression | ClassBody | ClassDeclaration | ClassExpression | ConditionalExpression | ContinueStatement | DebuggerStatement | Decorator | DoWhileStatement | EmptyStatement | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ExportSpecifier | ExpressionStatement | ForInStatement | ForOfStatement | ForStatement | FunctionDeclaration | FunctionExpression | Identifier | IfStatement | ImportAttribute | ImportDeclaration | ImportDefaultSpecifier | ImportExpression | ImportNamespaceSpecifier | ImportSpecifier | JSXAttribute | JSXClosingElement | JSXClosingFragment | JSXElement | JSXEmptyExpression | JSXExpressionContainer | JSXFragment | JSXIdentifier | JSXMemberExpression | JSXNamespacedName | JSXOpeningElement | JSXOpeningFragment | JSXSpreadAttribute | JSXSpreadChild | JSXText | LabeledStatement | Literal | LogicalExpression | MemberExpression | MetaProperty | MethodDefinition | NewExpression | ObjectExpression | ObjectPattern | PrivateIdentifier | Program$1 | Property | PropertyDefinition | RestElement | ReturnStatement | SequenceExpression | SpreadElement | StaticBlock | Super | SwitchCase | SwitchStatement | TaggedTemplateExpression | TemplateElement | TemplateLiteral | ThisExpression | ThrowStatement | TryStatement | TSAbstractAccessorProperty | TSAbstractKeyword | TSAbstractMethodDefinition | TSAbstractPropertyDefinition | TSAnyKeyword | TSArrayType | TSAsExpression | TSAsyncKeyword | TSBigIntKeyword | TSBooleanKeyword | TSCallSignatureDeclaration | TSClassImplements | TSConditionalType | TSConstructorType | TSConstructSignatureDeclaration | TSDeclareFunction | TSDeclareKeyword | TSEmptyBodyFunctionExpression | TSEnumBody | TSEnumDeclaration | TSEnumMember | TSExportAssignment | TSExportKeyword | TSExternalModuleReference | TSFunctionType | TSImportEqualsDeclaration | TSImportType | TSIndexedAccessType | TSIndexSignature | TSInferType | TSInstantiationExpression | TSInterfaceBody | TSInterfaceDeclaration | TSInterfaceHeritage | TSIntersectionType | TSIntrinsicKeyword | TSLiteralType | TSMappedType | TSMethodSignature | TSModuleBlock | TSModuleDeclaration | TSNamedTupleMember | TSNamespaceExportDeclaration | TSNeverKeyword | TSNonNullExpression | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSOptionalType | TSParameterProperty | TSPrivateKeyword | TSPropertySignature | TSProtectedKeyword | TSPublicKeyword | TSQualifiedName | TSReadonlyKeyword | TSRestType | TSSatisfiesExpression | TSStaticKeyword | TSStringKeyword | TSSymbolKeyword | TSTemplateLiteralType | TSThisType | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation | TSTypeAssertion | TSTypeLiteral | TSTypeOperator | TSTypeParameter | TSTypeParameterDeclaration | TSTypeParameterInstantiation | TSTypePredicate | TSTypeQuery | TSTypeReference | TSUndefinedKeyword | TSUnionType | TSUnknownKeyword | TSVoidKeyword | UnaryExpression | UpdateExpression | VariableDeclaration | VariableDeclarator | WhileStatement | WithStatement | YieldExpression;
declare interface NodeOrTokenData {
type: string;
/**
* The source location information of the node.
*
* The loc property is defined as nullable by ESTree, but ESLint requires this property.
*/
loc: SourceLocation;
range: Range;
}
declare interface NullLiteral extends LiteralBase {
raw: 'null';
value: null;
}
declare interface NullToken extends BaseToken {
type: AST_TOKEN_TYPES.Null;
}
declare interface NumberLiteral extends LiteralBase {
value: number;
}
declare interface NumericToken extends BaseToken {
type: AST_TOKEN_TYPES.Numeric;
}
declare interface ObjectExpression extends BaseNode {
type: AST_NODE_TYPES.ObjectExpression;
properties: ObjectLiteralElement[];
}
declare type ObjectLiteralElement = Property | SpreadElement;
declare interface ObjectPattern extends BaseNode {
type: AST_NODE_TYPES.ObjectPattern;
decorators: Decorator[];
optional: boolean;
properties: (Property | RestElement)[];
typeAnnotation: TSTypeAnnotation | undefined;
}
declare type Parameter = ArrayPattern | AssignmentPattern | Identifier | ObjectPattern | RestElement | TSParameterProperty;
declare type ParameterPropertyParameter = (AssignmentPattern & {
left: Identifier;
}) | Identifier;
declare interface Position {
/**
* Column number on the line (0-indexed)
*/
column: number;
/**
* Line number (1-indexed)
*/
line: number;
}
declare interface PrivateIdentifier extends BaseNode {
type: AST_NODE_TYPES.PrivateIdentifier;
name: string;
}
declare interface PrivateIdentifierToken extends BaseToken {
type: AST_TOKEN_TYPES.PrivateIdentifier;
}
declare interface PrivateInExpression extends BaseNode {
type: AST_NODE_TYPES.BinaryExpression;
left: PrivateIdentifier;
operator: 'in';
right: Expression;
}
declare interface Program$1 extends NodeOrTokenData {
type: AST_NODE_TYPES.Program;
body: ProgramStatement[];
comments: Comment[] | undefined;
sourceType: 'module' | 'script';
tokens: Token[] | undefined;
}
declare type ProgramStatement = ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ImportDeclaration | Statement | TSImportEqualsDeclaration | TSNamespaceExportDeclaration;
declare type Property = PropertyComputedName | PropertyNonComputedName;
declare interface PropertyBase extends BaseNode {
type: AST_NODE_TYPES.Property;
computed: boolean;
key: PropertyName;
kind: 'get' | 'init' | 'set';
method: boolean;
optional: boolean;
shorthand: boolean;
value: AssignmentPattern | BindingName | Expression | TSEmptyBodyFunctionExpression;
}
declare interface PropertyComputedName extends PropertyBase {
computed: true;
key: PropertyNameComputed;
}
declare type PropertyDefinition = PropertyDefinitionComputedName | PropertyDefinitionNonComputedName;
declare interface PropertyDefinitionBase extends BaseNode {
accessibility: Accessibility | undefined;
computed: boolean;
declare: boolean;
decorators: Decorator[];
definite: boolean;
key: PropertyName;
optional: boolean;
override: boolean;
readonly: boolean;
static: boolean;
typeAnnotation: TSTypeAnnotation | undefined;
value: Expression | null;
}
declare interface PropertyDefinitionComputedName extends PropertyDefinitionComputedNameBase {
type: AST_NODE_TYPES.PropertyDefinition;
}
declare interface PropertyDefinitionComputedNameBase extends PropertyDefinitionBase {
computed: true;
key: PropertyNameComputed;
}
declare interface PropertyDefinitionNonComputedName extends ClassPropertyDefinitionNonComputedNameBase {
type: AST_NODE_TYPES.PropertyDefinition;
}
declare interface PropertyDefinitionNonComputedNameBase extends PropertyDefinitionBase {
computed: false;
key: PropertyNameNonComputed;
}
declare type PropertyName = ClassPropertyNameNonComputed | PropertyNameComputed | PropertyNameNonComputed;
declare type PropertyNameComputed = Expression;
declare type PropertyNameNonComputed = Identifier | NumberLiteral | StringLiteral;
declare interface PropertyNonComputedName extends PropertyBase {
computed: false;
key: PropertyNameNonComputed;
}
declare interface PunctuatorToken extends BaseToken {
type: AST_TOKEN_TYPES.Punctuator;
value: ValueOf<PunctuatorTokenToText>;
}
declare interface PunctuatorTokenToText extends AssignmentOperatorToText {
[SyntaxKind.AmpersandAmpersandToken]: '&&';
[SyntaxKind.AmpersandToken]: '&';
[SyntaxKind.AsteriskAsteriskToken]: '**';
[SyntaxKind.AsteriskToken]: '*';
[SyntaxKind.AtToken]: '@';
[SyntaxKind.BacktickToken]: '`';
[SyntaxKind.BarBarToken]: '||';
[SyntaxKind.BarToken]: '|';
[SyntaxKind.CaretToken]: '^';
[SyntaxKind.CloseBraceToken]: '}';
[SyntaxKind.CloseBracketToken]: ']';
[SyntaxKind.CloseParenToken]: ')';
[SyntaxKind.ColonToken]: ':';
[SyntaxKind.CommaToken]: ',';
[SyntaxKind.DotDotDotToken]: '...';
[SyntaxKind.DotToken]: '.';
[SyntaxKind.EqualsEqualsEqualsToken]: '===';
[SyntaxKind.EqualsEqualsToken]: '==';
[SyntaxKind.EqualsGreaterThanToken]: '=>';
[SyntaxKind.ExclamationEqualsEqualsToken]: '!==';
[SyntaxKind.ExclamationEqualsToken]: '!=';
[SyntaxKind.ExclamationToken]: '!';
[SyntaxKind.GreaterThanEqualsToken]: '>=';
[SyntaxKind.GreaterThanGreaterThanGreaterThanToken]: '>>>';
[SyntaxKind.GreaterThanGreaterThanToken]: '>>';
[SyntaxKind.GreaterThanToken]: '>';
[SyntaxKind.HashToken]: '#';
[SyntaxKind.LessThanEqualsToken]: '<=';
[SyntaxKind.LessThanLessThanToken]: '<<';
[SyntaxKind.LessThanSlashToken]: '</';
[SyntaxKind.LessThanToken]: '<';
[SyntaxKind.MinusMinusToken]: '--';
[SyntaxKind.MinusToken]: '-';
[SyntaxKind.OpenBraceToken]: '{';
[SyntaxKind.OpenBracketToken]: '[';
[SyntaxKind.OpenParenToken]: '(';
[SyntaxKind.PercentToken]: '%';
[SyntaxKind.PlusPlusToken]: '++';
[SyntaxKind.PlusToken]: '+';
[SyntaxKind.QuestionDotToken]: '?.';
[SyntaxKind.QuestionQuestionToken]: '??';
[SyntaxKind.QuestionToken]: '?';
[SyntaxKind.SemicolonToken]: ';';
[SyntaxKind.SlashTo