Options
All
  • Public
  • Public/Protected
  • All
Menu

Generate code for a TypeScript document.

Hierarchy

  • CodeGenerator

Index

Constructors

constructor

  • Construct a new code generator.

    Parameters

    • __namedParameters: { names: string[]; namespace: HNamespace; typeGuardOptions: TypeGuardOptions }
      • names: string[]

        The names of the defs to generate the code for.

      • namespace: HNamespace

        The defs namespace.

      • typeGuardOptions: TypeGuardOptions

    Returns CodeGenerator

Properties

Private Readonly #names

#names: string[]

The def names.

Private Readonly #namespace

#namespace: HNamespace

The defs namespace.

Private Readonly #typeGuardOptions

#typeGuardOptions: TypeGuardOptions

Typeguard options.

Methods

Private addExtends

  • Add the what types the interface extends from by querying the namespace.

    Parameters

    • name: string

      The name of the def to query the super types from.

    • doc: DocNode

      The document node.

    • intNode: InterfaceNode

      The interface name to add the extend types to.

    Returns void

Private addInterface

  • addInterface(name: string, doc: DocNode): void
  • Add an interface node.

    Parameters

    • name: string

      The name of the interface to add.

    • doc: DocNode

      The document node.

    Returns void

Private addNamespace

Private addTypeGuard

  • addTypeGuard(name: string, doc: DocNode): void

Private addValues

  • addValues(name: string, tags: HDict[], intNode: InterfaceNode): void
  • Add all the values to the interface node.

    Parameters

    • name: string

      The name of the interface node.

    • tags: HDict[]

      The tags to query.

    • intNode: InterfaceNode

      The interface node to add the values to.

    Returns void

generate

  • generate(): string

Private propertyAlreadyExistOnHDict

  • propertyAlreadyExistOnHDict(prop: string): boolean
  • Return true if the property already exists on HDict.

    Parameters

    • prop: string

      The property name.

    Returns boolean

    True if it exists.

Private removeDuplicates

  • removeDuplicates(names: string[]): string[]
  • Remove any duplicates from the array.

    Parameters

    • names: string[]

      The names process.

    Returns string[]

    The array with no duplicates.

Static Private isDefFromCorePh

  • isDefFromCorePh(def: HDict): boolean
  • Return true if the def is from the core project haystack library.

    Parameters

    • def: HDict

      The def to test.

    Returns boolean

    True if the def is from the core project haystack library.

Generated using TypeDoc