What were your favorite resources or courses to learn TypeScript, and what did you like or dislike about your learning experience?
Does this hold true for react projects? All .jsx -> .ts?
I've not used React, but there are .tsx
files, so I assume you can just do that rename. See this for possible info: https://stackoverflow.com/questions/64343698/what-is-the-difference-between-js-tsx-and-jsx-in-react
Turn on strict mode and force yourself to use it. Go to definitions of library functions and such you don't understand, try to understand them.
also dont ever use any
There are good reasons to use it in rare cases like dealing with external libraries/data sources where you can’t pin down the exact data-type. Yes, it’s not ideal—sort of defeats the purpose of typescript for that one case, but it is sometimes necessary to have an escape hatch like that.
Those should ideally return an unknown, not an any, no?
It depends on whether you're able to perform type-checking on the data. If you're not, you might be stuck using any.
They should have not implemented any to begin with
Don't learn JavaScript first if possible.
Majority just learn bad practice that way. I find the developers I've worked with that learnt JavaScript by using typescript (as it's the same but with types) were ultimately much better and followed best practice.
Other than that, typescript docs are much better than they once use to be. Still missing a lot of content but the stuff they have is easy to understand so would highly recommend going through them.
Lots of knowledgeable typescript YouTubers around such as Matt Pocock.
I personally haven't read many TS books so can't reccomend them too much.
Udemy has some good typescript courses that go through everything. Did a complete one recently, skipping most of the basics but for the typescript Design Principals parts.
Then for keeping up-to-date with it the latest releases, I usually just read Typescripts release documentation and changelogs/PR's.
Finally and probably the best way, I'd recommend just thinking of a simple project backend or monorepo project. A simple API that communicates with a database and displays the data or something, and just make it, that's the best way to learn.
Then once you have an implementation, work on improvements, how can you make the code cleaner, safer and more efficient. This is how it's really easy to learn on the job as you have predefined tasks and goals.
Think of a simple project and just make it
This is the way.
dont learn js first... this is a bold move cotton.
Tbf I was talking more from the perspective of someone that's worked with other languages before, so you have the basics of programming already and therefore jumping straight into Typescript is much easier.
That being said, I've seen lots of beginner courses that go through all the basics while incorporating types
I mean, I'm a big fan of learning by doing the thing you want to do. I see a lot of people say you have to learn all this other stuff before doing the thing you actually want to do. So I want to believe haha.
100% disagree for people who have experience with typed languages. Imo one has to understand how much of a nightmare pure js can be to appreciate ts and not write idiotic ts.
I do wonder if devs going straight for TypeScript, might miss the fact that most of what TypeScript gives you during development is not there at runtime.
I see TS more as an opt-in approach. Big projects can hugely benefit from opting in early on, but for one-off examples or small projects, it's totally fine to opt out.
I watched a lot of courses but they were useless because you'll learn new stuff without knowing where to use them so i started watching projects with ts and try to do it my self It's way more better then just wasting your time over and over on finding the best course ....
A good way to really learn it is to convert a JS project to TS
Just know the basic stuff like how to type functions and how to type parameters, interface and types(their differences), also Promise type, and understand a bit about generics. No need to go crazy with types. Infer types whenever possible. I think I watched a ben awad video and just started doing everything in TS. I die a little inside now when I have to write vanilla JS code.
"What is the best way to learn TypeScript? I'd love to hear about your favorite resources or courses for learning TypeScript! Share what you liked or disliked about your learning experience.
Also, I recently created a video on learning TypeScript that you might find helpful. Check it out here!"
Step 1: Learn javascript.
Step 2: Build node js projects using a framework such as nestjs in typescript.
Step 3: Once you are experienced with decorators classes visibility and other stuff & are able to build projects on your own(which will take atleast 2-3 projects) you can look into react using typescript.
PS: I was scared of ts and found that the best way to learn any language is by building some sort of backend project around it. This was very helpful in improving my learning curve of typescript by a lot.
My brain is a blank. But s youtuber known for typescript has a free course out.
Maybe Matt pocock’s beginner typescript course?
Yep thats it.thank you
With docs, youtube channels and do simple and easy projects to start. And a lot of patiente with the errors hahaha learn to read the errors
I would follow this series from the Net Ninja:
I've got a great book recommendation for you! Check out "https://www.amazon.com/Learning-TypeScript-Development-Type-Safe-JavaScript/dp/1098110331 . It's a fantastic read that's suitable for junior and mid developers . And I've actually written and published few days ago a book called https://www.amazon.com/Practical-Advanced-TypeScript-Hands-Learning-ebook/dp/B0C4QXBW74/ specifically for experienced developers . If you're interested, I'd be happy to send you a free digital copy of my book. Let me know!
Best way to learn is by doing.
We were kinda forced to use it at my old job and it helped with the initial learning since it was a hard requirement.
Some of the resources I used though during the initial learning phase:
The docs of course: https://www.typescriptlang.org
Freecodeorg: https://www.freecodecamp.org/news/learn-typescript-beginners-guide/
Both really helped me early on.
First "learn by doing" is not good advice. If you do it that way you'll learn a little bit and then apply that everywhere -- it's a little bit like handing a chef two knives and then saying okay make a 5 course meal. Instead you should learn a good bit about the language so that you have many tools to use when you do start doing.
Matt Pocock has a beginner series that is very good.
Best way to learn is by doing. You can start off simple, assuming you already know JS. Convert an existing JS project to TS and gradually fix bug when you add TS. *
npm install typescript
* rename all*.js
files to*.ts
- all JS is valid TS code, but you can add more TS stuff in later * Compile to see all your existing errors, and fix them * Enable strict mode in TS, compile and see your new errors and fix those * Go around and add in the missing TypeDefs that you can now use