3 ms·
Lots of TypeScript features generate code: namespace, async/await, yield, decorators, object spread, varargs, etc.* `const enums` (beyond enums) are especially
by paulddraper 2y ago
Lots of TypeScript features generate code: namespace, async/await, yield, decorators, object spread, varargs, etc.*
`const enums` (beyond enums) are especially odd. They rely on type information to emit code.
* Subsequent to their release in TypeScript, EcmaScript versions now support some of these.
- wk_end 2y agoSo, since they're now a part of JS - aside from namespaces and enums (which are discouraged) - none of those features generate code anymore. Moreover, aside from namespaces and enums (which are discouraged), none of those features were incorporated into TypeScript until they were on track for inclusion into JS. They weren't taken from TypeScript and imported into JS; TypeScript took them from the ECMAScript people. Being able to compile TypeScript by just stripping types has become a design principle of the language. For better or for worse, the TypeScript team steadfastly refuses to try to innovate on runtime language features at this point.
- paulddraper 2y agoDecorators and decorator metadata. > For better or for worse, the TypeScript team steadfastly refuses to try to innovate on runtime language features at this point. Yes, largely because ECMAScript has advanced so far relatively to where it used to be.