top | item 33139552

(no title)

matt89 | 3 years ago

In my opinion the most important factor was that it is a superset of JS and any valid Javascript code is/was valid TS code. That allowed for gradual adoption and you didn't have to risk going all-in into new technology.

discuss

order

ly3xqhl8g9|3 years ago

Also the `any` type [1]. It makes porting an existing project ridiculously easy: just type everything as `any`, and it also gives freedom to the developer to think in code when developing, trusting that they (will) know what they are doing, instead of screaming at the smallest mis-type with annoying bright red squiggly lines.

It is so liberating to type a variable as `any` when sketching new code, figuring things out, that I would venture to say that any language not having the `any` type actually actively hates the developer.

[1] https://www.typescriptlang.org/docs/handbook/2/everyday-type...

kuramitropolis|3 years ago

And then you have to contribute to a codebase with restrictive ESLint (bleurgh!) configuration, so you can't even try out whether your code works because the tooling disallows you from compiling it as long as it contains "any", and the other devs are like "but muh best practices". So not only you gotta work around TS, you gotta do it invisibly. How did people even live before VSCode's type hint popups covered up the previous line?

kuramitropolis|3 years ago

TS is emphatically not a superset of JS. It rejects perfectly valid JS leaving you no recourse other than design your whole architecture around what TypeScript allows. Which is what Microsoft wants of course.

uup|3 years ago

That’s not true. You can import JS directly into TS or use ts-ignore annotations.