ts-simple-ast
Version:
TypeScript compiler wrapper for AST navigation and code generation.
30 lines (29 loc) • 1.05 kB
TypeScript
import * as ts from "typescript";
import { Constructor } from "./../../../Constructor";
import { Node, Expression } from "./../../common";
export declare type InitializerGetExpressionableExtensionType = Node<ts.Node & {
initializer?: ts.Expression;
}>;
export interface InitializerGetExpressionableNode {
/**
* Gets if node has an initializer.
*/
hasInitializer(): boolean;
/**
* Gets the initializer.
*/
getInitializer(): Expression | undefined;
/**
* Gets the initializer if it's a certain kind or throws.
*/
getInitializerIfKindOrThrow(kind: ts.SyntaxKind): Expression;
/**
* Gets the initializer if it's a certain kind.
*/
getInitializerIfKind(kind: ts.SyntaxKind): Expression | undefined;
/**
* Gets the initializer or throw.
*/
getInitializerOrThrow(): Expression;
}
export declare function InitializerGetExpressionableNode<T extends Constructor<InitializerGetExpressionableExtensionType>>(Base: T): Constructor<InitializerGetExpressionableNode> & T;