TypeScript 2.0 introduced what are known as non-nullable types. TypeScript used to consider null and undefined to be valid values of every type.
The following diagram represents the values that can be assigned to the type number when non-nullable types are disabled:
As we can see in the preceding diagram, undefined and null are allowed as values of the type number, together with the NaN value and all the possible numbers.