Skip to content

Commit cdbd4c8

Browse files
committed
Remove config page from this PR, will add in a different one.
1 parent c6078c0 commit cdbd4c8

File tree

1 file changed

+2
-141
lines changed

1 file changed

+2
-141
lines changed

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

Lines changed: 2 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -3,145 +3,6 @@ title: Typescript Configuration
33
description: Configuration options for the Fern Typescript SDK.
44
---
55

6-
Configure the Fern Typescript SDK for your project.
7-
8-
9-
You can customize the behavior of generators in `generators.yml`:
10-
11-
```yml
12-
default-group: local
13-
groups:
14-
local:
15-
generators:
16-
- name: fernapi/fern-typescript-node-sdk
17-
version: 0.7.1
18-
config:
19-
useBrandedStringAliases: true
20-
```
21-
22-
### SDK Configuration
23-
24-
The SDK generator support the following parameters:
25-
26-
27-
<ParamField path="useBrandedStringAliases" type="boolean" default="false">
28-
When enabled, string aliases are generated as branded strings. This makes each alias feel like its own type and improves compile-time safety.
29-
30-
```yaml
31-
# fern definition
32-
33-
types:
34-
MyString: string
35-
OtherString: string
36-
```
37-
38-
```typescript
39-
// generated code
40-
41-
export type MyString = string & { __MyString: void };
42-
export const MyString = (value: string): MyString => value as MyString;
43-
44-
export type OtherString = string & { __OtherString: void };
45-
export const OtherString = (value: string): OtherString => value as OtherString;
46-
```
47-
48-
```typescript
49-
// consuming the generated type
50-
51-
function printMyString(s: MyString): void {
52-
console.log("MyString: " + s);
53-
}
54-
55-
// doesn't compile, "foo" is not assignable to MyString
56-
printMyString("foo");
57-
58-
const otherString = OtherString("other-string");
59-
// doesn't compile, otherString is not assignable to MyString
60-
printMyString(otherString);
61-
62-
// compiles
63-
const myString = MyString("my-string");
64-
printMyString(myString);
65-
```
66-
67-
When `useBrandedStringAliases` is disabled (the default), string aliases are generated as
68-
normal TypeScript aliases:
69-
70-
```typescript
71-
// generated code
72-
73-
export type MyString = string;
74-
75-
export type OtherString = string;
76-
```
77-
</ParamField>
78-
79-
<ParamField path="neverThrowErrors" type="boolean" default="false">
80-
When enabled, the client doesn't throw errors when a non-200 response is received from the server. Instead, the response is wrapped in an [`ApiResponse`](packages/core-utilities/fetcher/src/APIResponse.ts).
81-
82-
```typescript
83-
const response = await client.callEndpoint(...);
84-
if (response.ok) {
85-
console.log(response.body)
86-
} else {
87-
console.error(respons.error)
88-
}
89-
```
90-
</ParamField>
91-
92-
<ParamField path="namespaceExport" type="string">
93-
Customizes the exported namespace and client names. By default, names are based on the organization and API names in the Fern Definition.
94-
</ParamField>
95-
96-
<ParamField path="outputEsm" type="boolean" default="false">
97-
By default, the generated TypeScript targets CommonJS. Set to true to target esnext instead.
98-
</ParamField>
99-
100-
<ParamField path="outputSourceFiles" type="boolean" default="false">
101-
When enabled, the generator outputs raw TypeScript files. When disabled (the default), outputs .js and d.ts files. Note: Only applies when dumping code locally.
102-
</ParamField>
103-
104-
<ParamField path="includeCredentialsOnCrossOriginRequests" type="boolean" default="false">
105-
When enabled, withCredentials is set to true when making network requests.
106-
</ParamField>
107-
108-
<ParamField path="allowCustomFetcher" type="boolean" default="false">
109-
When enabled, the generated client allows the end user to specify a custom fetcher implementation.
110-
</ParamField>
111-
112-
<ParamField path="requireDefaultEnvironment" type="boolean" default="false">
113-
When enabled, the generated client doesn't allow the user to specify a server URL.
114-
</ParamField>
115-
116-
<ParamField path="defaultTimeoutInSeconds" type="number" default="60">
117-
The default timeout for network requests. In the generated client, this can be overridden at the request level.
118-
</ParamField>
119-
120-
<ParamField path="skipResponseValidation" type="boolean" default="false">
121-
By default, the client will throw an error if the response from the server doesn't match the expected type. If enabled, the client will log issues using console.warn and return the data casted to the expected response type.
122-
</ParamField>
123-
124-
<ParamField path="extraDependencies" type="object" default="{}">
125-
Specify extra dependencies in the generated package.json. Useful when utilizing .fernignore to supplement the generated client with custom code. Note: Only applies when publishing to Github.
126-
</ParamField>
127-
128-
<ParamField path="extraDevDependencies" type="object" default="{}">
129-
Specify extra dev dependencies in the generated package.json. Note: Only applies when publishing to Github.
130-
</ParamField>
131-
132-
<ParamField path="treatUnknownAsAny" type="boolean" default="false">
133-
When enabled, unknown types from Fern are generated into TypeScript using any instead of the unknown type.
134-
</ParamField>
135-
136-
<ParamField path="noSerdeLayer" type="boolean" default="false">
137-
When enabled, no serialization/deserialization code is generated. The client uses JSON.parse() and JSON.stringify() instead of the default serde layer that provides validation and complex type support.
138-
</ParamField>
139-
140-
<ParamField path="noOptionalProperties" type="boolean" default="false">
141-
When enabled, optional properties are generated with | undefined instead of optional TypeScript properties (using ?).
142-
</ParamField>
143-
144-
<ParamField path="retainOriginalCasing" type="boolean" default="false">
145-
When enabled, property names in the generated code will retain their original casing from the API definition instead of being converted to camelCase.
146-
</ParamField>
6+
# Typescript Configuration
1477

8+
Discover how to configure the Fern Typescript SDK for your project.

0 commit comments

Comments
 (0)