type CounterAction = AddAction | SubtractAction;
Grider dances a little jig here (metaphorically). He shows you that inside a reducer, when you check action.type === 'add' , TypeScript automatically knows that action.payload is a number . Not any . Not number | undefined . A number. typescript stephen grider
class HoldAnything<T> data: T;
For hundreds of thousands of students on Udemy and beyond, Stephen Grider is not just an instructor; he is the translator of complex systems. While other courses dump a reference manual on your lap, Grider builds a mental scaffolding. This article explores the core pillars of his TypeScript pedagogy, why it works, and how his specific projects (from the infamous index.ts file to building a full-stack app) change the way you think about type safety. Most TypeScript tutorials start with: "TypeScript is a typed superset of JavaScript that compiles to plain JavaScript." Grider starts with a story. He often opens his TypeScript content with a nightmare scenario: a JavaScript function that expects a Date object but receives a string by accident. The app doesn't crash immediately. It corrupts data silently. By the time you notice, your database is full of "Invalid Date" strings. Not number | undefined