Table of Contents

Class TypeScriptGenerator

Namespace
SunamoDevCode.CodeGenerator
Assembly
SunamoDevCode.dll

Generator for TypeScript code.

public class TypeScriptGenerator
Inheritance
TypeScriptGenerator
Inherited Members
Extension Methods

Methods

Append(string)

Appends text to the generated code.

public void Append(string text)

Parameters

text string

Text to append.

AppendLine()

Appends an empty line to the generated code.

public void AppendLine()

AppendLine(string)

Appends a line of text to the generated code.

public void AppendLine(string text)

Parameters

text string

Text to append.

ArrayWithKeyValueObjectEnd()

Generates the end of a TypeScript array with key-value objects.

public void ArrayWithKeyValueObjectEnd()

ArrayWithKeyValueObjectStart(string, params string[])

Generates the start of a TypeScript array with key-value objects.

public void ArrayWithKeyValueObjectStart(string itemType, params string[] values)

Parameters

itemType string

Type of array items.

values string[]

Initial values for the array.

ClassVariable(bool, TypesTs, string, string)

Generates a TypeScript class variable declaration.

public void ClassVariable(bool isExporting, TypesTs type, string name, string value)

Parameters

isExporting bool

If true, adds the export keyword.

type TypesTs

Type of the variable.

name string

Name of the variable.

value string

Initial value for the variable.

Const(string, string)

Generates a const field declaration.

public void Const(string name, string type)

Parameters

name string

Name of the field.

type string

Type of the field.

Interface(bool, string, params TWithNameTDC<string>[])

Generates a TypeScript interface.

public void Interface(bool isExporting, string name, params TWithNameTDC<string>[] properties)

Parameters

isExporting bool

If true, adds the export keyword.

name string

Name of the interface.

properties TWithNameTDC<string>[]

Array of properties with their types.

Let(string, string)

Generates a let field declaration.

public void Let(string name, string type)

Parameters

name string

Name of the field.

type string

Type of the field.

ToString()

Returns the generated TypeScript code as a string.

public override string ToString()

Returns

string

The generated TypeScript code.