2 ms·
I could imagine working on very complex static JSON. You want to type-check selections and transformations on this JSON. It's a very niche use-case, this is de
by williamdclt 6y ago
I could imagine working on very complex static JSON. You want to type-check selections and transformations on this JSON.
It's a very niche use-case, this is definitely more of an impressive showcase of the new Template Literal Types feature of TS :)
- ricksharp 6y agoYou can import a json document directly into typescript and the entire document is a readonly constant type of the entire json object literal. I've used this with a template JSON document that has an instance of all possible types in the runtime json. Sometimes you might have to loosen the type slightly, but it works great for a quick start.