Learning TypeScript
May 27, 2023
Why TypeScript?
I kept seeing TypeScript mentioned everywhere, and I wanted to understand what it was. After some research, I realized it's JavaScript with types, which helps catch errors before they happen. That sounded useful.
First Impressions
TypeScript is JavaScript, but stricter. At first, it felt annoying having to define types for everything, but I'm starting to see the benefits. My code feels more robust.
What I've Learned
I've been working through TypeScript basics:
- Type annotations
- Interfaces
- Type inference
- Union types
Interfaces are particularly useful for defining the shape of objects. It's like having a contract for your data.
Converting JavaScript to TypeScript
I've been converting some of my JavaScript projects to TypeScript. It's tedious, but it's good practice. The type errors are actually helpful - they're catching bugs I didn't know existed.
Challenges
The learning curve is steeper than I expected. Some of the advanced types are confusing, but I'm taking it slow and focusing on the basics first.
Why This Matters
I want to build professional applications, and TypeScript seems to be the standard for larger projects. Learning it now will pay off later.
Next Steps
I'm going to continue practicing TypeScript while I plan out my trading journal project. I want to build it with TypeScript from the start.