Sitemap

Member-only story

9 tricks that separate a pro Typescript developer from an noob ๐Ÿ˜Ž

8 min readMay 11, 2025

--

Press enter or click to view image in full size

Typescript is a must-know tool if you plan to master web development in 2025, regardless of whether itโ€™s for Frontend or Backend (or Fullstack). Itโ€™s one of the best tools for avoiding the pitfalls of JavaScript, but it can be a bit overwhelming for beginners. Here are 9 tricks that will kick start your journey from a noob to a pro Typescript developer!

1. Type inference

Unlike what most beginners think, you donโ€™t need to define types for everything explicitly. Typescript is smart enough to infer the data types if you help narrow it down.

// Basic cases
const a = false; // auto-inferred to be a boolean
const b = true; // auto-inferred to be a boolean
const c = a || b; // auto-inferred to be a boolean

// Niche cases in certain blocks
enum CounterActionType {
Increment = "INCREMENT",
IncrementBy = "INCREMENT_BY",
}

interface IncrementAction {
type: CounterActionType.Increment;
}

interface IncrementByAction {
type: CounterActionType.IncrementBy;
payload: number;
}

type CounterAction = IncrementAction | IncrementByAction;

function reducer(state: number, action: CounterAction) {
switchโ€ฆ

--

--

Tapajyoti Bose
Tapajyoti Bose

Written by Tapajyoti Bose

Top Rated Freelancer || Blogger || Cross-Platform App Developer || Web Developer || Open Source Contributor || FIRE Enthusiast