'null' and 'undefined' are bottom types in non-strictNullChecks mode

This commit is contained in:
Anders Hejlsberg 2018-05-26 12:09:18 -07:00
parent 5a0910a675
commit b20925ad40

View file

@ -8592,6 +8592,9 @@ namespace ts {
if (includes & TypeFlags.Any) {
return includes & TypeFlags.Wildcard ? wildcardType : anyType;
}
if (!strictNullChecks && includes & TypeFlags.Nullable) {
return includes & TypeFlags.Undefined ? undefinedType : nullType;
}
if (includes & TypeFlags.String && includes & TypeFlags.StringLiteral ||
includes & TypeFlags.Number && includes & TypeFlags.NumberLiteral ||
includes & TypeFlags.ESSymbol && includes & TypeFlags.UniqueESSymbol) {