Common mistakes learning TypeScript

ak-64

New member
Joined
Apr 23, 2006
Messages
2
Reaction score
0
Title: Common mistakes learning TypeScript

Hey guys, I'm looking to hear from those who've dived into TypeScript. I've been learning it for a while now and I've noticed some common traps that trip even experienced devs up - like assuming types are only for function params, or not knowing when to use classes vs interfaces. What are some mistakes you've seen newbies (or not-so-newbies) make when learning TS?
 

Nazik242

New member
Joined
Sep 30, 2017
Messages
1
Reaction score
0
"Yup, I can vouch for that first point about the type annotations - took me a while to wrap my head around using them, but now I see how it's a game-changer. Just a heads up, also make sure you're familiar with the differences between interfaces and classes, it's a common gotcha for beginners. Been there, done that"
 

simonsat

New member
Joined
Aug 11, 2011
Messages
3
Reaction score
0
Yooo, I've gotta say, one of the biggest no-nos is not learning the basics of JavaScript first. TypeScript is built on top of JavaScript, so if you don't know your async/await or closures, you're gonna struggle big time. Start with JS and then make the switch to TS.
 

deesnark

New member
Joined
May 22, 2006
Messages
1
Reaction score
0
"Yup, I had to learn this the hard way, but don't be afraid to use IDEs with TypeScript support. I was trying to write everything in a plain text editor at first, and it took me ages to set everything up. Saved me so much time switching to Visual Studio Code with an extension"
 

bfganime

New member
Joined
May 9, 2019
Messages
3
Reaction score
0
"Y'all, I gotta say, one of the biggest mistakes I see newbies make when learning TypeScript is thinking it's all about JavaScript syntax. Don't get me wrong, TypeScript does build on top of JS, but it's way more than that. You gotta learn the type system and how to use interfaces and generics or you'll be hella lost."
 

ohnochan6

New member
Joined
Sep 9, 2018
Messages
1
Reaction score
0
"Yea, I remember when I first started learning TypeScript. One thing I kept tripping over was the difference between types like null and undefined, easy to get them mixed up. But honestly, it's a small price to pay for the safety and efficiency that TypeScript brings."
 

iiichelskijab

New member
Joined
Mar 31, 2007
Messages
1
Reaction score
0
"yup, one thing that got me is not understanding the difference between type and interface, thought they were interchangeable at first, but once you grasp that type is like a built-in type while interface is a custom contract, it all falls into place. another thing is not leveraging TS's type checking for enums, can save you a lot of headache in the long run"
 

Valeshik

New member
Joined
Jul 20, 2004
Messages
1
Reaction score
0
I think one thing to watch out for is over-reliance on the TypeScript compiler's auto-completion suggestions - it can lead to some pretty wonky code. Also, remember that type inference is a double-edged sword: it's super powerful, but it can also make it harder to debug if you're not careful about explicit type annotations. Been there, folks
 
Top