#JSON to TS

5 messages · Page 1 of 1 (latest)

bleak drift
#

Hey all! I have a JSON doc that has an arbitrary number of properties (UUID).

I used QuickType CLI to extract types out of the document structure. However, by default each property “UUID” creates a new type, as the document has many optional fields. Is it possible to instead create one type, but using union types and nullable properties?

wind flint
#

well, you have some options regarding UUID so they aren't detected as litterals

#

but if you want to add multiple attributes with the same types but not the same name, there is no way for the tool to know that

#

you'll have to add it by hand

#

which is pretty easy to do