How to Actually Improve Type Safety with the TypeScript Strict Flags

Last summer a team of engineers converted our front-end code from Closure-annotated JavaScript to TypeScript, you can read about it here. It has been a long journey to take that converted code that was smattered with anys and turn it into idiomatic and type-safe TypeScript. The strict compiler flags have been a primary method for making these improvements. Read on to find out why enabling the strict TypeScript compiler flags “the hard way" is worth it in the long term for improving type safety.
The Strict flags
The TypeScript compiler currently has eight* strict compiler flags that can be used as tools to improve code quality and, to varying degrees, increase the soundness of TypeScript’s type system: