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
textstringText 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
textstringText 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
ClassVariable(bool, TypesTs, string, string)
Generates a TypeScript class variable declaration.
public void ClassVariable(bool isExporting, TypesTs type, string name, string value)
Parameters
isExportingboolIf true, adds the export keyword.
typeTypesTsType of the variable.
namestringName of the variable.
valuestringInitial value for the variable.
Const(string, string)
Generates a const field declaration.
public void Const(string name, string type)
Parameters
Interface(bool, string, params TWithNameTDC<string>[])
Generates a TypeScript interface.
public void Interface(bool isExporting, string name, params TWithNameTDC<string>[] properties)
Parameters
isExportingboolIf true, adds the export keyword.
namestringName of the interface.
propertiesTWithNameTDC<string>[]Array of properties with their types.
Let(string, string)
Generates a let field declaration.
public void Let(string name, string type)
Parameters
ToString()
Returns the generated TypeScript code as a string.
public override string ToString()
Returns
- string
The generated TypeScript code.