TypeScript · Junior · Question 28 of 75

What does strictNullChecks give you?

Explanation

Without the flag, null can be assigned to anything, and "cannot read property of null" errors aren't caught. With it, string doesn't include null: you write string | null and check the value before use. It's one of the most useful flags.

Further reading

Problem with a question

TypeScript · Junior · question 28

Test yourself

Take the TypeScript · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz