-
Notifications
You must be signed in to change notification settings - Fork 459
Support multiple types & update toJSON #2304
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
base: main
Are you sure you want to change the base?
Conversation
|
Thanks for the PR! This section of the codebase is owned by @saschanaz - if they write a comment saying "LGTM" then it will be merged. |
|
What do you think @lgarron |
src/build/patches.ts
Outdated
| function handleMultipleTypes( | ||
| typeNodes: Node[], | ||
| returns?: Value, | ||
| ): DeepPartial<Typed> | DeepPartial<Typed>[] | undefined { |
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.
It's DeepPartial<Typed> | undefined, no? It never returns an array.
And this function should be called handleTyped and the singular version should be called handleSingleTypeNode or something.
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.
Done
src/build/patches.ts
Outdated
| ...optionalMember("overrideType", "string", child.properties?.overrideType), | ||
| ...(typeNode | ||
| ? handleTyped(typeNode) | ||
| ? handleSingleTypeNode(typeNode) |
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.
Why? properties can have union types too. handleSingleTypeNode should not be called outside handleTyped.
src/build/patches.ts
Outdated
| const subType = | ||
| type.children.length > 0 ? handleTyped(type.children[0]) : undefined; | ||
| type.children.length > 0 | ||
| ? handleSingleTypeNode(type.children[0]) |
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.
And subtypes can be union too
|
Done |
|
|
||
| function handleTyped( | ||
| typeNodes: Node[], | ||
| returns?: Value, |
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.
returns? you mean property?
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.
Yes, I forgot to include it i will fix it
|
Better? |
fixes #2114