TypeScript Target Configuration
To configure TypeScript target, use [ts] in genotype.toml.
This configuration reference lists all available TypeScript configuration options.
See the Genotype Configuration for global settings and Common Target Options.
ts.enabled - Enable Target
Section titled “ts.enabled - Enable Target”Set to true to generate TypeScript. Defaults to false; see enable target.
[ts]enabled = trueGeneration
Section titled “Generation”ts.mode - Generation Mode
Section titled “ts.mode - Generation Mode”mode selects what Genotype generates:
"types"(default): TypeScript type definitions."zod": Zod schemas and inferred types for runtime validation. Adds Zod to the generated package’s dependencies.
[ts]enabled = truemode = "zod"See the TypeScript guide for generated code examples.
ts.prefer - Interfaces or Type Aliases
Section titled “ts.prefer - Interfaces or Type Aliases”prefer selects how object type definitions are rendered in types mode:
"interface"(default): Generate interfaces, e.g.,interface Book { ... }."alias": Generate type aliases, e.g.,type Book = { ... }.
[ts]enabled = trueprefer = "alias"ts.ext - Import Extensions
Section titled “ts.ext - Import Extensions”ext selects the extension used in generated local imports and re-exports:
"js"(default): JavaScript extensions, e.g.,"./book.js"."ts": TypeScript extensions, e.g.,"./book.ts"."none": No extension, e.g.,"./book".
[ts]enabled = trueext = "none"Generated source files always have the .ts extension.
[ts.naming] - Source File and Directory Names
Section titled “[ts.naming] - Source File and Directory Names”naming.source_file controls generated file names. It defaults to "camelCase".
naming.source_dir controls generated directory names. When omitted, it follows naming.source_file.
Both accept:
"camelCase""PascalCase""snake_case""kebab-case"
[ts.naming]source_file = "camelCase"source_dir = "kebab-case"This turns shop_goods/order_item.type into shop-goods/orderItem.ts. Generated local import paths use the same naming rules.
Package
Section titled “Package”ts.package - Package Generation
Section titled “ts.package - Package Generation”Overrides package generation for TypeScript. Inherits the global setting when omitted; see target package generation.
ts.dist - Output Directory
Section titled “ts.dist - Output Directory”Defaults to "ts", relative to the global output directory. See target output directory.
[ts.manifest] - package.json
Section titled “[ts.manifest] - package.json”Manifest options in [ts.manifest] become fields in package.json. Package name and version overrides go directly in that table:
[ts.manifest]name = "@bookstore/types"version = "0.2.0"private = true
[ts.manifest.dependencies]"@bookstore/shared-types" = "^1.0.0"The generated package uses ES modules, with source files under src and an index.ts entry point. Its default name uses kebab-case. See package generation for layout controls.
[ts.tsconfig] - tsconfig.json
Section titled “[ts.tsconfig] - tsconfig.json”tsconfig is an optional table written as tsconfig.json in the TypeScript package directory. When omitted, no tsconfig.json is generated:
[ts.tsconfig]include = ["src/**/*.ts"]
[ts.tsconfig.compilerOptions]strict = truenoEmit = truemodule = "NodeNext"moduleResolution = "NodeNext"The table is converted directly to JSON, without adding compiler option defaults. It has no effect when package generation is disabled.
Modules
Section titled “Modules”[ts.dependencies] - External Modules
Section titled “[ts.dependencies] - External Modules”Values in external modules are JavaScript package import paths:
[ts.dependencies]shared_types = "@bookstore/shared-types"Formatting
Section titled “Formatting”ts.formatters - Formatters
Section titled “ts.formatters - Formatters”Adds formatters for TypeScript; defaults to []. See target formatters for execution order and formatter configuration for commands and presets.