Closed rlcurrall closed 5 months ago
Hey @rlcurrall, thanks for this :)
Does the TS output resemble how serde serializes the object exactly?
@Wulf, sorry for the delay in response!
I've created some examples to show what the functionality is, here's an example with an nested struct being flattened:
I think nested enums are a bit more interesting when flattened as you can see here:
One thing to note is that serde allows for you to flatten a record that has overlapping keys as you can see here. Not sure if we should, or even care to handle this case differently than serde, but something to note.
hey @rlcurrall really sorry to have left this hanging.
Thanks for the examples -- they helped clarify the functionality.
:rocket: I'll merge in your PR and cut a release :)
Currently the serde flatten attribute is not supported. It would be nice to have this code:
generate something like this:
Also, enum support would be ideal. I'm open to other options for how the outputted TS would look, I'm only suggesting the intersection type because it would be easier for it to work with enums since they are usually defined with the
type
keyword.