DEV Community

loading...

Discussion on: Static Typing or Typescript

Collapse
lukewestby profile image
Luke Westby

Something that I think gets overlooked in types vs no types is that you need a typed language if you have very strict performance requirements. Rust code achieves the speed it is known for only because the compiler can choose the fastest set of instructions based on what it knows about the types.

Collapse
peerreynders profile image
peerreynders • Edited

Just because there are types doesn't automatically imply that there is optimization for performance - which there isn't in TypeScript.

2017

Always bet on TypeScript

2020

Please don't open issues on JS repos asking why they aren't written in TypeScript :(

One of the reasons I find this an odd request is because I write my projects in JavaScript, but I generally type them.

Sure, it's TypeScript's checkJs option and JSDoc annotations, but it is typed.

TS is too indirect when file size is the primary constraint of a project, and I am completely unwilling to increase file size simply to make something strictly typed. To me, that's not a worthwhile compromise.

That is probably why some teams want TypeScript's annotations to be compatible with Google's Closure Complier.

Annotating JavaScript for the Closure Compiler