Reputation: 3069
Is it possible to create a type function IsEmpty
such that:
type a = IsEmpty<{}> // true
type b = IsEmpty<{x: 1}> // never
Upvotes: 1
Views: 42
Reputation: 1042
type IsEmpty<T> = {} extends T ? true : never;
see conditional type
Upvotes: 4