I recently just started learning Typescript so I thought I'd share my experience so far. I'm not going to focus too much on what typescript is and its features because I feel there are already so many helpful articles out there. Instead, I want to focus on my experience and maybe that will help you decide if it's a language you should learn.
The :Type annotation allows us to specify the type after the variable name, basically this just means stating if it's a string, number, boolean etc. This is great because it allows the compiler to check at runtime for bugs. Interfaces can be used to specify the type and they allow us to guarantee that an object will contain specific fields however using ? after the property name makes it optional.
One thing I really loved about Typescript was its familiarity. Working with it reminded me of Kotlin. Some of its syntax and its simplicity really reminded me of kotlin which I appreciated. It was fairly simple to understand the basics however things did become slightly harder once I needed to make an API call.
I really struggled when I had to destructure the data that came from the API because typescript wouldn't allow me to retrieve the data. After bashing my head against the wall, I finally realised that any data I needed to destructure I would have to provide a type for. I ended up with a lot of types however I didn't need to declare a type for all the data returned by the API. I only needed to declare a type for the data I needed to retrieve from the API. Trying to retrieve data I didn't create a type for resulted in errors.
I obviously have just scratched the surface when it comes to Typescript but I'm really enjoying it. I plan on adding firebase to my project so I might come back with another article about that experience. For now, I'm convinced and
I will probably be using it a lot more often.