Hacker News new | ask | show | jobs
by w3news 1074 days ago
I always say, Typescript is no language but a dialect. JavaScript is the official language that will used in production. You can talk in a dialect, but for official things you have to write and talk the official language. Always think if the Typescript dialect will help your team, or it can cause confusion, e.g. after translation to the code that runs in production. (Error reporting, debugging, running tests, ...)

Javascript is easy to write and understand, easy to play with, without transpiling, e.g. in your browser. When you write code in the native language, you know what you write, how it will run on the system. When you write in Typescript, it generates some Javascript that is sometimes hard to recognize as your code.

1 comments

> When you write in Typescript, it generates some Javascript that is sometimes hard to recognize as your code.

Every time I have tried to compare the output of `tsc`, I have reached the opposite conclusion.

It's incredibly faithful most of the time. And when not, it's consistent. So if you understand why it does what it does once, life becomes much easier.

Perhaps you are referring to minified code. Even then, with source-maps correctly setup, I rarely if ever have a reason to leave TypeScript-land.

Without the type-checker, my productivity (and sanity!) would likely be cut in 1/2 or more.

I'd be very interested in examples that resulted in your opinion.