You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: update wrapper client to accept all FernClient options
- Use ConstructorParameters to infer exact options type from generated client
- Accept all client options (headers, timeout, maxRetries, etc.) except fetcher
- Extract privateKey and pass remaining options to parent constructor
- Add explanatory note about ConstructorParameters pattern
- Update both custom fetcher and method override examples for consistency
Addresses Swimburger's feedback about dynamically passing all options.
Co-Authored-By: Chris McDonnell <[email protected]>
// Extract privateKey and pass all other options to the parent
93
+
const { privateKey, ...clientOptions } =options;
87
94
super({
88
-
environment: options.environment,
89
-
fetcher: createJwtFetcher(options.privateKey),
95
+
...clientOptions,
96
+
fetcher: createJwtFetcher(privateKey),
90
97
});
91
98
}
92
99
}
93
100
```
94
101
102
+
<Note>
103
+
This pattern uses `ConstructorParameters` to infer the exact options type from the generated client, ensuring compatibility with all client options (headers, timeoutInSeconds, maxRetries, etc.) without hardcoding them. This keeps the wrapper future-proof as the generator adds new options.
104
+
</Note>
105
+
95
106
### Export the wrapper client
96
107
97
108
Update your `index.ts` to export the wrapper instead of the generated client:
@@ -140,14 +151,16 @@ If you cannot enable `allowCustomFetcher` or prefer a simpler approach, you can
0 commit comments