Make 'undefined' assignable to 'void'

This commit is contained in:
Anders Hejlsberg 2016-03-06 13:59:09 -08:00
parent 50d874e09d
commit 0a25bb58a4

View file

@ -5507,7 +5507,7 @@ namespace ts {
if (isTypeAny(target)) return Ternary.True;
if (source.flags & TypeFlags.Undefined) {
if (!strictNullChecks || target.flags & TypeFlags.Undefined || source === emptyArrayElementType) return Ternary.True;
if (!strictNullChecks || target.flags & (TypeFlags.Undefined | TypeFlags.Void) || source === emptyArrayElementType) return Ternary.True;
}
if (source.flags & TypeFlags.Null) {
if (!strictNullChecks || target.flags & TypeFlags.Null) return Ternary.True;