# InternalIsUnion

`type` in `gateway` · v0.2.1-next.0

<https://docs.seedcord.org/packages/gateway/0.2.1-next.0/types/internal-is-union>

The actual implementation of `IsUnion`.

## Declaration

```ts
type InternalIsUnion<T, U = T> = (
    IsNever<T> extends true
        ? false
        : T extends any
          ? IsEqual<U, T> extends true
              ? false
              : true
          : never
) extends infer Result // In some cases `Result` will return `false | true` which is `boolean`, // that means `T` has at least two types and it's a union type,
    ? // so we will return `true` instead of `boolean`.
      boolean extends Result
        ? true
        : Result
    : never;
```
