
Template Literal Types Explained: Catching Path Typos at Compile Time
Somewhere in your codebase there's a function that looks like this: function get(obj: any, path: string) { return path.split(".").reduce((acc, key) => acc?.[key], obj); } const primaryColor = get(config, "theme.colros.primary"); Read that path again. colros, not colors. TypeScript compiles it without a single complaint. The app ships. primaryColor is undefined, some fallback kicks in, and the button is the wrong shade of blue for three weeks before a designer notices and files a ticket nobod























