Typescript Stephen — Grider
You will type fetch(URL).then(res => res.json()) a dozen times. Each time, he stops you. "Does TypeScript know that res.json() returns a WeatherReport ? No. It thinks it's any . You just lost all your safety."
(This is deliberately weak.) interface AddAction type: 'add'; payload: number; typescript stephen grider
He explains: " T is a placeholder. When you say new HoldAnything<string>() , you are handing TypeScript a slice of 'string pie'. TypeScript then replaces every T with string before your code runs." You will type fetch(URL)
interface SubtractAction type: 'subtract'; payload: number; When you say new HoldAnything<string>() , you are
He then builds a Sort class using an interface Sortable . He demonstrates how an interface allows a single sorting algorithm to work on LinkedList , NumbersCollection , and CharactersCollection simultaneously. This is where TypeScript clicks for Grider's students: types are not about restricting you; they are about composing you. Generics are the wall that breaks most developers. The syntax <T> looks like line noise. Grider’s solution is visual and tactile.
His signature exercise: manually annotating a fetch response for a weather API. He forces you to write:
He starts with plain JavaScript Redux to show the fragility: one typo in an action type string ( 'FETCH_USERS' vs 'FETCH-USER' ) breaks your entire app silently. Then, he refactors. interface Action type: string; payload?: any;