Closed escritorio-gustavo closed 6 months ago
Nice, thanks!
I never realized that inline_flattened
would just drop flattened fields. Amazing that the test suite didnt catch that.
Nice, thanks! I never realized that
inline_flattened
would just drop flattened fields. Amazing that the test suite didnt catch that.
Me neither! I only realized because I was looking at some old PRs and when I got to #206 I went "wtf was I thinking" lol
Goal
When a struct containing a flattened enum was itself flattened, the type generated would be missing the enum That is, the following code
Would generate the following TS:
When it should generate
Changes
Updated the generation of
inline_flattened
inmacros/src/types/named.rs
to be similar toinline
, except for not removing parenthesis around lonely flattened fields, as that caused issues when flattening a struct that contained only a flattened enum. (Thereplace(" } & { ", " ")
would merge the fields with the first enum variant)Checklist