Hacker News new | ask | show | jobs
by micheleriva 1423 days ago
Disclaimer: Lyra author here!

The biggest problem I have with TypeScript is to know WHAT .ts files will be compiled into. I.e., if you're using enums or decorators, there's no plain support for them in JS so you'll end up having some kind of "polyfills", which are not so optimized.

Once you analyze your compiled JS, you can write TS knowing what you're gonna get, which is the trick to make it optimized.

My two cents :)

2 comments

The trick there is to not use enums or decorators! In all seriousness, I believe it’s common for typescript codebases to eschew these features, precisely because it’s hard to reason about the generated code (and preferable to avoid features that aren’t on an ECMAScript standards track.
Enums compile down to pretty standard objects right? Is there a situation in which you found them to do something odd?

Decorators, yeah, I can imagine that’d end up interesting.