I'm switching between JavaScript and TypeScript


I'm switching between JavaScript and TypeScript. I've noticed TypeScript has a lower mental load.

Here's why:

In JS I have to remember object shapes and call signatures.

In TS I declare my types once. Then I lean on them. So TS frees up my short-term memory. 👍

#typescript
Another example where TS reduces mental load:

In JS, when I make a breaking API change, I have to remember all the spots I need to update.

In TS, no short-term memory or manual searching is required. I just lean on the compiler.
Oh, and if you want to learn TypeScript, here are three resources I found helpful:

Book: https://www.oreilly.com/library/view/programming-typescript/9781492037644/

Free online book: https://basarat.gitbook.io/typescript/

React TypeScript Cheatsheet: https://react-typescript-cheatsheet.netlify.app/

View original on X