feat: Support variants of union-style enums#1426
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
7af0ecc to
63b9d8c
Compare
mrousavy
commented
Jun 30, 2026
| type: TSMorphType, | ||
| isOptional: boolean | ||
| isOptional: boolean, | ||
| typeNode?: TypeNode |
Owner
Author
There was a problem hiding this comment.
I really don't like the fact that we have to pass in a new optional parameter (TypeNode) here now. This seems super hacky.
But not sure if we can do anything to prevent this tbh.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for creating Variants of union-style enums as well.
Example:
Previously, this would've flattened
inputtoCameraDevice | 'front' | 'back' | 'external'and therefore threw:- ❌ Failed to generate spec for CameraSession! Error: String literal "external" cannot be represented in C++ because it is ambiguous between a string and a discriminating union enum.Now this properly preserves the
CameraPositionunion type, and generates the variant properly.