import type { TypeAnnotation } from './annotations.js'; import type { Argument, Expression } from './expressions.js'; import type { Name } from './name.js'; import type { FunctionDeclaration, Parameter, Script } from './script.js'; import type { Block, ElseBranch, IfBranch, Statement, SwitchCase, SwitchDefault } from './statements.js'; /** * Every node of the tree, as one discriminated union. * * A pass switches on `kind` with no default arm, and the compiler names the * kinds it has not handled. Three passes walk this tree, each of them added * months apart, and each of them will otherwise forget a case: the shape of the * union is the only thing that tells them before a user does. * * The union is `AstNode` rather than `Node` because an adapter that draws into * a page has a `Node` of its own, and a file holding both would be one import * away from a mistake that type checks. */ export type AstNode = Script | FunctionDeclaration | Parameter | Statement | Block | IfBranch | ElseBranch | SwitchCase | SwitchDefault | Expression | Argument | TypeAnnotation | Name; export type NodeKind = AstNode['kind']; /** The node type behind one kind, for a pass that indexes by kind. */ export type NodeOfKind = Extract; export declare function isExpression(node: AstNode): node is Expression; export declare function isStatement(node: AstNode): node is Statement; export declare function isTypeAnnotation(node: AstNode): node is TypeAnnotation; /** * The name a type annotation carries, for a diagnostic that has to quote it. * * OS2016 and OS2019 both put the annotation into their message, and the reader * expects to see what was written rather than the outermost word of it. */ export declare function typeAnnotationText(annotation: TypeAnnotation): string; //# sourceMappingURL=node.d.ts.map