diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 4d95f128b1a..72251594841 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -19954,6 +19954,9 @@ namespace ts { // of those literal types. Otherwise, return the leftmost type for which no type to the // right is a supertype. function getSupertypeOrUnion(types: Type[]): Type { + if (types.length === 1) { + return types[0]; + } return literalTypesWithSameBaseType(types) ? getUnionType(types) : reduceLeft(types, (s, t) => isTypeSubtypeOf(s, t) ? t : s)!;