Skip to content
Myr

utils.d.ts

This file

Path

types/utils.d.ts

13 lines · 733 bytes · TypeScript

Last changed by

Fix complexity bug with types (#1037)ehmickybefore adoption6cc519b

History of this file

Take it

Split type files (#978)ehmickybefore adoption0bd0f0d

lines 1–9why, one step back
1export type Not<Value extends boolean> = Value extends true ? false : true;
23export type And<First extends boolean, Second extends boolean> = First extends true ? Second : false;45export type Or<First extends boolean, Second extends boolean> = First extends true ? true : Second;67export type Unless<Condition extends boolean, ThenValue, ElseValue = never> = Condition extends true ? ElseValue : ThenValue;89export type AndUnless<Condition extends boolean, ThenValue, ElseValue = unknown> = Condition extends true ? ElseValue : ThenValue;

Fix complexity bug with types (#1037)ehmickybefore adoption6cc519b

lines 10–13why, one step back
10
11// Whether any of T's union element is the same as one of U's union element.12// `&` does not work here.13export type Intersects<T, U> = true extends (T extends U ? true : false) ? true : false;