Use optional properties and `strictNullChecks` to handle missing TypeScript data explicitly.
The move: Give absence a meaning before using the value. Optional properties tell TypeScript a property may be missing. Under strictNullChecks, reading that property requires a check because JavaScript returns undefined for missing values. That is not a compiler annoyance; it is a design prompt. There are three common meanings. Some values are optional inputs with safe defaults. Some are temporarily absent because data is loading. Some are absent because the domain says they do not apply. Those meanings should not all collapse into a bang operator. Use the smallest honest model. A default is fine when the business meaning…
Sign up free — one personalized lesson every day, matched to your role and goals.
Already have an account? Sign in