4 ms·
It makes the types available in runtime. You can take a look at the current WIP version of the new upcoming Deepkit book which explains it in great detail: http
by primering 4y ago
It makes the types available in runtime. You can take a look at the current WIP version of the new upcoming Deepkit book which explains it in great detail: https://deepkit-book.herokuapp.com https://deepkit-book.herokuapp.com
See section "2. Runtime Types"
- rattray 4y agoThanks – the question I had was answered in the "Bytecode" part of that section: https://deepkit-book.herokuapp.com/deepkit-book-english.html#_bytecode https://deepkit-book.herokuapp.com/deepkit-book-english.html... My summary is that the DeepKit compiler is a JS transpiler (used as a ts-node or webpack plugin, or conveniently/invasively as a replacement of node_modules/typescript) that produces code like this: //TypeScript export type TypeA = string[]; //generated JavaScript export const __ΩtypeA = ['&F']; //TypeScript function log(message: string): void {} //generated JavaScript function log(message) {} log.__type = ['message', 'log', 'P&2!$/"']; Where '&F' and 'P&2!$/"' are the compact bytecode translations of the types ("&" means string, "F" means array) and '__Ω' is a prefix used to avoid naming conflicts. Personally, I'd love to see a live example of code in & compiled code out on the homepage. I'm sure it's on your roadmap :)