-
Notifications
You must be signed in to change notification settings - Fork 168
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
Conversation
...class-generator/src/endpoints/default/endpoint-response/GeneratedThrowingEndpointResponse.ts
Outdated
Show resolved
Hide resolved
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.
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.
Yea it looks like it - I have a feeling this is because we always map over the array values and (optionally) perform a string
mapper function (e.g. item.toString()
), so it's simpler to always use the .map
expression.
We can take a closer look here though.
…ern into amckinney/typescript-nullable
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.