As the full lesson says:
For every soundness-related bug that sneaks through, TypeScript will probably save you from hundreds of "cannot read property of undefined" errors.
For every soundness-related bug that sneaks through, TypeScript will probably save you from hundreds of "cannot read property of undefined" errors.
Vs
type NonEmptyArray<T> = [T, ...T[]];
Or if you need to check if the array has exactly 3 items. How would you do that in TS?
Like that: https://www.typescriptlang.org/play?#code/C4TwDgpgBAKgFgJwhA...