Programs
es2015
extend interface Program { sourceType: "script" | "module"; body: [ Statement | ModuleDeclaration ]; }
Parsers must specify
sourceType
as"module"
if the source has been parsed as an ES6 module. Otherwise,sourceType
must be"script"
.es5
interface Program <: Node { type: "Program"; body: [ Directive | Statement ]; }
A complete program source tree.
Functions
es2015
extend interface Function { generator: boolean; }
es5
interface Function <: Node { id: Identifier | null; params: [ Pattern ]; body: FunctionBody; }
A function declaration or expression.
extensions/type-annotations
extend interface Function { returnType: TypeAnnotation | null; }
The
returnType
property is used to specify the type annotation for the return value of the function.Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions(Relation score: 64.6)Statements /ForOfStatement
(Relation score: 73.1)es2015
interface ForOfStatement <: ForInStatement { type: "ForOfStatement"; }
Declarations /VariableDeclaration
es2015
extend interface VariableDeclaration { kind: "var" | "let" | "const"; }
es5
interface VariableDeclaration <: Declaration { type: "VariableDeclaration"; declarations: [ VariableDeclarator ]; kind: "var"; }
A variable declaration.
Related MDN article: https://developer.mozilla.org/en-US/docs/Glossary/Variable(Relation score: 56.8)Expressions
es2015
interface Super <: Node { type: "Super"; } extend interface CallExpression { callee: Expression | Super; arguments: [ Expression | SpreadElement ]; } extend interface MemberExpression { object: Expression | Super; }
A
super
pseudo-expression.interface SpreadElement <: Node { type: "SpreadElement"; argument: Expression; } extend interface ArrayExpression { elements: [ Expression | SpreadElement | null ]; } extend interface NewExpression { arguments: [ Expression | SpreadElement ]; }
Spread expression, e.g.,
FIXME: This describes the Esprima and Acorn behaviors, which is not currently aligned with the SpiderMonkey behavior.[head, ...iter, tail]
,f(head, ...iter, ...tail)
.extend interface AssignmentExpression { left: Pattern; }
Note that pre-ES6 code was allowed to pass references around and so
left
was much more liberal; an implementation might choose to continue using old definition if it needs to support such legacy code.extend interface Property { key: Expression; method: boolean; shorthand: boolean; computed: boolean; }
es2018
extend interface ObjectExpression { properties: [ Property | SpreadElement ]; }
Spread properties, e.g.,
{a: 1, ...obj, b: 2}
.es5
interface Expression <: Node { }
Any expression node. Since the left-hand side of an assignment may be any expression in general, an expression can also be a pattern.
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions(Relation score: 64)Expressions /ArrowFunctionExpression
(Relation score: 107.6)es2015
interface ArrowFunctionExpression <: Function, Expression { type: "ArrowFunctionExpression"; body: FunctionBody | Expression; expression: boolean; generator: false; }
A fat arrow function expression, e.g.,
let foo = (bar) => { /* body */ }
.Expressions /YieldExpression
es2015
interface YieldExpression <: Expression { type: "YieldExpression"; argument: Expression | null; delegate: boolean; }
A
yield
expression.Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/yield(Relation score: 79.8)Template Literals /TemplateLiteral
es2015
interface TemplateLiteral <: Expression { type: "TemplateLiteral"; quasis: [ TemplateElement ]; expressions: [ Expression ]; }
Related MDN article: https://developer.mozilla.org/en-US/docs/Glossary/Literal(Relation score: 65.7)Template Literals /TaggedTemplateExpression
es2015
interface TaggedTemplateExpression <: Expression { type: "TaggedTemplateExpression"; tag: Expression; quasi: TemplateLiteral; }
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals(Relation score: 78)Template Literals /TemplateElement
es2015
interface TemplateElement <: Node { type: "TemplateElement"; tail: boolean; value: { cooked: string; raw: string; }; }
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template(Relation score: 68.9)Patterns /ObjectPattern
es2015
interface AssignmentProperty <: Property { type: "Property"; // inherited value: Pattern; kind: "init"; method: false; } interface ObjectPattern <: Pattern { type: "ObjectPattern"; properties: [ AssignmentProperty ]; }
extensions/type-annotations
extend interface ObjectPattern { typeAnnotation: TypeAnnotation | null; }
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/pattern(Relation score: 63.5)Patterns /ArrayPattern
es2015
interface ArrayPattern <: Pattern { type: "ArrayPattern"; elements: [ Pattern | null ]; }
extensions/type-annotations
extend interface ArrayPattern { typeAnnotation: TypeAnnotation | null; }
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/pattern(Relation score: 60.4)Patterns /RestElement
es2015
interface RestElement <: Pattern { type: "RestElement"; argument: Pattern; }
extensions/type-annotations
extend interface RestElement { typeAnnotation: TypeAnnotation | null; }
Related MDN article: https://developer.mozilla.org/en-US/docs/Glossary/REST(Relation score: 67.7)Patterns /AssignmentPattern
es2015
interface AssignmentPattern <: Pattern { type: "AssignmentPattern"; left: Pattern; right: Expression; }
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/pattern(Relation score: 61.3)Classes
es2015
interface Class <: Node { id: Identifier | null; superClass: Expression | null; body: ClassBody; }
es2022
These language extensions cover following class features proposals:
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes(Relation score: 66.3)Classes /ClassBody
es2015
interface ClassBody <: Node { type: "ClassBody"; body: [ MethodDefinition ]; }
es2022
extend interface ClassBody { body: [ MethodDefinition | PropertyDefinition | StaticBlock ]; }
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/class(Relation score: 53.8)Classes /MethodDefinition
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; }
When
key
is aPrivateIdentifier
,computed
must befalse
andkind
can not be"constructor"
.
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dfn(Relation score: 58.3)Classes /ClassDeclaration
es2015
interface ClassDeclaration <: Class, Declaration { type: "ClassDeclaration"; id: Identifier; }
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/class(Relation score: 57)Classes /ClassExpression
es2015
interface ClassExpression <: Class, Expression { type: "ClassExpression"; }
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/class(Relation score: 94.7)Classes /MetaProperty
(Relation score: 56.6)es2015
interface MetaProperty <: Expression { type: "MetaProperty"; meta: Identifier; property: Identifier; }
MetaProperty
node representsnew.target
meta property in ES2015. In the future, it will represent other meta properties as well.
Modules /ModuleDeclaration
es2015
interface ModuleDeclaration <: Node { }
A module
import
orexport
declaration.Related MDN article: https://developer.mozilla.org/en-US/docs/Web/API/GPUShaderModule(Relation score: 51.3)Modules /ModuleSpecifier
es2015
interface ModuleSpecifier <: Node { local: Identifier; }
A specifier in an import or export declaration.
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/API/GPUShaderModule(Relation score: 51.3)Modules/Imports /ImportDeclaration
es2015
interface ImportDeclaration <: ModuleDeclaration { type: "ImportDeclaration"; specifiers: [ ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier ]; source: Literal; }
An import declaration, e.g.,
import foo from "mod";
.Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import(Relation score: 65.3)Modules/Imports /ImportSpecifier
es2015
interface ImportSpecifier <: ModuleSpecifier { type: "ImportSpecifier"; imported: Identifier; }
An imported variable binding, e.g.,
{foo}
inimport {foo} from "mod"
or{foo as bar}
inimport {foo as bar} from "mod"
. Theimported
field refers to the name of the export imported from the module. Thelocal
field refers to the binding imported into the local module scope. If it is a basic named import, such as inimport {foo} from "mod"
, bothimported
andlocal
are equivalentIdentifier
nodes; in this case anIdentifier
node representingfoo
. If it is an aliased import, such as inimport {foo as bar} from "mod"
, theimported
field is anIdentifier
node representingfoo
, and thelocal
field is anIdentifier
node representingbar
.es2022
extend interface ImportSpecifier <: ModuleSpecifier { imported: Identifier | Literal; }
If
imported
is aLiteral
,imported.value
must be a string without lone surrogate.Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import(Relation score: 66.8)Modules/Imports /ImportDefaultSpecifier
es2015
interface ImportDefaultSpecifier <: ModuleSpecifier { type: "ImportDefaultSpecifier"; }
A default import specifier, e.g.,
foo
inimport foo from "mod.js"
.Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import(Relation score: 71.3)Modules/Imports /ImportNamespaceSpecifier
es2015
interface ImportNamespaceSpecifier <: ModuleSpecifier { type: "ImportNamespaceSpecifier"; }
A namespace import specifier, e.g.,
* as foo
inimport * as foo from "mod.js"
.Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import(Relation score: 76.1)Modules/Exports /ExportNamedDeclaration
es2015
interface ExportNamedDeclaration <: ModuleDeclaration { type: "ExportNamedDeclaration"; declaration: Declaration | null; specifiers: [ ExportSpecifier ]; source: Literal | null; }
An export named declaration, e.g.,
Note: Havingexport {foo, bar};
,export {foo} from "mod";
orexport var foo = 1;
.declaration
populated with non-emptyspecifiers
or non-nullsource
results in an invalid state.Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export(Relation score: 86.6)Modules/Exports /ExportSpecifier
es2015
interface ExportSpecifier <: ModuleSpecifier { type: "ExportSpecifier"; exported: Identifier; }
An exported variable binding, e.g.,
{foo}
inexport {foo}
or{bar as foo}
inexport {bar as foo}
. Theexported
field refers to the name exported in the module. Thelocal
field refers to the binding into the local module scope. If it is a basic named export, such as inexport {foo}
, bothexported
andlocal
are equivalentIdentifier
nodes; in this case anIdentifier
node representingfoo
. If it is an aliased export, such as inexport {bar as foo}
, theexported
field is anIdentifier
node representingfoo
, and thelocal
field is anIdentifier
node representingbar
.es2022
extend interface ExportSpecifier <: ModuleSpecifier { local: Identifier | Literal; exported: Identifier | Literal; }
local
can beLiteral
only if thesource
of theExportNamedDeclaration
of the parent of this node is notnull
. e.g.export { "foo" as "foo" } from "mod"
is valid,export { "foo" as "foo" }
is invalid.If
exported
/local
isLiteral
,exported.value
/local.value
must be a string without lone surrogate.Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export(Relation score: 69.9)Modules/Exports /ExportDefaultDeclaration
es2015
interface AnonymousDefaultExportedFunctionDeclaration <: Function { type: "FunctionDeclaration"; id: null; } interface AnonymousDefaultExportedClassDeclaration <: Class { type: "ClassDeclaration"; id: null; } interface ExportDefaultDeclaration <: ModuleDeclaration { type: "ExportDefaultDeclaration"; declaration: AnonymousDefaultExportedFunctionDeclaration | FunctionDeclaration | AnonymousDefaultExportedClassDeclaration | ClassDeclaration | Expression; }
An export default declaration, e.g.,
export default function () {};
orexport default 1;
.Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export(Relation score: 82.9)Modules/Exports /ExportAllDeclaration
es2015
interface ExportAllDeclaration <: ModuleDeclaration { type: "ExportAllDeclaration"; source: Literal; }
An export batch declaration, e.g.,
export * from "mod";
.es2022
extend interface ExportAllDeclaration { exported: Identifier | Literal | null; }
If
exported
isLiteral
,exported.value
must be a string without lone surrogate.Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export(Relation score: 81.2)BinaryOperator
(Relation score: 64.1)es2016
extend enum BinaryOperator { "**" }
AssignmentOperator
es2016
extend enum AssignmentOperator { "**=" }
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/operator(Relation score: 60.9)Function
(Relation score: 41.1)es2017
extend interface Function { async: boolean; }
AwaitExpression
es2017
interface AwaitExpression <: Expression { type: "AwaitExpression"; argument: Expression; }
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await(Relation score: 72.2)Statements
es2018
extend interface ForOfStatement { await: boolean; }
for-await-of
statements, e.g.,for await (const x of xs) {
es5
interface Statement <: Node { }
Any statement.
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements(Relation score: 75.1)Template Literals
es2018
extend interface TemplateElement { value: { cooked: string | null; raw: string; }; }
If the template literal is tagged and the text has an invalid escape,
cooked
will benull
, e.g.,tag`\unicode and \u{55}`
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals(Relation score: 298.8)Patterns
es2018
extend interface ObjectPattern { properties: [ AssignmentProperty | RestElement ]; }
Rest properties, e.g.,
{a, ...rest} = obj
.es5
Destructuring binding and assignment are not part of ES5, but all binding positions accept
Pattern
to allow for destructuring in ES6. Nevertheless, for ES5, the onlyPattern
subtype isIdentifier
.interface Pattern <: Node { }
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Patterns(Relation score: 75.2)Statements /CatchClause
(Relation score: 71.8)es2019
extend interface CatchClause { param: Pattern | null; }
The
param
isnull
if thecatch
binding is omitted. E.g.,try { foo() } catch { bar() }
Literal
es2020
extend interface Literal <: Expression { type: "Literal"; value: string | boolean | null | number | RegExp | bigint; }
value
property can be aBigInt
value to representBigInt
literals
such as100n
.
es5
interface Literal <: Expression { type: "Literal"; value: string | boolean | null | number | RegExp; }
A literal token. Note that a literal can be an expression.
Related MDN article: https://developer.mozilla.org/en-US/docs/Glossary/Literal(Relation score: 65.7)Literal /BigIntLiteral
(Relation score: 104.8)es2020
interface BigIntLiteral <: Literal { bigint: string; }
bigint
property is the string representation of theBigInt
value.
It doesn't include the suffixn
.In environments that don't support
BigInt
values,value
property will benull
as theBigInt
value can't be represented natively.
Expressions /ChainExpression
(Relation score: 71.9)es2020
interface ChainExpression <: Expression { type: "ChainExpression"; expression: ChainElement; } interface ChainElement <: Node { optional: boolean; } extend interface CallExpression <: ChainElement {} extend interface MemberExpression <: ChainElement {}
The
ChainExpression
node is the root of optional chaining.The
ChainExpression
node contains one or moreChainElement
nodes that areoptional:true
. On the other hand,ChainElement
nodes that areoptional:true
belong to aChainExpression
node.For backward compatibility, if all
ChainElement
nodes of a chain areoptional:false
, theChainExpression
node isn't inserted as the root of the chain.Evaluation:
The
ChainExpression
node is evaluated to the result of theexpression
property's node.If the
callee|object
property is evaluated to nullish and theoptional
property istrue
, then the node and ancestor nodes are skipped until the closestChainExpression
node, and the result of theChainExpression
node becomesundefined
.
For Examples:
// obj.aaa.bbb { "type": "MemberExpression", "optional": false, "object": { "type": "MemberExpression", "optional": false, "object": { "type": "Identifier", "name": "obj" }, "property": { "type": "Identifier", "name": "aaa" } }, "property": { "type": "Identifier", "name": "bbb" } }
// obj.aaa?.bbb { "type": "ChainExpression", "expression": { "type": "MemberExpression", "optional": true, "object": { "type": "MemberExpression", "optional": false, "object": { "type": "Identifier", "name": "obj" }, "property": { "type": "Identifier", "name": "aaa" } }, "property": { "type": "Identifier", "name": "bbb" } } }
// obj?.aaa.bbb { "type": "ChainExpression", "expression": { "type": "MemberExpression", "optional": false, "object": { "type": "MemberExpression", "optional": true, "object": { "type": "Identifier", "name": "obj" }, "property": { "type": "Identifier", "name": "aaa" } }, "property": { "type": "Identifier", "name": "bbb" } } }
// obj?.aaa?.bbb { "type": "ChainExpression", "expression": { "type": "MemberExpression", "optional": true, "object": { "type": "MemberExpression", "optional": true, "object": { "type": "Identifier", "name": "obj" }, "property": { "type": "Identifier", "name": "aaa" } }, "property": { "type": "Identifier", "name": "bbb" } } }
// (obj.aaa).bbb { "type": "MemberExpression", "optional": false, "object": { "type": "MemberExpression", "optional": false, "object": { "type": "Identifier", "name": "obj" }, "property": { "type": "Identifier", "name": "aaa" } }, "property": { "type": "Identifier", "name": "bbb" } }
// (obj.aaa)?.bbb { "type": "ChainExpression", "expression": { "type": "MemberExpression", "optional": true, "object": { "type": "MemberExpression", "optional": false, "object": { "type": "Identifier", "name": "obj" }, "property": { "type": "Identifier", "name": "aaa" } }, "property": { "type": "Identifier", "name": "bbb" } } }
// (obj?.aaa).bbb { "type": "MemberExpression", "optional": false, "object": { "type": "ChainExpression", "expression": { "type": "MemberExpression", "optional": true, "object": { "type": "Identifier", "name": "obj" }, "property": { "type": "Identifier", "name": "aaa" } } }, "property": { "type": "Identifier", "name": "bbb" } }
// (obj?.aaa)?.bbb { "type": "ChainExpression", "expression": { "type": "MemberExpression", "optional": true, "object": { "type": "ChainExpression", "expression": { "type": "MemberExpression", "optional": true, "object": { "type": "Identifier", "name": "obj" }, "property": { "type": "Identifier", "name": "aaa" } } }, "property": { "type": "Identifier", "name": "bbb" } } }
Expressions /ImportExpression
es2020
interface ImportExpression <: Expression { type: "ImportExpression"; source: Expression; }
ImportExpression
node represents Dynamic Imports such asimport(source)
.
Thesource
property is the importing source as similar to ImportDeclaration
node, but it can be an arbitrary expression node.
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import(Relation score: 62.8)Expressions /LogicalExpression
(Relation score: 71.4)es2020
extend enum LogicalOperator { "??" }
The
operator
property of theLogicalExpression
node can be"??"
to represent Nullish Coalescing syntax.
Expressions /MetaProperty
(Relation score: 56.6)es2020
Existing MetaProperty node represents
import.meta
meta property as well.Modules /ExportAllDeclaration
es2020
extend interface ExportAllDeclaration { exported: Identifier | null; }
The
exported
property contains anIdentifier
when a different exported name is specified usingas
, e.g.,export * as foo from "mod";
.Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export(Relation score: 81.2)Expressions /AssignmentOperator
es2021
extend enum AssignmentOperator { "||=" | "&&=" | "??=" }
- AssignmentExpression node has short-circuiting behavior if the
operator
property is any of"||="
,"&&="
, and"??="
. See Logical Assignment Operators for details.
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/operator(Relation score: 60.9)- AssignmentExpression node has short-circuiting behavior if the
Classes /PropertyDefinition
es2022
interface PropertyDefinition <: Node { type: "PropertyDefinition"; key: Expression | PrivateIdentifier; value: Expression | null; computed: boolean; static: boolean; }
When
key
is aPrivateIdentifier
,computed
must befalse
.
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/CSS/Value_definition_syntax(Relation score: 61.7)Classes/MethodDefinition /PrivateIdentifier
(Relation score: 68.5)es2022
interface PrivateIdentifier <: Node { type: "PrivateIdentifier"; name: string; }
A private identifier refers to private class elements. For a private name
#a
, itsname
isa
.extend interface MemberExpression { property: Expression | PrivateIdentifier; }
When
property
is aPrivateIdentifier
,computed
must befalse
.When
object
is aSuper
,property
can not be aPrivateIdentifier
.
Classes /StaticBlock
es2022
interface StaticBlock <: BlockStatement { type: "StaticBlock"; }
A static block
static { }
is a block statement serving as an additional static initializer.Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/static(Relation score: 57.6)Classes/Expressions /BinaryExpression
es2022
extend interface BinaryExpression <: Expression { left: Expression | PrivateIdentifier; }
left
can be a private identifier (e.g.#foo
) whenoperator
is"in"
.See Ergonomic brand checks for Private Fields for details.
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/function(Relation score: 51.8)Modules
es2022
See Arbitrary module namespace identifier names for more details.
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules(Relation score: 62)Node objects
(Relation score: 58.5)es5
ESTree AST nodes are represented as
Node
objects, which may have any prototype inheritance but which implement the following interface:interface Node { type: string; loc: SourceLocation | null; }
The
type
field is a string representing the AST variant type. Each subtype ofNode
is documented below with the specific string of itstype
field. You can use this field to determine which interface a node implements.The
loc
field represents the source location information of the node. If the node contains no information about the source location, the field isnull
; otherwise it is an object consisting of a start position (the position of the first character of the parsed source region) and an end position (the position of the first character after the parsed source region):interface SourceLocation { source: string | null; start: Position; end: Position; }
Each
Position
object consists of aline
number (1-indexed) and acolumn
number (0-indexed):interface Position { line: number; // >= 1 column: number; // >= 0 }
Identifier
es5
interface Identifier <: Expression, Pattern { type: "Identifier"; name: string; }
An identifier. Note that an identifier may be an expression or a destructuring pattern.
extensions/type-annotations
extend interface Identifier { typeAnnotation: TypeAnnotation | null; }
The
typeAnnotation
property is used only in the case of variable declarations with type annotations or function arguments with type annotations.Related MDN article: https://developer.mozilla.org/en-US/docs/Glossary/Identifier(Relation score: 61.4)Literal /RegExpLiteral
(Relation score: 98.7)es5
interface RegExpLiteral <: Literal { regex: { pattern: string; flags: string; }; }
The
regex
property allows regexes to be represented in environments that don’t
support certain flags such asy
oru
. In environments that don't support
these flagsvalue
will benull
as the regex can't be represented natively.Statements /ExpressionStatement
(Relation score: 106.5)es5
interface ExpressionStatement <: Statement { type: "ExpressionStatement"; expression: Expression; }
An expression statement, i.e., a statement consisting of a single expression.
Statements /Directive
es5
interface Directive <: ExpressionStatement { expression: Literal; directive: string; }
A directive from the directive prologue of a script or function.
Thedirective
property is the raw string source of the directive without quotes.Related MDN article: https://developer.mozilla.org/en-US/docs/Glossary/Fetch_directive(Relation score: 56.2)Statements /BlockStatement
es5
interface BlockStatement <: Statement { type: "BlockStatement"; body: [ Statement ]; }
A block statement, i.e., a sequence of statements surrounded by braces.
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/block(Relation score: 94.2)Statements /FunctionBody
(Relation score: 55.8)es5
interface FunctionBody <: BlockStatement { body: [ Directive | Statement ]; }
The body of a function, which is a block statement that may begin with directives.
Statements /EmptyStatement
es5
interface EmptyStatement <: Statement { type: "EmptyStatement"; }
An empty statement, i.e., a solitary semicolon.
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/Empty(Relation score: 107.8)Statements /DebuggerStatement
(Relation score: 81.3)es5
interface DebuggerStatement <: Statement { type: "DebuggerStatement"; }
A
debugger
statement.Statements /WithStatement
es5
interface WithStatement <: Statement { type: "WithStatement"; object: Expression; body: Statement; }
A
with
statement.Related MDN article: https://developer.mozilla.org/en-US/docs/Glossary/Statement(Relation score: 60.4)Statements/Control flow /ReturnStatement
(Relation score: 72.6)es5
interface ReturnStatement <: Statement { type: "ReturnStatement"; argument: Expression | null; }
A
return
statement.Statements/Control flow /LabeledStatement
es5
interface LabeledStatement <: Statement { type: "LabeledStatement"; label: Identifier; body: Statement; }
A labeled statement, i.e., a statement prefixed by a
break
/continue
label.Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label(Relation score: 132.9)Statements/Control flow /BreakStatement
es5
interface BreakStatement <: Statement { type: "BreakStatement"; label: Identifier | null; }
A
break
statement.Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/break(Relation score: 66)Statements/Control flow /ContinueStatement
(Relation score: 72)es5
interface ContinueStatement <: Statement { type: "ContinueStatement"; label: Identifier | null; }
A
continue
statement.Statements/Choice /IfStatement
es5
interface IfStatement <: Statement { type: "IfStatement"; test: Expression; consequent: Statement; alternate: Statement | null; }
An
if
statement.Related MDN article: https://developer.mozilla.org/en-US/docs/Glossary/Statement(Relation score: 60.4)Statements/Choice /SwitchStatement
es5
interface SwitchStatement <: Statement { type: "SwitchStatement"; discriminant: Expression; cases: [ SwitchCase ]; }
A
switch
statement.Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch(Relation score: 77.1)Statements/Choice/SwitchStatement /SwitchCase
es5
interface SwitchCase <: Node { type: "SwitchCase"; test: Expression | null; consequent: [ Statement ]; }
A
case
(iftest
is anExpression
) ordefault
(iftest === null
) clause in the body of aswitch
statement.Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch(Relation score: 73.5)Statements/Exceptions /ThrowStatement
es5
interface ThrowStatement <: Statement { type: "ThrowStatement"; argument: Expression; }
A
throw
statement.Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/throw(Relation score: 72.4)Statements/Exceptions /TryStatement
(Relation score: 72)es5
interface TryStatement <: Statement { type: "TryStatement"; block: BlockStatement; handler: CatchClause | null; finalizer: BlockStatement | null; }
A
try
statement. Ifhandler
isnull
thenfinalizer
must be aBlockStatement
.Statements/Exceptions/TryStatement /CatchClause
(Relation score: 71.8)es5
interface CatchClause <: Node { type: "CatchClause"; param: Pattern; body: BlockStatement; }
A
catch
clause following atry
block.Statements/Loops /WhileStatement
es5
interface WhileStatement <: Statement { type: "WhileStatement"; test: Expression; body: Statement; }
A
while
statement.Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/while(Relation score: 70.8)Statements/Loops /DoWhileStatement
(Relation score: 108.7)es5
interface DoWhileStatement <: Statement { type: "DoWhileStatement"; body: Statement; test: Expression; }
A
do
/while
statement.Statements/Loops /ForStatement
es5
interface ForStatement <: Statement { type: "ForStatement"; init: VariableDeclaration | Expression | null; test: Expression | null; update: Expression | null; body: Statement; }
A
for
statement.Related MDN article: https://developer.mozilla.org/en-US/docs/Glossary/Statement(Relation score: 60.4)Statements/Loops /ForInStatement
(Relation score: 75.4)es5
interface ForInStatement <: Statement { type: "ForInStatement"; left: VariableDeclaration | Pattern; right: Expression; body: Statement; }
A
for
/in
statement.Declarations
es5
interface Declaration <: Statement { }
Any declaration node. Note that declarations are considered statements; this is because declarations can appear in any statement context.
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements(Relation score: 64.2)Declarations /FunctionDeclaration
es5
interface FunctionDeclaration <: Function, Declaration { type: "FunctionDeclaration"; id: Identifier; }
A function declaration. Note that unlike in the parent interface
Function
, theid
cannot benull
.Related MDN article: https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleDeclaration(Relation score: 50.1)Declarations/VariableDeclaration /VariableDeclarator
es5
interface VariableDeclarator <: Node { type: "VariableDeclarator"; id: Pattern; init: Expression | null; }
A variable declarator.
Related MDN article: https://developer.mozilla.org/en-US/docs/Glossary/Variable(Relation score: 56.8)Expressions /ThisExpression
es5
interface ThisExpression <: Expression { type: "ThisExpression"; }
A
this
expression.Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this(Relation score: 66.6)Expressions /ArrayExpression
(Relation score: 56.1)es5
interface ArrayExpression <: Expression { type: "ArrayExpression"; elements: [ Expression | null ]; }
An array expression. An element might be
null
if it represents a hole in a sparse array. E.g.[1,,2]
.Expressions /ObjectExpression
(Relation score: 54.6)es5
interface ObjectExpression <: Expression { type: "ObjectExpression"; properties: [ Property ]; }
An object expression.
Expressions/ObjectExpression /Property
es5
interface Property <: Node { type: "Property"; key: Literal | Identifier; value: Expression; kind: "init" | "get" | "set"; }
A literal property in an object expression can have either a string or number as its
value
. Ordinary property initializers have akind
value"init"
; getters and setters have the kind values"get"
and"set"
, respectively.Expressions /FunctionExpression
es5
interface FunctionExpression <: Function, Expression { type: "FunctionExpression"; }
A
function
expression.Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/function(Relation score: 87.5)Expressions/Unary operations /UnaryExpression
(Relation score: 71.8)es5
interface UnaryExpression <: Expression { type: "UnaryExpression"; operator: UnaryOperator; prefix: boolean; argument: Expression; }
A unary operator expression.
Expressions/Unary operations/UnaryExpression /UnaryOperator
(Relation score: 80.5)es5
enum UnaryOperator { "-" | "+" | "!" | "~" | "typeof" | "void" | "delete" }
A unary operator token.
Expressions/Unary operations /UpdateExpression
es5
interface UpdateExpression <: Expression { type: "UpdateExpression"; operator: UpdateOperator; argument: Expression; prefix: boolean; }
An update (increment or decrement) operator expression.
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/update(Relation score: 51.9)Expressions/Unary operations/UpdateExpression /UpdateOperator
es5
enum UpdateOperator { "++" | "--" }
An update (increment or decrement) operator token.
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/operator(Relation score: 60)Expressions/Binary operations /BinaryExpression
es5
interface BinaryExpression <: Expression { type: "BinaryExpression"; operator: BinaryOperator; left: Expression; right: Expression; }
A binary operator expression.
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/function(Relation score: 51.8)Expressions/Binary operations/BinaryExpression /BinaryOperator
(Relation score: 64.1)es5
enum BinaryOperator { "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "|" | "^" | "&" | "in" | "instanceof" }
A binary operator token.
Expressions/Binary operations /AssignmentExpression
es5
interface AssignmentExpression <: Expression { type: "AssignmentExpression"; operator: AssignmentOperator; left: Pattern | Expression; right: Expression; }
An assignment operator expression.
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/function(Relation score: 52.7)Expressions/Binary operations/AssignmentExpression /AssignmentOperator
es5
enum AssignmentOperator { "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" }
An assignment operator token.
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/operator(Relation score: 60.9)Expressions/Binary operations /LogicalExpression
(Relation score: 71.4)es5
interface LogicalExpression <: Expression { type: "LogicalExpression"; operator: LogicalOperator; left: Expression; right: Expression; }
A logical operator expression.
Expressions/Binary operations/LogicalExpression /LogicalOperator
(Relation score: 73.4)es5
enum LogicalOperator { "||" | "&&" }
A logical operator token.
Expressions/Binary operations /MemberExpression
es5
interface MemberExpression <: Expression, Pattern { type: "MemberExpression"; object: Expression; property: Expression; computed: boolean; }
A member expression. If
computed
istrue
, the node corresponds to a computed (a[b]
) member expression andproperty
is anExpression
. Ifcomputed
isfalse
, the node corresponds to a static (a.b
) member expression andproperty
is anIdentifier
.Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/function(Relation score: 51.8)Expressions /ConditionalExpression
(Relation score: 64.7)es5
interface ConditionalExpression <: Expression { type: "ConditionalExpression"; test: Expression; alternate: Expression; consequent: Expression; }
A conditional expression, i.e., a ternary
?
/:
expression.Expressions /CallExpression
es5
interface CallExpression <: Expression { type: "CallExpression"; callee: Expression; arguments: [ Expression ]; }
A function or method call expression.
Related MDN article: https://developer.mozilla.org/en-US/docs/WebAssembly/Reference/Control_flow/call(Relation score: 59.7)Expressions /NewExpression
es5
interface NewExpression <: Expression { type: "NewExpression"; callee: Expression; arguments: [ Expression ]; }
A
new
expression.Related MDN article: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new(Relation score: 58.4)Expressions /SequenceExpression
es5
interface SequenceExpression <: Expression { type: "SequenceExpression"; expressions: [ Expression ]; }
A sequence expression, i.e., a comma-separated sequence of expressions.
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/CSS/::-moz-page-sequence(Relation score: 54.3)Type Annotations
extensions/type-annotations
interface TypeAnnotation <: Node { }
Any type annotation.
Related MDN article: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Annotations(Relation score: 78.1)