UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

28 lines (18 loc) 501 B
--- title: Generators --- ## Generators Nodes like `FunctionDeclaration` and `MethodDeclaration` can be generators. ### Tell if a generator ```typescript functionDeclaration.isGenerator(); // returns: boolean ``` ### Set as a generator ```typescript functionDeclaration.setIsGenerator(true); // or false to set as not one ``` ### Get asterisk token (`*`) Gets the asterisk token or undefined if not exists: ```typescript functionDeclaration.getAsteriskToken(); ```