top | item 32799222

(no title)

blaydator | 3 years ago

Typescript doesn’t make sense if you don’t manipulate a lot of data or around the app. It can be a pain and lead to a lot of fatigue if don’t get benefits out of it. I am still using js for most of my personal front end projects, and still benefits from intellisense from libraries written in typescript even in standard .js file with VSCode and other IDEs. But 100% of my project uses Eslint (with « recommended » rules + eslint-config-prettier), this is absolutely a must have.

discuss

order

cageface|3 years ago

I very strongly disagree with this. Typescript is a lifesaver on a non-trivial React codebase. Writing correct code is hard and you need every advantage you can muster. Type checking is an important part of that.

ricardobayes|3 years ago

Look into nullish coalescing and optional chaining. Sure, vanilla JS or react doesn't help with using a var as a function, but I can probably count on my left hand how many times I tried to do that. That doesn't warrant a completely new language. ps.: typeof is also a thing in vanilla JS

blaydator|3 years ago

Totally agree, for non trivial project it totally makes sens, but for hobby project it doesn’t always make sens. Even less for beginners like OP.

cube00|3 years ago

That "pain and fatigue" is saving you from future bugs you'll inevitably pay for down the line.

Forcing you to be clear and explicit about types and handling cases where "undefined" could exist is a good thing.

It might take longer to develop but I've definitely seen I get fewer run time errors once it builds. No more staring at a blank page and checking the developer console for an undefined that's brought everything to a halt.