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.

allowExtraFields
boolean

Whether response parsing keeps unrecognized object keys and accepts unrecognized union members and enum values.

exportAllRequestsAtRoot
boolean

Whether every request type is also exported from the package root.

generateSubpackageExports
boolean

Whether the package manifest exports each subpackage client as its own entry point.

generateEndpointMetadata
boolean

Whether generated clients expose metadata for each endpoint.

includeOtherInUnionTypes
boolean

Whether union types gain a member for variants the SDK doesn’t recognize.

includeUtilsOnUnionMembers
boolean

Whether helper utilities are generated on each member of a union type.

neverThrowErrors
boolean

Whether client methods return a wrapped response instead of throwing on a non-2xx status.

omitFernHeaders
boolean

Whether requests omit the SDK identification headers and the User-Agent header.

outputEsm
boolean

Whether the package is marked as an ES module while still shipping its CommonJS build.

formDataSupport
"Node16" | "Node18"

The multipart form-data implementation: Node16 uses the form-data packages, Node18 uses the platform FormData.

formatter
"prettier" | "biome" | "oxfmt" | "none"

The formatter configured in the generated project.

linter
"biome" | "oxlint" | "none"

The linter configured in the generated project.

lintStaged
object

lint-staged commands to run, keyed by file glob.

exports
object

package.json exports entries, keyed by subpath, applied over the generated exports. Each entry replaces the generated entry for the same subpath.

files
list of string

package.json files entries, listed ahead of the generated ones.

engines
object

package.json engines version ranges, keyed by engine name such as node.

browser
object

package.json browser field: excludes a module or file (false) or replaces it with another path.

scripts
list of object

Additional scripts added to the generated package manifest.