UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

38 lines (37 loc) 1.75 kB
import * as ts from "typescript"; import { Constructor } from "./../../Constructor"; import { TypeParameterDeclarationStructure } from "./../../structures"; import { Node } from "./../common"; import { TypeParameterDeclaration } from "./../type/TypeParameterDeclaration"; export declare type TypeParameteredNodeExtensionType = Node<ts.Node & { typeParameters?: ts.NodeArray<ts.TypeParameterDeclaration>; }>; export interface TypeParameteredNode { /** * Gets the type parameters. */ getTypeParameters(): TypeParameterDeclaration[]; /** * Adds a type parameter. * @param structure - Structure of the type parameter. */ addTypeParameter(structure: TypeParameterDeclarationStructure): TypeParameterDeclaration; /** * Adds type parameters. * @param structures - Structures of the type parameters. */ addTypeParameters(structures: TypeParameterDeclarationStructure[]): TypeParameterDeclaration[]; /** * Inserts a type parameter. * @param index - Index to insert at. Specify a negative index to insert from the reverse. * @param structure - Structure of the type parameter. */ insertTypeParameter(index: number, structure: TypeParameterDeclarationStructure): TypeParameterDeclaration; /** * Inserts type parameters. * @param index - Index to insert at. Specify a negative index to insert from the reverse. * @param structures - Structures of the type parameters. */ insertTypeParameters(index: number, structures: TypeParameterDeclarationStructure[]): TypeParameterDeclaration[]; } export declare function TypeParameteredNode<T extends Constructor<TypeParameteredNodeExtensionType>>(Base: T): Constructor<TypeParameteredNode> & T;