-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(typescript): Add support explicit null values #5612
base: main
Are you sure you want to change the base?
Conversation
nullable: (optionalType) => | ||
this.getTemplateFromTypeReference({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optionalType
=> nullableType
@@ -405,6 +408,7 @@ export class GeneratedThrowingEndpointResponse implements GeneratedEndpointRespo | |||
literal: () => undefined, | |||
list: () => undefined, | |||
set: () => undefined, | |||
nullable: (optType) => this.getDefaultPaginationValue({ type: optType }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optType
=> nullableType
const _queryParams: Record<string, string | string[] | object | object[] | null> = {}; | ||
if (usernames != null) { | ||
if (Array.isArray(usernames)) { | ||
_queryParams["usernames"] = usernames.map((item) => item); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unrelated, but are we creating a copy of an array here? I think there are simpler ways to do this.
Now that the Fern definition supports
nullable
properties (re: #5601), this upgrades the TypeScript generator to IRv55 to support this feature. For example, consider the following Fern definition:The generated TypeScript types look like the following:
Note that this also temporarily disables the dynamic snippet tests so that we can more confidently test the TypeScript SDK generator until example generation is fixed.