Use TypeFlags.UnionOrIntersection not TypeFlags.Union (#20662)

This commit is contained in:
Wesley Wigham
2017-12-12 16:32:55 -08:00
committed by GitHub
parent 5dab24a2a7
commit 40029a0523
5 changed files with 110 additions and 1 deletions

View File

@@ -19094,7 +19094,7 @@ namespace ts {
function isLiteralOfContextualType(candidateType: Type, contextualType: Type): boolean {
if (contextualType) {
if (contextualType.flags & TypeFlags.Union && !(contextualType.flags & TypeFlags.Boolean)) {
if (contextualType.flags & TypeFlags.UnionOrIntersection && !(contextualType.flags & TypeFlags.Boolean)) {
// If the contextual type is a union containing both of the 'true' and 'false' types we
// don't consider it a literal context for boolean literals.
const types = (<UnionType>contextualType).types;