Skip to main content

IsUnion TypeAlias

Returns true if T is a union and false if it is not.

This API is reserved for internal system use and should not be imported directly. It may change at any time without notice.

For more information about our API support guarantees, see here.

Signature

export type IsUnion<T, T2 = T> = T extends unknown ? [T2] extends [T] ? false : true : "error";

Type Parameters

Parameter Default Description
T Type to test if it is a union.
T2 T Do not specify: default value used as implementation detail.