ES5:
interface Node {
type: string;
loc: SourceLocation | null;
}
ES5:
interface SourceLocation {
source: string | null;
start: Position;
end: Position;
}
ES5:
interface Position {
line: number; // >= 1
column: number; // >= 0
}
ES5:
interface Identifier <: Expression, Pattern {
type: "Identifier";
name: string;
}
ES5:
interface Literal <: Expression {
type: "Literal";
value: string | boolean | null | number | RegExp;
}
ES2020:
extend interface Literal <: Expression {
type: "Literal";
value: string | boolean | null | number | RegExp | bigint;
}
ES5:
interface RegExpLiteral <: Literal {
regex: {
pattern: string;
flags: string;
};
}
ES5:
interface Program <: Node {
type: "Program";
body: [ Directive | Statement ];
}
ES2015:
extend interface Program {
sourceType: "script" | "module";
body: [ Statement | ModuleDeclaration ];
}
ES5:
interface Function <: Node {
id: Identifier | null;
params: [ Pattern ];
body: FunctionBody;
}
ES2015:
extend interface Function {
generator: boolean;
}
ES2017:
extend interface Function {
async: boolean;
}
ES5:
interface Statement <: Node { }
ES5:
interface ExpressionStatement <: Statement {
type: "ExpressionStatement";
expression: Expression;
}
ES5:
interface Directive <: ExpressionStatement {
expression: Literal;
directive: string;
}
ES5:
interface BlockStatement <: Statement {
type: "BlockStatement";
body: [ Statement ];
}
ES5:
interface FunctionBody <: BlockStatement {
body: [ Directive | Statement ];
}
ES5:
interface EmptyStatement <: Statement {
type: "EmptyStatement";
}
ES5:
interface DebuggerStatement <: Statement {
type: "DebuggerStatement";
}
ES5:
interface WithStatement <: Statement {
type: "WithStatement";
object: Expression;
body: Statement;
}
ES5:
interface ReturnStatement <: Statement {
type: "ReturnStatement";
argument: Expression | null;
}
ES5:
interface LabeledStatement <: Statement {
type: "LabeledStatement";
label: Identifier;
body: Statement;
}
ES5:
interface BreakStatement <: Statement {
type: "BreakStatement";
label: Identifier | null;
}
ES5:
interface ContinueStatement <: Statement {
type: "ContinueStatement";
label: Identifier | null;
}
ES5:
interface IfStatement <: Statement {
type: "IfStatement";
test: Expression;
consequent: Statement;
alternate: Statement | null;
}
ES5:
interface SwitchStatement <: Statement {
type: "SwitchStatement";
discriminant: Expression;
cases: [ SwitchCase ];
}
ES5:
interface SwitchCase <: Node {
type: "SwitchCase";
test: Expression | null;
consequent: [ Statement ];
}
ES5:
interface ThrowStatement <: Statement {
type: "ThrowStatement";
argument: Expression;
}
ES5:
interface TryStatement <: Statement {
type: "TryStatement";
block: BlockStatement;
handler: CatchClause | null;
finalizer: BlockStatement | null;
}
ES5:
interface CatchClause <: Node {
type: "CatchClause";
param: Pattern;
body: BlockStatement;
}
ES2019:
extend interface CatchClause {
param: Pattern | null;
}
ES5:
interface WhileStatement <: Statement {
type: "WhileStatement";
test: Expression;
body: Statement;
}
ES5:
interface DoWhileStatement <: Statement {
type: "DoWhileStatement";
body: Statement;
test: Expression;
}
ES5:
interface ForStatement <: Statement {
type: "ForStatement";
init: VariableDeclaration | Expression | null;
test: Expression | null;
update: Expression | null;
body: Statement;
}
ES5:
interface ForInStatement <: Statement {
type: "ForInStatement";
left: VariableDeclaration | Pattern;
right: Expression;
body: Statement;
}
ES5:
interface Declaration <: Statement { }
ES5:
interface FunctionDeclaration <: Function, Declaration {
type: "FunctionDeclaration";
id: Identifier;
}
ES5:
interface VariableDeclaration <: Declaration {
type: "VariableDeclaration";
declarations: [ VariableDeclarator ];
kind: "var";
}
ES2015:
extend interface VariableDeclaration {
kind: "var" | "let" | "const";
}
ES5:
interface VariableDeclarator <: Node {
type: "VariableDeclarator";
id: Pattern;
init: Expression | null;
}
ES5:
interface Expression <: Node { }
ES5:
interface ThisExpression <: Expression {
type: "ThisExpression";
}
ES5:
interface ArrayExpression <: Expression {
type: "ArrayExpression";
elements: [ Expression | null ];
}
ES2015:
extend interface ArrayExpression {
elements: [ Expression | SpreadElement | null ];
}
ES5:
interface ObjectExpression <: Expression {
type: "ObjectExpression";
properties: [ Property ];
}
ES2018:
extend interface ObjectExpression {
properties: [ Property | SpreadElement ];
}
ES5:
interface Property <: Node {
type: "Property";
key: Literal | Identifier;
value: Expression;
kind: "init" | "get" | "set";
}
ES2015:
extend interface Property {
key: Expression;
method: boolean;
shorthand: boolean;
computed: boolean;
}
ES5:
interface FunctionExpression <: Function, Expression {
type: "FunctionExpression";
}
ES5:
interface UnaryExpression <: Expression {
type: "UnaryExpression";
operator: UnaryOperator;
prefix: boolean;
argument: Expression;
}
ES5:
enum UnaryOperator {
"-" | "+" | "!" | "~" | "typeof" | "void" | "delete"
}
ES5:
interface UpdateExpression <: Expression {
type: "UpdateExpression";
operator: UpdateOperator;
argument: Expression;
prefix: boolean;
}
ES5:
enum UpdateOperator {
"++" | "--"
}
ES5:
interface BinaryExpression <: Expression {
type: "BinaryExpression";
operator: BinaryOperator;
left: Expression;
right: Expression;
}
ES2022:
extend interface BinaryExpression <: Expression {
left: Expression | PrivateIdentifier;
}
ES5:
enum BinaryOperator {
"==" | "!=" | "===" | "!=="
| "<" | "<=" | ">" | ">="
| "<<" | ">>" | ">>>"
| "+" | "-" | "*" | "/" | "%"
| "|" | "^" | "&" | "in"
| "instanceof"
}
ES2016:
extend enum BinaryOperator {
"**"
}
ES5:
interface AssignmentExpression <: Expression {
type: "AssignmentExpression";
operator: AssignmentOperator;
left: Pattern | Expression;
right: Expression;
}
ES2015:
extend interface AssignmentExpression {
left: Pattern;
}
ES5:
enum AssignmentOperator {
"=" | "+=" | "-=" | "*=" | "/=" | "%="
| "<<=" | ">>=" | ">>>="
| "|=" | "^=" | "&="
}
ES2016:
extend enum AssignmentOperator {
"**="
}
ES2021:
extend enum AssignmentOperator {
"||=" | "&&=" | "??="
}
ES5:
interface LogicalExpression <: Expression {
type: "LogicalExpression";
operator: LogicalOperator;
left: Expression;
right: Expression;
}
ES5:
enum LogicalOperator {
"||" | "&&"
}
ES2020:
extend enum LogicalOperator {
"||" | "&&" | "??"
}
ES5:
interface MemberExpression <: Expression, Pattern {
type: "MemberExpression";
object: Expression;
property: Expression;
computed: boolean;
}
ES2015:
extend interface MemberExpression {
object: Expression | Super;
}
ES2020:
extend interface MemberExpression <: ChainElement {}
ES2022:
extend interface MemberExpression {
property: Expression | PrivateIdentifier;
}
ES5:
interface ConditionalExpression <: Expression {
type: "ConditionalExpression";
test: Expression;
alternate: Expression;
consequent: Expression;
}
ES5:
interface CallExpression <: Expression {
type: "CallExpression";
callee: Expression;
arguments: [ Expression ];
}
ES2015:
extend interface CallExpression {
callee: Expression | Super;
arguments: [ Expression | SpreadElement ];
}
ES2020:
extend interface CallExpression <: ChainElement {}
ES5:
interface NewExpression <: Expression {
type: "NewExpression";
callee: Expression;
arguments: [ Expression ];
}
ES2015:
extend interface NewExpression {
arguments: [ Expression | SpreadElement ];
}
ES5:
interface SequenceExpression <: Expression {
type: "SequenceExpression";
expressions: [ Expression ];
}
ES5:
interface Pattern <: Node { }
ES2015:
interface ForOfStatement <: ForInStatement {
type: "ForOfStatement";
}
ES2018:
extend interface ForOfStatement {
await: boolean;
}
ES2015:
interface Super <: Node {
type: "Super";
}
ES2015:
interface SpreadElement <: Node {
type: "SpreadElement";
argument: Expression;
}
ES2015:
interface ArrowFunctionExpression <: Function, Expression {
type: "ArrowFunctionExpression";
body: FunctionBody | Expression;
expression: boolean;
generator: false;
}
ES2015:
interface YieldExpression <: Expression {
type: "YieldExpression";
argument: Expression | null;
delegate: boolean;
}
ES2015:
interface TemplateLiteral <: Expression {
type: "TemplateLiteral";
quasis: [ TemplateElement ];
expressions: [ Expression ];
}
ES2015:
interface TaggedTemplateExpression <: Expression {
type: "TaggedTemplateExpression";
tag: Expression;
quasi: TemplateLiteral;
}
ES2015:
interface TemplateElement <: Node {
type: "TemplateElement";
tail: boolean;
value: {
cooked: string;
raw: string;
};
}
ES2018:
extend interface TemplateElement {
value: {
cooked: string | null;
raw: string;
};
}
ES2015:
interface AssignmentProperty <: Property {
type: "Property"; // inherited
value: Pattern;
kind: "init";
method: false;
}
ES2015:
interface ObjectPattern <: Pattern {
type: "ObjectPattern";
properties: [ AssignmentProperty ];
}
ES2018:
extend interface ObjectPattern {
properties: [ AssignmentProperty | RestElement ];
}
ES2015:
interface ArrayPattern <: Pattern {
type: "ArrayPattern";
elements: [ Pattern | null ];
}
ES2015:
interface RestElement <: Pattern {
type: "RestElement";
argument: Pattern;
}
ES2015:
interface AssignmentPattern <: Pattern {
type: "AssignmentPattern";
left: Pattern;
right: Expression;
}
ES2015:
interface Class <: Node {
id: Identifier | null;
superClass: Expression | null;
body: ClassBody;
}
ES2015:
interface ClassBody <: Node {
type: "ClassBody";
body: [ MethodDefinition ];
}
ES2022:
extend interface ClassBody {
body: [ MethodDefinition | PropertyDefinition | StaticBlock ];
}
ES2015:
interface MethodDefinition <: Node {
type: "MethodDefinition";
key: Expression;
value: FunctionExpression;
kind: "constructor" | "method" | "get" | "set";
computed: boolean;
static: boolean;
}
ES2022:
extend interface MethodDefinition {
key: Expression | PrivateIdentifier;
}
ES2015:
interface ClassDeclaration <: Class, Declaration {
type: "ClassDeclaration";
id: Identifier;
}
ES2015:
interface ClassExpression <: Class, Expression {
type: "ClassExpression";
}
ES2015:
interface MetaProperty <: Expression {
type: "MetaProperty";
meta: Identifier;
property: Identifier;
}
ES2015:
interface ModuleDeclaration <: Node { }
ES2015:
interface ModuleSpecifier <: Node {
local: Identifier;
}
ES2015:
interface ImportDeclaration <: ModuleDeclaration {
type: "ImportDeclaration";
specifiers: [ ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier ];
source: Literal;
}
ES2015:
interface ImportSpecifier <: ModuleSpecifier {
type: "ImportSpecifier";
imported: Identifier;
}
ES2022:
extend interface ImportSpecifier <: ModuleSpecifier {
imported: Identifier | Literal;
}
ES2015:
interface ImportDefaultSpecifier <: ModuleSpecifier {
type: "ImportDefaultSpecifier";
}
ES2015:
interface ImportNamespaceSpecifier <: ModuleSpecifier {
type: "ImportNamespaceSpecifier";
}
ES2015:
interface ExportNamedDeclaration <: ModuleDeclaration {
type: "ExportNamedDeclaration";
declaration: Declaration | null;
specifiers: [ ExportSpecifier ];
source: Literal | null;
}
ES2015:
interface ExportSpecifier <: ModuleSpecifier {
type: "ExportSpecifier";
exported: Identifier;
}
ES2022:
extend interface ExportSpecifier <: ModuleSpecifier {
local: Identifier | Literal;
exported: Identifier | Literal;
}
ES2015:
interface AnonymousDefaultExportedFunctionDeclaration <: Function {
type: "FunctionDeclaration";
id: null;
}
ES2015:
interface AnonymousDefaultExportedClassDeclaration <: Class {
type: "ClassDeclaration";
id: null;
}
ES2015:
interface ExportDefaultDeclaration <: ModuleDeclaration {
type: "ExportDefaultDeclaration";
declaration: AnonymousDefaultExportedFunctionDeclaration | FunctionDeclaration | AnonymousDefaultExportedClassDeclaration | ClassDeclaration | Expression;
}
ES2015:
interface ExportAllDeclaration <: ModuleDeclaration {
type: "ExportAllDeclaration";
source: Literal;
}
ES2020:
extend interface ExportAllDeclaration {
exported: Identifier | null;
}
ES2022:
extend interface ExportAllDeclaration {
exported: Identifier | Literal | null;
}
ES2017:
interface AwaitExpression <: Expression {
type: "AwaitExpression";
argument: Expression;
}
ES2020:
interface BigIntLiteral <: Literal {
bigint: string;
}
ES2020:
interface ChainExpression <: Expression {
type: "ChainExpression";
expression: ChainElement;
}
ES2020:
interface ChainElement <: Node {
optional: boolean;
}
ES2020:
interface ImportExpression <: Expression {
type: "ImportExpression";
source: Expression;
}
ES2022:
interface PropertyDefinition <: Node {
type: "PropertyDefinition";
key: Expression | PrivateIdentifier;
value: Expression | null;
computed: boolean;
static: boolean;
}
ES2022:
interface PrivateIdentifier <: Node {
type: "PrivateIdentifier";
name: string;
}
ES2022:
interface StaticBlock <: BlockStatement {
type: "StaticBlock";
}