DEV Community

Discussion on: How I began using TypeScript

Collapse
 
thethirdrace profile image
TheThirdRace

This article would have greately benefinited from more research and proof-reading.

The amount of misinformation is simply staggering...

you can use all of the features of JavaScript, plus additional features that are not available in JavaScript. These include things like type annotations, classes, interfaces, and modules.

classes and modules are Javascript features, not Typescript.

TypeScript is designed for development of large-scale applications

You can use it just as well for very small apps too, there's no limitation

Another reason to use TypeScript is that it makes your code more organized and easier to maintain. This is because TypeScript uses modules and namespaces to group related code together. This makes it easy to find the code you're looking for and helps prevent name collisions between different pieces of code.

Typescript doesn't make your code more organized. You can definitely develop a Typescript program that is screwed up from top to bottom. Typescript only does what you tell it to.

Also, Typescript official documentation suggests using module over namespace. From what I could read about namespace, I would be very worried about how tree-shakeable it is, which is probably not at all, and it most likely will polute the global space, which is an absolute no no...

Another benefit of using TypeScript is that it can help you become more productive. This is because TypeScript speeds up development by providing things like autocompletion

I'm pretty sure Javascript has that too... And that would be the IDE providing that, not the language itself.

TypeScript helps you avoid common software development pitfalls such as tight coupling and global state.

It's like saying a pen is helping you write better essays... the tool definitely doesn't prevent you from screwing yourself up...

Another difficulty I've encountered is that TypeScript can be picky about code style. This can make it difficult to integrate TypeScript into an existing codebase that uses a different code style.

Typescript doesn't care one bit about your code style. I have no idea where you got that from...

For example, if your codebase uses tabs for indentation and TypeScript expects spaces, you'll get errors.

Again, Typescript doesn't care one bit about your code style. I use tabs in Typescript without any problems whatsoever, I can use tabs and spaces on the same line too if I want... are you sure you're not confusing Typescript with eslint?

I've found that using TypeScript can slow down development due to its compile-time type checking. This means that every time you make a change to your code, you have to wait for the TypeScript compiler to run before you can see the results. This can be frustrating when you're used to the instant feedback of interpreted languages like JavaScript.

This is somewhat true and false at the same time. Yes, Typescript is slower than Javascript because it needs to compile, but we're talking of less than a 1 second difference... Most of the tools will instantly refresh your browser page automatically and you might even keep the state intact.

To qualify that of slow down is splitting hair at best.