TsGenerator class

Generates TypeScript definitions form the code model.

Namespace: TypeLite

Properties

Name Description
Formaters Gets collection of formatters for individual TsTypes
IndentationString Gets or sets string for the single indentation level.

Methods

Name Description
AddReference Add a typescript reference
Generate Generates TypeScript definitions for properties and enums in the model.
Generate Generates TypeScript definitions for classes and/or enums in the model.
RegisterIdentifierFormatter Registers a formatter for class member identifiers.
RegisterMemberTypeFormatter Registers a formatter for class member types.
RegisterModuleNameFormatter Registers a formatter for module names.
RegisterTypeConvertor<TFor> Registers the converter for the specific Type
RegisterTypeFormatter Registers the custom formatter for the TsClass type.
RegisterTypeFormatter<TFor> Registers the formatter for the specific TsType
RegisterTypeVisibilityFormatter Registers a formatter for class member types.

TsGenerator.Formaters property

Gets collection of formatters for individual TsTypes

Syntax


TsGenerator.IndentationString property

Gets or sets string for the single indentation level.

Syntax


TsGenerator.AddReference method

Add a typescript reference

Syntax

Parameters

string reference
Name of d.ts file used as typescript reference

TsGenerator.Generate method

Generates TypeScript definitions for properties and enums in the model.

Syntax

Parameters

TsModel model
The code model with classes to generate definitions for.

Returns

string
TypeScript definitions for classes in the model.

TsGenerator.Generate method

Generates TypeScript definitions for classes and/or enums in the model.

Syntax

Parameters

TsModel model
The code model with classes to generate definitions for.
TsGeneratorOutput generatorOutput
The type of definitions to generate

Returns

string
TypeScript definitions for classes and/or enums in the model..

TsGenerator.RegisterIdentifierFormatter method

Registers a formatter for class member identifiers.

Syntax

Parameters

TsMemberIdentifierFormatter formatter
The formatter to register.

TsGenerator.RegisterMemberTypeFormatter method

Registers a formatter for class member types.

Syntax

Parameters

TsMemberTypeFormatter formatter
The formatter to register.

TsGenerator.RegisterModuleNameFormatter method

Registers a formatter for module names.

Syntax

Parameters

TsModuleNameFormatter formatter
The formatter to register.

TsGenerator.RegisterTypeConvertor<TFor> method

Registers the converter for the specific Type

Syntax

Parameters

TypeConvertor convertor
The converter to register

Remarks

If a converter for the type is already registered, it is overwritten with the new value.

TsGenerator.RegisterTypeFormatter method

Registers the custom formatter for the TsClass type.

Syntax

Parameters

TsTypeFormatter formatter
The formatter to register.

TsGenerator.RegisterTypeFormatter<TFor> method

Registers the formatter for the specific TsType

Syntax

Parameters

TsTypeFormatter formatter
The formatter to register

Remarks

If a formatter for the type is already registered, it is overwritten with the new value.

TsGenerator.RegisterTypeVisibilityFormatter method

Registers a formatter for class member types.

Syntax

Parameters

TsTypeVisibilityFormatter formatter
The formatter to register.