Skip to main content Link Search Menu Expand Document (external link)

factories overview

Factory functiosn for creating TypeScript AST nodes

Added in v1.0.0


Table of contents


utils

DocumentFragmentType

DocumentFragment type reference

Signature

export declare const DocumentFragmentType: ts.TypeReferenceNode

Added in v1.0.0

DocumentType

Document type reference

Signature

export declare const DocumentType: ts.TypeReferenceNode

Added in v1.0.0

ElementType

Element type reference

Signature

export declare const ElementType: ts.TypeReferenceNode

Added in v1.0.0

HTMLElementType

HTMLElement type reference

Signature

export declare const HTMLElementType: ts.TypeReferenceNode

Added in v1.0.0

NodeType

Node type reference

Signature

export declare const NodeType: ts.TypeReferenceNode

Added in v1.0.0

SVGElementType

SVGElement type reference

Signature

export declare const SVGElementType: ts.TypeReferenceNode

Added in v1.0.0

TextType

Text type reference

Signature

export declare const TextType: ts.TypeReferenceNode

Added in v1.0.0

appendChild

Append child

Signature

export declare function appendChild(parent: string, child: string)

Added in v1.0.0

createDocumentFragment

Create document fragment

Signature

export declare function createDocumentFragment()

Added in v1.0.0

createElement

Create element

Signature

export declare function createElement(tagName: string)

Added in v1.0.0

createFunctionCall

Creates a TypeScript function call

Signature

export declare function createFunctionCall(name: string, args: Array<ts.Expression>): ts.CallExpression

Added in v1.0.0

createMethodCall

Creates a TypeScript method call

Signature

export declare function createMethodCall(
  object: string,
  methodName: string,
  args: Array<ts.Expression>
): ts.CallExpression

Added in v1.0.0

createText

Create text node

Signature

export declare function createText(text: string)

Added in v1.0.0

createTypeReference

Creates a TypeScript type reference by name

Signature

export declare function createTypeReference(name: string, ...args: Array<ts.TypeNode>): ts.TypeReferenceNode

Added in v1.0.0

createVariableDeclaration

Creates a TypeScript variable declaration

Signature

export declare function createVariableDeclaration(
  name: string,
  type?: ts.TypeNode,
  initializer?: ts.Expression
): ts.VariableDeclaration

Added in v1.0.0

insertBefore

Insert before

Signature

export declare function insertBefore(parent: string, child: string, reference?: string | null)

Added in v1.0.0

removeChild

Remove child

Signature

export declare function removeChild(parent: string, child: string)

Added in v1.0.0