UNPKG

513 BTypeScriptView Raw
1import type {IsEqual} from './is-equal';
2
3/**
4Returns a boolean for whether either of two given types are true.
5
6Use-case: Constructing complex conditional types where multiple conditions must be satisfied.
7
8@example
9```
10import type {Or} from 'type-fest';
11
12Or<true, false>;
13//=> true
14
15Or<false, false>;
16//=> false
17```
18
19@see {@link And}
20*/
21export type Or<A extends boolean, B extends boolean> = [A, B][number] extends false
22 ? false
23 : true extends [IsEqual<A, true>, IsEqual<B, true>][number]
24 ? true
25 : never;