•
2 min read
Learnt Typescript the wrong way

When I was first introduced to Typescript in 2020, I was sold on the idea is like JavaScript but helps you catch program bugs ( the infamous - TypeError ) statically before your programs run. I was lucky enough to inherit a react codebase that was written in typescript, so i saw it benefits right through.

If you are reading this and sick of weird TypeError: Cannot read properties of undefined (reading '…') javascript errors, allow me to save your sanity and read on!

Why Typescript

JavaScript is a dynamic type language, which means types are checked at run-time. How many times have you mispelt a variable name and later found out after you have run your code? or that time you spent hours debugging a piece of javascript and then finally the aha! moment comes when you found out you were passing undefined to a function instead of a string. Typescript integrates and lives in your text editor, showing you red squailly line as you edit your source file identifying problems that might result in errors at run-time.

Picking a new Skill

My approach to learning a new skill or technology is simple, find a good book on that topic, apply what i learn’t to build a small project to cement my understanding. Overtime i expand my knowledge base by reading documentations, people’s code, technical blogs and watching people talk about technologies.

However my approach to Typescript was different, I saw it to be a small layer on top of what i already know so why bother. I was using Typescript with X technology, mostly with react and vue and that was it, i was stuck in this bubble

Reality Check

New Approach