Class TypeScriptFileGenerator

Generator for TypeScript

Hierarchy

Constructors

  • Parameters

    • Optional options: {
          constraints?: { enumKey?: EnumKeyConstraint<TypeScriptOptions> | undefined; enumValue?: EnumValueConstraint<TypeScriptOptions> | undefined; modelName?: ModelNameConstraint<...> | undefined; propertyKey?: PropertyKeyConstraint<...> | undefined; constant?: ConstantConstraint<...> | undefined; };
          defaultPreset?: { class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; type?: { ...; ...;
          dependencyManager?: (() => TypeScriptDependencyManager) | ({ options?: { renderTypes?: boolean | undefined; modelType?: "class" | "interface" | undefined; enumType?: "enum" | "union" | undefined; mapType?: "map" | "record" | "indexedObject" | undefined; ... 9 more ...; dependencyManager?: (() => TypeScriptDependencyManager) | ... 1 more ... | undefined; } | undefined; ... 5...);
          enumType?: "enum" | "union";
          indentation?: { type?: IndentationTypes | undefined; size?: number | undefined; };
          mapType?: "map" | "record" | "indexedObject";
          modelType?: "class" | "interface";
          moduleSystem?: TypeScriptModuleSystemType;
          presets?: (undefined | ({ class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; type?: { ...; ...) | ({ preset?: { class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; typ...))[];
          processorOptions?: { asyncapi?: { source?: string | undefined; applyTraits?: boolean | undefined; parseSchemas?: boolean | undefined; validateOptions?: { allowedSeverity?: { error?: boolean | undefined; warning?: boolean | undefined; info?: boolean | undefined; hint?: boolean | undefined; } | undefined; __unstable?: { ...; } | undefin...;
          rawPropertyNames?: boolean;
          renderTypes?: boolean;
          typeMapping?: { Object?: TypeMappingFunction<ConstrainedObjectModel, TypeScriptOptions, TypeScriptDependencyManager> | undefined; ... 10 more ...; Dictionary?: TypeMappingFunction<...> | undefined; };
          useJavascriptReservedKeywords?: boolean;
      }
      • Optional constraints?: { enumKey?: EnumKeyConstraint<TypeScriptOptions> | undefined; enumValue?: EnumValueConstraint<TypeScriptOptions> | undefined; modelName?: ModelNameConstraint<...> | undefined; propertyKey?: PropertyKeyConstraint<...> | undefined; constant?: ConstantConstraint<...> | undefined; }
      • Optional defaultPreset?: { class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; type?: { ...; ...
      • Optional dependencyManager?: (() => TypeScriptDependencyManager) | ({ options?: { renderTypes?: boolean | undefined; modelType?: "class" | "interface" | undefined; enumType?: "enum" | "union" | undefined; mapType?: "map" | "record" | "indexedObject" | undefined; ... 9 more ...; dependencyManager?: (() => TypeScriptDependencyManager) | ... 1 more ... | undefined; } | undefined; ... 5...)

        This dependency manager type serves two functions.

        1. It can be used to provide a factory for generate functions
        2. It can be used to provide a single instance of a dependency manager, to add all dependencies together

        This depends on context and where it's used.

      • Optional enumType?: "enum" | "union"
      • Optional indentation?: { type?: IndentationTypes | undefined; size?: number | undefined; }
      • Optional mapType?: "map" | "record" | "indexedObject"
      • Optional modelType?: "class" | "interface"
      • Optional moduleSystem?: TypeScriptModuleSystemType
      • Optional presets?: (undefined | ({ class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; type?: { ...; ...) | ({ preset?: { class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; typ...))[]
      • Optional processorOptions?: { asyncapi?: { source?: string | undefined; applyTraits?: boolean | undefined; parseSchemas?: boolean | undefined; validateOptions?: { allowedSeverity?: { error?: boolean | undefined; warning?: boolean | undefined; info?: boolean | undefined; hint?: boolean | undefined; } | undefined; __unstable?: { ...; } | undefin...
      • Optional rawPropertyNames?: boolean

        Use raw property names instead of constrained ones, where you most likely need to access them with obj["propertyName"] instead of obj.propertyName

      • Optional renderTypes?: boolean
      • Optional typeMapping?: { Object?: TypeMappingFunction<ConstrainedObjectModel, TypeScriptOptions, TypeScriptDependencyManager> | undefined; ... 10 more ...; Dictionary?: TypeMappingFunction<...> | undefined; }
      • Optional useJavascriptReservedKeywords?: boolean

        Use JS reserved keywords so the TS output models can easily be transpiled to JS

    Returns TypeScriptFileGenerator

Properties

languageName: string
defaultCompleteModelOptions: TypeScriptRenderCompleteModelOptions = ...
defaultOptions: TypeScriptOptions = ...

Methods

  • Parameters

    • model: MetaModel
    • options: {
          constraints?: { enumKey?: EnumKeyConstraint<TypeScriptOptions> | undefined; enumValue?: EnumValueConstraint<TypeScriptOptions> | undefined; modelName?: ModelNameConstraint<...> | undefined; propertyKey?: PropertyKeyConstraint<...> | undefined; constant?: ConstantConstraint<...> | undefined; };
          defaultPreset?: { class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; type?: { ...; ...;
          dependencyManager?: (() => TypeScriptDependencyManager) | ({ options?: { renderTypes?: boolean | undefined; modelType?: "class" | "interface" | undefined; enumType?: "enum" | "union" | undefined; mapType?: "map" | "record" | "indexedObject" | undefined; ... 9 more ...; dependencyManager?: (() => TypeScriptDependencyManager) | ... 1 more ... | undefined; } | undefined; ... 5...);
          enumType?: "enum" | "union";
          indentation?: { type?: IndentationTypes | undefined; size?: number | undefined; };
          mapType?: "map" | "record" | "indexedObject";
          modelType?: "class" | "interface";
          moduleSystem?: TypeScriptModuleSystemType;
          presets?: (undefined | ({ class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; type?: { ...; ...) | ({ preset?: { class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; typ...))[];
          processorOptions?: { asyncapi?: { source?: string | undefined; applyTraits?: boolean | undefined; parseSchemas?: boolean | undefined; validateOptions?: { allowedSeverity?: { error?: boolean | undefined; warning?: boolean | undefined; info?: boolean | undefined; hint?: boolean | undefined; } | undefined; __unstable?: { ...; } | undefin...;
          rawPropertyNames?: boolean;
          renderTypes?: boolean;
          typeMapping?: { Object?: TypeMappingFunction<ConstrainedObjectModel, TypeScriptOptions, TypeScriptDependencyManager> | undefined; ... 10 more ...; Dictionary?: TypeMappingFunction<...> | undefined; };
          useJavascriptReservedKeywords?: boolean;
      }
      • Optional constraints?: { enumKey?: EnumKeyConstraint<TypeScriptOptions> | undefined; enumValue?: EnumValueConstraint<TypeScriptOptions> | undefined; modelName?: ModelNameConstraint<...> | undefined; propertyKey?: PropertyKeyConstraint<...> | undefined; constant?: ConstantConstraint<...> | undefined; }
      • Optional defaultPreset?: { class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; type?: { ...; ...
      • Optional dependencyManager?: (() => TypeScriptDependencyManager) | ({ options?: { renderTypes?: boolean | undefined; modelType?: "class" | "interface" | undefined; enumType?: "enum" | "union" | undefined; mapType?: "map" | "record" | "indexedObject" | undefined; ... 9 more ...; dependencyManager?: (() => TypeScriptDependencyManager) | ... 1 more ... | undefined; } | undefined; ... 5...)

        This dependency manager type serves two functions.

        1. It can be used to provide a factory for generate functions
        2. It can be used to provide a single instance of a dependency manager, to add all dependencies together

        This depends on context and where it's used.

      • Optional enumType?: "enum" | "union"
      • Optional indentation?: { type?: IndentationTypes | undefined; size?: number | undefined; }
      • Optional mapType?: "map" | "record" | "indexedObject"
      • Optional modelType?: "class" | "interface"
      • Optional moduleSystem?: TypeScriptModuleSystemType
      • Optional presets?: (undefined | ({ class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; type?: { ...; ...) | ({ preset?: { class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; typ...))[]
      • Optional processorOptions?: { asyncapi?: { source?: string | undefined; applyTraits?: boolean | undefined; parseSchemas?: boolean | undefined; validateOptions?: { allowedSeverity?: { error?: boolean | undefined; warning?: boolean | undefined; info?: boolean | undefined; hint?: boolean | undefined; } | undefined; __unstable?: { ...; } | undefin...
      • Optional rawPropertyNames?: boolean

        Use raw property names instead of constrained ones, where you most likely need to access them with obj["propertyName"] instead of obj.propertyName

      • Optional renderTypes?: boolean
      • Optional typeMapping?: { Object?: TypeMappingFunction<ConstrainedObjectModel, TypeScriptOptions, TypeScriptDependencyManager> | undefined; ... 10 more ...; Dictionary?: TypeMappingFunction<...> | undefined; }
      • Optional useJavascriptReservedKeywords?: boolean

        Use JS reserved keywords so the TS output models can easily be transpiled to JS

    Returns ConstrainedMetaModel

  • Generates all the models to an output directory each model with their own separate files.

    Parameters

    • input: any
    • outputDirectory: string

      where you want the models generated to

    • Optional options: TypeScriptRenderCompleteModelOptions
    • ensureFilesWritten: boolean = false

      verify that the files is completely written before returning, this can happen if the file system is swamped with write requests.

    Returns Promise<OutputModel[]>

  • Parameters

    • model: ConstrainedObjectModel
    • inputModel: InputMetaModel
    • Optional options: {
          constraints?: { enumKey?: EnumKeyConstraint<TypeScriptOptions> | undefined; enumValue?: EnumValueConstraint<TypeScriptOptions> | undefined; modelName?: ModelNameConstraint<...> | undefined; propertyKey?: PropertyKeyConstraint<...> | undefined; constant?: ConstantConstraint<...> | undefined; };
          defaultPreset?: { class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; type?: { ...; ...;
          dependencyManager?: (() => TypeScriptDependencyManager) | ({ options?: { renderTypes?: boolean | undefined; modelType?: "class" | "interface" | undefined; enumType?: "enum" | "union" | undefined; mapType?: "map" | "record" | "indexedObject" | undefined; ... 9 more ...; dependencyManager?: (() => TypeScriptDependencyManager) | ... 1 more ... | undefined; } | undefined; ... 5...);
          enumType?: "enum" | "union";
          indentation?: { type?: IndentationTypes | undefined; size?: number | undefined; };
          mapType?: "map" | "record" | "indexedObject";
          modelType?: "class" | "interface";
          moduleSystem?: TypeScriptModuleSystemType;
          presets?: (undefined | ({ class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; type?: { ...; ...) | ({ preset?: { class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; typ...))[];
          processorOptions?: { asyncapi?: { source?: string | undefined; applyTraits?: boolean | undefined; parseSchemas?: boolean | undefined; validateOptions?: { allowedSeverity?: { error?: boolean | undefined; warning?: boolean | undefined; info?: boolean | undefined; hint?: boolean | undefined; } | undefined; __unstable?: { ...; } | undefin...;
          rawPropertyNames?: boolean;
          renderTypes?: boolean;
          typeMapping?: { Object?: TypeMappingFunction<ConstrainedObjectModel, TypeScriptOptions, TypeScriptDependencyManager> | undefined; ... 10 more ...; Dictionary?: TypeMappingFunction<...> | undefined; };
          useJavascriptReservedKeywords?: boolean;
      }
      • Optional constraints?: { enumKey?: EnumKeyConstraint<TypeScriptOptions> | undefined; enumValue?: EnumValueConstraint<TypeScriptOptions> | undefined; modelName?: ModelNameConstraint<...> | undefined; propertyKey?: PropertyKeyConstraint<...> | undefined; constant?: ConstantConstraint<...> | undefined; }
      • Optional defaultPreset?: { class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; type?: { ...; ...
      • Optional dependencyManager?: (() => TypeScriptDependencyManager) | ({ options?: { renderTypes?: boolean | undefined; modelType?: "class" | "interface" | undefined; enumType?: "enum" | "union" | undefined; mapType?: "map" | "record" | "indexedObject" | undefined; ... 9 more ...; dependencyManager?: (() => TypeScriptDependencyManager) | ... 1 more ... | undefined; } | undefined; ... 5...)

        This dependency manager type serves two functions.

        1. It can be used to provide a factory for generate functions
        2. It can be used to provide a single instance of a dependency manager, to add all dependencies together

        This depends on context and where it's used.

      • Optional enumType?: "enum" | "union"
      • Optional indentation?: { type?: IndentationTypes | undefined; size?: number | undefined; }
      • Optional mapType?: "map" | "record" | "indexedObject"
      • Optional modelType?: "class" | "interface"
      • Optional moduleSystem?: TypeScriptModuleSystemType
      • Optional presets?: (undefined | ({ class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; type?: { ...; ...) | ({ preset?: { class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; typ...))[]
      • Optional processorOptions?: { asyncapi?: { source?: string | undefined; applyTraits?: boolean | undefined; parseSchemas?: boolean | undefined; validateOptions?: { allowedSeverity?: { error?: boolean | undefined; warning?: boolean | undefined; info?: boolean | undefined; hint?: boolean | undefined; } | undefined; __unstable?: { ...; } | undefin...
      • Optional rawPropertyNames?: boolean

        Use raw property names instead of constrained ones, where you most likely need to access them with obj["propertyName"] instead of obj.propertyName

      • Optional renderTypes?: boolean
      • Optional typeMapping?: { Object?: TypeMappingFunction<ConstrainedObjectModel, TypeScriptOptions, TypeScriptDependencyManager> | undefined; ... 10 more ...; Dictionary?: TypeMappingFunction<...> | undefined; }
      • Optional useJavascriptReservedKeywords?: boolean

        Use JS reserved keywords so the TS output models can easily be transpiled to JS

    Returns Promise<RenderOutput>

  • Parameters

    • model: ConstrainedEnumModel
    • inputModel: InputMetaModel
    • Optional options: {
          constraints?: { enumKey?: EnumKeyConstraint<TypeScriptOptions> | undefined; enumValue?: EnumValueConstraint<TypeScriptOptions> | undefined; modelName?: ModelNameConstraint<...> | undefined; propertyKey?: PropertyKeyConstraint<...> | undefined; constant?: ConstantConstraint<...> | undefined; };
          defaultPreset?: { class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; type?: { ...; ...;
          dependencyManager?: (() => TypeScriptDependencyManager) | ({ options?: { renderTypes?: boolean | undefined; modelType?: "class" | "interface" | undefined; enumType?: "enum" | "union" | undefined; mapType?: "map" | "record" | "indexedObject" | undefined; ... 9 more ...; dependencyManager?: (() => TypeScriptDependencyManager) | ... 1 more ... | undefined; } | undefined; ... 5...);
          enumType?: "enum" | "union";
          indentation?: { type?: IndentationTypes | undefined; size?: number | undefined; };
          mapType?: "map" | "record" | "indexedObject";
          modelType?: "class" | "interface";
          moduleSystem?: TypeScriptModuleSystemType;
          presets?: (undefined | ({ class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; type?: { ...; ...) | ({ preset?: { class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; typ...))[];
          processorOptions?: { asyncapi?: { source?: string | undefined; applyTraits?: boolean | undefined; parseSchemas?: boolean | undefined; validateOptions?: { allowedSeverity?: { error?: boolean | undefined; warning?: boolean | undefined; info?: boolean | undefined; hint?: boolean | undefined; } | undefined; __unstable?: { ...; } | undefin...;
          rawPropertyNames?: boolean;
          renderTypes?: boolean;
          typeMapping?: { Object?: TypeMappingFunction<ConstrainedObjectModel, TypeScriptOptions, TypeScriptDependencyManager> | undefined; ... 10 more ...; Dictionary?: TypeMappingFunction<...> | undefined; };
          useJavascriptReservedKeywords?: boolean;
      }
      • Optional constraints?: { enumKey?: EnumKeyConstraint<TypeScriptOptions> | undefined; enumValue?: EnumValueConstraint<TypeScriptOptions> | undefined; modelName?: ModelNameConstraint<...> | undefined; propertyKey?: PropertyKeyConstraint<...> | undefined; constant?: ConstantConstraint<...> | undefined; }
      • Optional defaultPreset?: { class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; type?: { ...; ...
      • Optional dependencyManager?: (() => TypeScriptDependencyManager) | ({ options?: { renderTypes?: boolean | undefined; modelType?: "class" | "interface" | undefined; enumType?: "enum" | "union" | undefined; mapType?: "map" | "record" | "indexedObject" | undefined; ... 9 more ...; dependencyManager?: (() => TypeScriptDependencyManager) | ... 1 more ... | undefined; } | undefined; ... 5...)

        This dependency manager type serves two functions.

        1. It can be used to provide a factory for generate functions
        2. It can be used to provide a single instance of a dependency manager, to add all dependencies together

        This depends on context and where it's used.

      • Optional enumType?: "enum" | "union"
      • Optional indentation?: { type?: IndentationTypes | undefined; size?: number | undefined; }
      • Optional mapType?: "map" | "record" | "indexedObject"
      • Optional modelType?: "class" | "interface"
      • Optional moduleSystem?: TypeScriptModuleSystemType
      • Optional presets?: (undefined | ({ class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; type?: { ...; ...) | ({ preset?: { class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; typ...))[]
      • Optional processorOptions?: { asyncapi?: { source?: string | undefined; applyTraits?: boolean | undefined; parseSchemas?: boolean | undefined; validateOptions?: { allowedSeverity?: { error?: boolean | undefined; warning?: boolean | undefined; info?: boolean | undefined; hint?: boolean | undefined; } | undefined; __unstable?: { ...; } | undefin...
      • Optional rawPropertyNames?: boolean

        Use raw property names instead of constrained ones, where you most likely need to access them with obj["propertyName"] instead of obj.propertyName

      • Optional renderTypes?: boolean
      • Optional typeMapping?: { Object?: TypeMappingFunction<ConstrainedObjectModel, TypeScriptOptions, TypeScriptDependencyManager> | undefined; ... 10 more ...; Dictionary?: TypeMappingFunction<...> | undefined; }
      • Optional useJavascriptReservedKeywords?: boolean

        Use JS reserved keywords so the TS output models can easily be transpiled to JS

    Returns Promise<RenderOutput>

  • Parameters

    • model: ConstrainedMetaModel
    • inputModel: InputMetaModel
    • Optional options: {
          constraints?: { enumKey?: EnumKeyConstraint<TypeScriptOptions> | undefined; enumValue?: EnumValueConstraint<TypeScriptOptions> | undefined; modelName?: ModelNameConstraint<...> | undefined; propertyKey?: PropertyKeyConstraint<...> | undefined; constant?: ConstantConstraint<...> | undefined; };
          defaultPreset?: { class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; type?: { ...; ...;
          dependencyManager?: (() => TypeScriptDependencyManager) | ({ options?: { renderTypes?: boolean | undefined; modelType?: "class" | "interface" | undefined; enumType?: "enum" | "union" | undefined; mapType?: "map" | "record" | "indexedObject" | undefined; ... 9 more ...; dependencyManager?: (() => TypeScriptDependencyManager) | ... 1 more ... | undefined; } | undefined; ... 5...);
          enumType?: "enum" | "union";
          indentation?: { type?: IndentationTypes | undefined; size?: number | undefined; };
          mapType?: "map" | "record" | "indexedObject";
          modelType?: "class" | "interface";
          moduleSystem?: TypeScriptModuleSystemType;
          presets?: (undefined | ({ class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; type?: { ...; ...) | ({ preset?: { class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; typ...))[];
          processorOptions?: { asyncapi?: { source?: string | undefined; applyTraits?: boolean | undefined; parseSchemas?: boolean | undefined; validateOptions?: { allowedSeverity?: { error?: boolean | undefined; warning?: boolean | undefined; info?: boolean | undefined; hint?: boolean | undefined; } | undefined; __unstable?: { ...; } | undefin...;
          rawPropertyNames?: boolean;
          renderTypes?: boolean;
          typeMapping?: { Object?: TypeMappingFunction<ConstrainedObjectModel, TypeScriptOptions, TypeScriptDependencyManager> | undefined; ... 10 more ...; Dictionary?: TypeMappingFunction<...> | undefined; };
          useJavascriptReservedKeywords?: boolean;
      }
      • Optional constraints?: { enumKey?: EnumKeyConstraint<TypeScriptOptions> | undefined; enumValue?: EnumValueConstraint<TypeScriptOptions> | undefined; modelName?: ModelNameConstraint<...> | undefined; propertyKey?: PropertyKeyConstraint<...> | undefined; constant?: ConstantConstraint<...> | undefined; }
      • Optional defaultPreset?: { class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; type?: { ...; ...
      • Optional dependencyManager?: (() => TypeScriptDependencyManager) | ({ options?: { renderTypes?: boolean | undefined; modelType?: "class" | "interface" | undefined; enumType?: "enum" | "union" | undefined; mapType?: "map" | "record" | "indexedObject" | undefined; ... 9 more ...; dependencyManager?: (() => TypeScriptDependencyManager) | ... 1 more ... | undefined; } | undefined; ... 5...)

        This dependency manager type serves two functions.

        1. It can be used to provide a factory for generate functions
        2. It can be used to provide a single instance of a dependency manager, to add all dependencies together

        This depends on context and where it's used.

      • Optional enumType?: "enum" | "union"
      • Optional indentation?: { type?: IndentationTypes | undefined; size?: number | undefined; }
      • Optional mapType?: "map" | "record" | "indexedObject"
      • Optional modelType?: "class" | "interface"
      • Optional moduleSystem?: TypeScriptModuleSystemType
      • Optional presets?: (undefined | ({ class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; type?: { ...; ...) | ({ preset?: { class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; typ...))[]
      • Optional processorOptions?: { asyncapi?: { source?: string | undefined; applyTraits?: boolean | undefined; parseSchemas?: boolean | undefined; validateOptions?: { allowedSeverity?: { error?: boolean | undefined; warning?: boolean | undefined; info?: boolean | undefined; hint?: boolean | undefined; } | undefined; __unstable?: { ...; } | undefin...
      • Optional rawPropertyNames?: boolean

        Use raw property names instead of constrained ones, where you most likely need to access them with obj["propertyName"] instead of obj.propertyName

      • Optional renderTypes?: boolean
      • Optional typeMapping?: { Object?: TypeMappingFunction<ConstrainedObjectModel, TypeScriptOptions, TypeScriptDependencyManager> | undefined; ... 10 more ...; Dictionary?: TypeMappingFunction<...> | undefined; }
      • Optional useJavascriptReservedKeywords?: boolean

        Use JS reserved keywords so the TS output models can easily be transpiled to JS

    Returns Promise<RenderOutput>

  • Returns the TypeScript options by merging custom options with default ones.

    Parameters

    • Optional options: {
          constraints?: { enumKey?: EnumKeyConstraint<TypeScriptOptions> | undefined; enumValue?: EnumValueConstraint<TypeScriptOptions> | undefined; modelName?: ModelNameConstraint<...> | undefined; propertyKey?: PropertyKeyConstraint<...> | undefined; constant?: ConstantConstraint<...> | undefined; };
          defaultPreset?: { class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; type?: { ...; ...;
          dependencyManager?: (() => TypeScriptDependencyManager) | ({ options?: { renderTypes?: boolean | undefined; modelType?: "class" | "interface" | undefined; enumType?: "enum" | "union" | undefined; mapType?: "map" | "record" | "indexedObject" | undefined; ... 9 more ...; dependencyManager?: (() => TypeScriptDependencyManager) | ... 1 more ... | undefined; } | undefined; ... 5...);
          enumType?: "enum" | "union";
          indentation?: { type?: IndentationTypes | undefined; size?: number | undefined; };
          mapType?: "map" | "record" | "indexedObject";
          modelType?: "class" | "interface";
          moduleSystem?: TypeScriptModuleSystemType;
          presets?: (undefined | ({ class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; type?: { ...; ...) | ({ preset?: { class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; typ...))[];
          processorOptions?: { asyncapi?: { source?: string | undefined; applyTraits?: boolean | undefined; parseSchemas?: boolean | undefined; validateOptions?: { allowedSeverity?: { error?: boolean | undefined; warning?: boolean | undefined; info?: boolean | undefined; hint?: boolean | undefined; } | undefined; __unstable?: { ...; } | undefin...;
          rawPropertyNames?: boolean;
          renderTypes?: boolean;
          typeMapping?: { Object?: TypeMappingFunction<ConstrainedObjectModel, TypeScriptOptions, TypeScriptDependencyManager> | undefined; ... 10 more ...; Dictionary?: TypeMappingFunction<...> | undefined; };
          useJavascriptReservedKeywords?: boolean;
      }
      • Optional constraints?: { enumKey?: EnumKeyConstraint<TypeScriptOptions> | undefined; enumValue?: EnumValueConstraint<TypeScriptOptions> | undefined; modelName?: ModelNameConstraint<...> | undefined; propertyKey?: PropertyKeyConstraint<...> | undefined; constant?: ConstantConstraint<...> | undefined; }
      • Optional defaultPreset?: { class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; type?: { ...; ...
      • Optional dependencyManager?: (() => TypeScriptDependencyManager) | ({ options?: { renderTypes?: boolean | undefined; modelType?: "class" | "interface" | undefined; enumType?: "enum" | "union" | undefined; mapType?: "map" | "record" | "indexedObject" | undefined; ... 9 more ...; dependencyManager?: (() => TypeScriptDependencyManager) | ... 1 more ... | undefined; } | undefined; ... 5...)

        This dependency manager type serves two functions.

        1. It can be used to provide a factory for generate functions
        2. It can be used to provide a single instance of a dependency manager, to add all dependencies together

        This depends on context and where it's used.

      • Optional enumType?: "enum" | "union"
      • Optional indentation?: { type?: IndentationTypes | undefined; size?: number | undefined; }
      • Optional mapType?: "map" | "record" | "indexedObject"
      • Optional modelType?: "class" | "interface"
      • Optional moduleSystem?: TypeScriptModuleSystemType
      • Optional presets?: (undefined | ({ class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; type?: { ...; ...) | ({ preset?: { class?: { ctor?: ((args: PresetArgs<ClassRenderer, any, ConstrainedObjectModel>) => string | Promise<string>) | undefined; ... 4 more ...; additionalContent?: ((args: PresetArgs<...>) => string | Promise<...>) | undefined; } | undefined; interface?: { ...; } | undefined; enum?: { ...; } | undefined; typ...))[]
      • Optional processorOptions?: { asyncapi?: { source?: string | undefined; applyTraits?: boolean | undefined; parseSchemas?: boolean | undefined; validateOptions?: { allowedSeverity?: { error?: boolean | undefined; warning?: boolean | undefined; info?: boolean | undefined; hint?: boolean | undefined; } | undefined; __unstable?: { ...; } | undefin...
      • Optional rawPropertyNames?: boolean

        Use raw property names instead of constrained ones, where you most likely need to access them with obj["propertyName"] instead of obj.propertyName

      • Optional renderTypes?: boolean
      • Optional typeMapping?: { Object?: TypeMappingFunction<ConstrainedObjectModel, TypeScriptOptions, TypeScriptDependencyManager> | undefined; ... 10 more ...; Dictionary?: TypeMappingFunction<...> | undefined; }
      • Optional useJavascriptReservedKeywords?: boolean

        Use JS reserved keywords so the TS output models can easily be transpiled to JS

    Returns TypeScriptOptions

Generated using TypeDoc