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

createComment

Signature

export declare function createComment(value: string)

Added in v1.0.0

createConst

Signature

export declare function createConst(varName: string, expression: ts.Expression): ts.Statement

Added in v1.0.0

createDocumentFragment

Create document fragment

Signature

export declare function createDocumentFragment()

Added in v1.0.0

createEffectYield

Signature

export declare function createEffectYield(...expressions: Array<ts.Expression>): ts.Expression

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 | ts.Expression, args: Array<ts.Expression>): ts.CallExpression

Added in v1.0.0

createMethodCall

Creates a TypeScript method call

Signature

export declare function createMethodCall(
  object: string | ts.Expression,
  methodName: string,
  typeParams: Array<ts.TypeNode>,
  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

createUnion

Creates a TypeScript union types by name

Signature

export declare function createUnion(types: Array<ts.TypeNode>): ts.TypeNode

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

setAttribute

Signature

export declare function setAttribute(element: string, name: string, value: string, coerce: boolean = true)

Added in v1.0.0

toggleAttribute

Signature

export declare function toggleAttribute(element: string, name: string)

Added in v1.0.0