CodeSquared docs

Identifier

An Identifier represents a variable or TypeScript type declaration in generated code.

Identifier.createVariable

Identifier.createVariable(name)
Identifier.createVariable(name, typeName)

Create a new Identifier representing a variable using name and optionally providing a typeName.

Parameters

PropertyTypeDescription
namestringName of the variable
typeNamestring | undefinedOptional type name. If provided, the variable will be typed as this name.

Return value

A new Identifier object

Identifier.createType

Create a new Identifier representing a type using name.

Identifier.createType(name)

Parameters

PropertyTypeDescription
namestringName of the type

Return value

A new Identifier object

Properties

PropertyTypeDescription
namestringName of the variable or type
typeNamestring | undefinedOptional type name in use when creating a typed variable
entityTypeEntityTypeEntityType object denoting whether identifier is a variable or type