3 ms·
> You will also need to use a tuntime dsl to describe the schema This is kind of the whole ballgame right? How would you do any of this with types if the schem
by camgunz 4y ago
> You will also need to use a tuntime dsl to describe the schema
This is kind of the whole ballgame right? How would you do any of this with types if the schema isn't defined until runtime?
- spion 4y agoI meant that since types are erased at compile-time in typescript, its much easier to make a schema description DSL that would then serve as the base to derive both the ORM DSL (runtime objects) and the types (compile time checks). If you go the types-first route, you will be forced to use proxies which can be more painful and constraining. The popular choice here is to use classes plus decorators, but its not the only choice https://typegraphql.com/docs/introduction.html#what https://typegraphql.com/docs/introduction.html#what The convenient bit here is that classes already have both a type and a runtime representation, and decorators are also available to attach any extra metadata necessary to that runtime representation