- ClassDefinition interface
- ClassFeatures enumeration
- ClassOptions interface
- DefinitionBase interface
- EnumDefinition interface
- EnumFeatures enumeration
- EnumMemberDefinition interface
- EnumOptions interface
- FunctionDefinition interface
- FunctionFeatures enumeration
- FunctionOptions interface
- InterfaceDefinition interface
- InterfaceFeatures enumeration
- InterfaceOptions interface
- OptionalityModifier enumeration
- ParameterDefinition interface
- ParameterFeatures enumeration
- PropertyDefinition interface
- PropertyFeatures enumeration
- PropertyOptions interface
- StringLiteralOptions interface
- TypeDefinition interface
- TypeScriptWriter class
- WriterOptions interface
Represents a TypeScript class.
Gets the description of the element. This field is optional.
Get or sets the name of the code element. This field is required.
Indicates if the 'declare' keyword should be written. The default value is false.
Indicates if the 'export' keyword should be written. The default value is false.
Contains the names of the classes that the class inherits from. This field is optional.
Contains the names of the interfaces that the class implements. This field is optional.
Indicates if the class should contain the 'abstract' keyword. The default value is false.
Gets the class properties.
- None
- JsDocDescription
- Generalizations
- InterfaceRealizations
- All
True if the class definition should contain the 'declare' keyword.
Indicates if the class must be exported or not (using the 'export' keyword). By default, the class is exported only if it has public or package visibility.
Defines the class features to write. The default is ClassFeatures.All.
Any additional interface names that the class should implement.
Any additional class names that the class should inherit from.
Any string to prefix the class keyword with, such as "export". Indicates if the class must be exported or not (using the 'export' keyword). By default, the class is exported only if it has public or package visibility.
The base interface for all TypeScript definitions.
Gets the description of the element. This field is optional.
Get or sets the name of the code element. This field is required.
Represents a TypeScript enumeration.
Gets the description of the element. This field is optional.
Get or sets the name of the code element. This field is required.
Indicates if the 'declare' keyword should be written. The default value is false.
Indicates if the 'export' keyword should be written. The default value is false.
Contains the enumeration members. This field is optional.
- None
- JsDocDescription
- Initializers
- All
Represents a TypeScript enumeration member.
Gets the description of the element. This field is optional.
Get or sets the name of the code element. This field is required.
The value of the member, which can either be a number or a string. This field is optional. If this field has a value, an initializer will be written.
True if the class definition should contain the 'declare' keyword.
Indicates if the class must be exported or not (using the 'export' keyword). By default, the class is exported only if it has public or package visibility.
Any string to prefix the enum keyword with, such as "export". Indicates if the class must be exported or not (using the 'export' keyword). By default, the class is exported only if it has public or package visibility.
Represents a TypeScript function.
Gets the description of the element. This field is optional.
Get or sets the name of the code element. This field is required.
Gets the function's access modifier. By default, no access modifier will be written.
Indicates if the function should be generated as an 'abstract' function. The default value is false.
Indicates if the function is static. The default value is false.
Gets the function's input parameters.
Indicates if the return value is optional. If true, the return type will be generated as a null union type (e.g. 'string | null').
The full type name of the function return type. If the function returns a collection, the collection must be part of the name (e.g. 'string[]'). If this value is empty, the function will return 'void'.
- None
- JsDocDescription
- AccessModifier
- OptionalModifier
- All
Indicates what to write when an input parameters has a lower bound of 0. The default is OptionalityModifier.NullKeyword.
Indicates what to write when the return parameter has a lower bound of 0. The default is OptionalityModifier.NullKeyword.
Represents a TypeScript interface.
Gets the description of the element. This field is optional.
Get or sets the name of the code element. This field is required.
Indicates if the 'declare' keyword should be written. The default value is false.
Indicates if the 'export' keyword should be written. The default value is false.
Contains the names of the interfaces that the interface inherits from. This field is optional.
- None
- JsDocDescription
- Generalizations
- All
True if the interface definition should contain the 'declare' keyword.
Indicates if the interface must be exported or not (using the 'export' keyword). By default, the interface is exported only if it has public or package visibility.
Defines the interface features to write. The default is InterfaceFeatures.All.
Any additional interface names that the interface should inherit from.
Any string to prefix the interface keyword with, such as "export". Indicates if the class must be exported or not (using the 'export' keyword). By default, the class is exported only if it has public or package visibility.
Defines options for dealing with elements that are 'optional', meaning that they have a lower bound of 0.
-
Ignore
Don't write any modifier.
-
NullKeyword
Write a 'null' keyword, for example 'myProperty: string | null;';
-
QuestionToken
Write a question token, for example 'myProperty?: string;';
Represents a TypeScript function parameter.
Gets the description of the element. This field is optional.
Get or sets the name of the code element. This field is required.
Indicates if the parameter is optional. If true, the parameter will be generated as a null union type (e.g. 'myParameter: string | null'), unless useQuestionToken is true.
Indicates if the parameter is a return parameter. The return parameter will not be written as a function parameter, but is used to write a JSDoc '@returns' comment.
The full type name of the parameter. If the type is a collection, the collection must be part of the name (e.g. 'string[]').
Indicates if an optional parameter must be generated using a question token instead of using a null union type.
- None
- JsDocDescription
- OptionalModifier
- All
Represents a TypeScript property.
Gets the description of the element. This field is optional.
Get or sets the name of the code element. This field is required.
Gets the property's access modifier. By default, no access modifier will be written.
The default value of the property. If provided, an intitializer will be written. If the propery is a string property, defaultValue must be quoted string. This field is optional.
Indicates if the property can be null. If true, '| null' will be appended to the typeName and the question mark will be omitted (e.g. 'FirstName: string|null'). This field is ignored if isOptional is falsy. The default value is false.
Indicates if the property is optional. If true, a question mark will be appended to the name (e.g. 'FirstName?: string'), unless hasNullUnionType is true. The default value is false.
Indicates if the property is readonly. The default value is false.
Indicates if the property is static. The default value is false.
The full type name of the property. If the type is an array, the collection must be part of the name (e.g. 'Array' or 'string[]').
Writes the so-called 'definite assignment assertion modifier' for the property if the property is required. There are certain scenarios where properties can be initialized indirectly (perhaps by a helper method or dependency injection library), in which case you can use the definite assignment assertion modifiers for your properties. The default value is false. This field is ignored if the property to write has a default value.
-
None
-
JsDocDescription
-
AccessModifier
-
ReadonlyModifier
-
OptionalModifier
-
Initializer
-
DefiniteAssignmentAssertionModifier
Writes the so-called 'definite assignment assertion modifier' for the property if the property is required. There are certain scenarios where properties can be initialized indirectly (perhaps by a helper method or dependency injection library), in which case you can use the definite assignment assertion modifiers for your properties.
-
All
-
AllInterfaceProperty
Include all features, except the ones that are not usable on interface properties.
Defines the property features to write. The default is PropertyFeatures.All.
Set to true to initialize an array property with an empty array, or with null if the property is optional (has a lower bound of 0) and optionality is OptionalityModifier.NullKeyword. The default value is false.
Set to true to initialize a primitive property (Boolean, Number and String) with the type's default value (false, 0 and '') in case it is required and doesn't have a default value in the model. If the property doesn't have a default value in the model, is optional and optionality is OptionalityModifier.NullKeyword, the property will be initialized with 'null'. The default value is false.
Indicates how to deal with properties that have a lower bound of 0. The default is OptionalityModifier.QuestionToken.
True if the literal definition should contain the 'declare' keyword.
Indicates if the literal must be exported or not (using the 'export' keyword). By default, the literal is exported only if the enum has public or package visibility.
The base interface for class-, interface and enumeration definitions.
Gets the description of the element. This field is optional.
Get or sets the name of the code element. This field is required.
Indicates if the 'declare' keyword should be written. The default value is false.
Indicates if the 'export' keyword should be written. The default value is false.
Provides code writing functionality specific for TypeScript.
Gets the name of the type. This function uses the current typeNameProvider for resolving the type name. Gets the type name of the typed element. This function uses the current typeNameProvider for resolving the type name.
-
type: Type
Any element that derives from Type.
Gets the name of the type. This function uses the current typeNameProvider for resolving the type name. Gets the type name of the typed element. This function uses the current typeNameProvider for resolving the type name.
-
typedElement: TypedElement
Any element that has a type, such as a Property or Parameter.
Writes a block of code, wrapped in a class declaration and opening and closing brackets. This function does not write class members. Writes a block of code, wrapped in a class declaration and opening and closing brackets. This function does not write class members.
-
cls: ClassDefinition
-
contents: (writer: TypeScriptWriter) => void
A callback function that writes the class contents.
Writes a block of code, wrapped in a class declaration and opening and closing brackets. This function does not write class members. Writes a block of code, wrapped in a class declaration and opening and closing brackets. This function does not write class members.
-
cls: Type
-
contents: (writer: TypeScriptWriter) => void
A callback function that writes the class contents.
-
options: ClassOptions
An optional ClassOptions object.
Writes an indented block of code, wrapped in opening and closing brackets.
-
contents: (writer: TypeScriptWriter) => void
A callback function that writes the contents.
Writes an indented block of decorator code, wrapped in opening and closing brackets.
-
decoratorName: string
-
contents: (writer: TypeScriptWriter) => void
A callback function that writes the contents.
Writes a full enumeration, including members.
Writes a full enumeration, including members.
-
enumeration: Enumeration
-
options: EnumOptions
An optional EnumerationOptions object.
Writes a full enumeration, including members.
Writes a full enumeration, including members.
- enumeration: EnumDefinition
Writes a block of code, wrapped in an function declaration and opening and closing brackets. Writes a block of code, wrapped in an function declaration and opening and closing brackets.
-
func: FunctionDefinition
The operation.
-
contents: (writer: TypeScriptWriter, op: Operation) => void
A callback that writes the operation contents.
Writes a block of code, wrapped in an function declaration and opening and closing brackets. Writes a block of code, wrapped in an function declaration and opening and closing brackets.
-
operation: Operation
The operation.
-
contents: (writer: TypeScriptWriter, op: Operation) => void
A callback that writes the operation contents.
-
options: FunctionOptions
An optional FunctionOptions object.
Writes a function declaration without a body.
Writes a function declaration without a body.
- funct: FunctionDefinition
Writes a function declaration without a body.
Writes a function declaration without a body.
-
operation: Operation
The operation.
-
options: FunctionOptions
An optional FunctionOptions object.
Writes an import statement that imports the specified exports from the specified module.
- moduleName: string
- exports: any
Writes an import statement that imports the specified exports from the specified module.
-
moduleName: string
The module to import from.
-
alias: string
The alias under which the module should be imported.
Writes a block of code, wrapped in an interface declaration and opening and closing brackets. This function does not write interface members. Writes a block of code, wrapped in an interface declaration and opening and closing brackets. This function does not write interface members.
-
iface: Type
-
contents: (writer: TypeScriptWriter) => void
A callback function that writes the interface contents.
-
options: InterfaceOptions
An optional InterfaceOptions object.
Writes a block of code, wrapped in an interface declaration and opening and closing brackets. This function does not write interface members. Writes a block of code, wrapped in an interface declaration and opening and closing brackets. This function does not write interface members.
-
iface: InterfaceDefinition
The interface.
-
contents: (writer: TypeScriptWriter) => void
A callback function that writes the interface contents.
- text: string
- comments: Comment
- lines: string
- text: string
Writes a property from the property definition. Writes a class or interface property.
-
property: Property
The property to write.
-
options: PropertyOptions
An optional PropertyOptions object.
Writes a property from the property definition. Writes a class or interface property.
- property: PropertyDefinition
Writes a block of code wrapped in a #region block.
- name: string
- contents: (writer: TypeScriptWriter) => void
Writes a string literal type from a specified enumeration. Example: 'type Easing = 'ease-in' | 'ease-out' | 'ease-in-out';'
-
enumeration: Enumeration
The enumeration.
-
options: StringLiteralOptions
The maximum width of generated documentation comments before they are word-wrapped. The default value is 100 characters.
Sets an optional TypeNameProvider. By default, the TypeScriptTypeNameProvider is used.