Skip to navigation

TypeScript configuration

View as Markdown

Configure the TypeScript SDK in the generation block of its target in sdk-config.yml:

sdk-config.yml
targets:
- language: typescript
generation:
naming:
clientName: YourClientName
namespaceExportName: AcmePayments
packageManager: pnpm
testFramework: jest

The target’s generation block also accepts the shared generation options, such as naming, wireTests, and customCode. Shared options set in the top-level generation block apply to every target, and a target’s generation block overrides them. For generators.yml options, see the Legacy TypeScript configuration.

TypeScript options

typescriptVersion
string

The TypeScript version used by the generated project.

zodVersion
string

The Zod version used by generated runtime schemas.

compilerOptions
object

TypeScript compiler options for the generated project.

compilerOptions.target
string

The JavaScript language target passed to TypeScript.

compilerOptions.module
string

The module format passed to TypeScript.

compilerOptions.lib
list of string

The runtime library definitions passed to TypeScript.

httpClient
object

The HTTP client used by generated TypeScript code.

<ParamField path=“httpClient.name” type=""axios” | “fetch"" required= toc=> The HTTP client used by generated TypeScript code. </ParamField>

<ParamField path=“packageManager” type=""pnpm” | “yarn"" required= toc=> The package manager used by the generated project. </ParamField>

packageManagerVersion
string

The package manager version used by the generated project.

<ParamField path=“testFramework” type=""jest” | “vitest"" required= toc=> The test framework used by generated tests. </ParamField>

<ParamField path=“namingStrategy” type=""base” | “originalPropertyNames"" required= toc=> How schema property names are converted into TypeScript identifiers. </ParamField>

bundle
boolean

Whether the generated package includes bundled output.

exportClassDefault
boolean

Whether the client class is also exported as the default export.

namespaceExportName
string

The top-level namespace export name.

consolidateTypeFiles
boolean

Whether generated types are consolidated into fewer source files.

allowCustomFetcher
boolean

Whether callers can supply a custom fetch implementation.

useBrandedStringAliases
boolean

Whether string aliases are emitted as distinct branded types.

useLegacyExports
boolean

Whether the package emits the legacy export layout.

useBigInt
boolean

Whether 64-bit integer values are represented with bigint.

serdeLayer
boolean

Whether generated models use Fern serialization and deserialization helpers.

esmOnly
boolean

Whether the package emits only ECMAScript modules.

scripts
list of object

Additional scripts added to the generated package manifest.