You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A project to turn a file of JSON responses into TypeScript types
Warning on code
I haven't really tried to organize this code. I made this code strictly as i
learned more about the problem space. So the code looks like exploratory code,
not production ready code.
To me, it seems like there is going to be a several pass compiler for this to
be a real deal here.
I am unsure how much i want to pursue this beyond my needs
My needs have been met, i am unsure if I want to pursue this much further.
If anyone is interested in this, i can certainly help you get ramped up,
whisper me twitter
Union Collapsing is really hard...
Its currently disabled because its creating incorrect types. But i think i am
pretty dang close to it being correct.
Why create this?
I have a new database at Netflix with +100 unique events without definitions.
I will define them...
Here is a reason for why you could use it:
You have too many JSON objects to develop types for other than naming.
You can specify what fields need to be lifted into enums. I make the assumption
that enums are likely string values (though there is a case for me to fix this,
PRs will be merged with little regard)
This will take any top level fields on objects and attempt to pull out the
values, convert it into an enum, put at top of definitions, and replace their
type (usually string) as the enum.
There is an issue
Fix it and make a PR. The code is shitty because I rage wrote it all in ~1 hour on twitch.