DEV Community

Discussion on: 10 reasons why you should use Typescript

Collapse
aleksandrhovhannisyan profile image
Aleksandr Hovhannisyan

Not an official TC39 specification.

This is like saying Sass/Less/CSS preprocessors shouldn't be used because they're not mentioned in the official CSS specs. I don't see how that's relevant. TypeScript is an extension of JavaScript. It supports everything JavaScript does, but it extends the language statically. Types get stripped out at build time, and most other features get transpiled to spec-compliant JS.

It doesn't actually make your code easier to read. It creates more code.

I strongly disagree. Types require writing more code, yes, but that's not inherently a bad thing. Static type-checking means your code is easier to read because it enforces a strict contract for method signatures and variable types. You don't have to guess what values a particular function accepts. You also don't have to worry about devs on your team making silly typos.

If the architecture is made by a hype/resume driven engineer the code is essentially unreadable.

I don't know what this means, but based on your responses to others in this thread, it seems you associate TypeScript usage with being a "hype-driven engineer"? Lots of companies are moving their code bases to TypeScript for a good reason—not because it's a fad but because it's much more maintainable than untyped JS.

Typescript was introduced, in order to allure to C# and back end developers.

I don't know where you're getting this from, but I've never heard this. TypeScript was introduced to add static typing to JS.

Generics, tuples etc. are not part of JS specification. JS is NOT an OOP programming language.

Again, why does this matter? Higher-level languages and abstractions will always exist. TypeScript extends JavaScript with new features. You just have to learn how to use them. "It's not in the specification" sounds like an excuse to not learn TypeScript.

Usefulness of TS is for code completion when writing code but ajax calls might give you unpredictable data. Their isn't a runtime types feature.

Right, but TypeScript does not market itself as run-time type checking, so this point is moot. JavaScript also does not perform any runtime type-checking. It's always your responsibility to check that run-time data has the correct shape, regardless of whether you're using a statically or dynamically typed language.

Extra dependecy from npm and all the @types you will install as well. Extra transpilation as well if you also use babel.

Types get stripped out from production code. Most packages that are written in TS already come with types and don't require a separate @types installation.

You will eventually "fight" against the language trying to figure out why the linter is showing you cryptic errors.

Or, you'll learn to love TypeScript for helping you avoid problems that are incredibly frustrating to debug in vanilla JS.