Skip to content

Commit d74f3f6

Browse files
docs(sdks): document exactOptionalPropertyTypes TypeScript generator option
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent cc486b4 commit d74f3f6

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

fern/products/sdks/generators/typescript/configuration.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,18 @@ const bar: MyRootType.Foo.Bar = {};
8888
```
8989
</ParamField>
9090

91+
<ParamField path="exactOptionalPropertyTypes" type="boolean" default="false" toc={true}>
92+
When enabled, every optional property in the generated SDK is emitted as `prop?: T | undefined`, and the generated `tsconfig` files enable TypeScript's [`exactOptionalPropertyTypes`](https://www.typescriptlang.org/tsconfig/#exactOptionalPropertyTypes) compiler option. This covers model types, inlined request types, client options, errors, and the `core/` utilities, so consumers whose own `tsconfig` sets `exactOptionalPropertyTypes: true` can use the SDK without type errors.
93+
94+
This option applies with or without the serde layer, so it can be combined with either value of [`noSerdeLayer`](#noserdelayer).
95+
96+
```yaml
97+
# generators.yml
98+
config:
99+
exactOptionalPropertyTypes: true
100+
```
101+
</ParamField>
102+
91103
<ParamField path="extraDependencies" type="object" default="{}" toc={true}>
92104

93105
<Markdown src="/snippets/enterprise-plan.mdx"/>

0 commit comments

Comments
 (0)