common.d.ts 531 B

123456789101112131415
  1. export type Data = { [key: string]: unknown }
  2. export type UnionToIntersection<U> = (
  3. U extends any ? (k: U) => void : never
  4. ) extends (k: infer I) => void
  5. ? I
  6. : never
  7. // Conditional returns can enforce identical types.
  8. // See here: https://github.com/Microsoft/TypeScript/issues/27024#issuecomment-421529650
  9. // prettier-ignore
  10. type Equal<Left, Right> =
  11. (<U>() => U extends Left ? 1 : 0) extends (<U>() => U extends Right ? 1 : 0) ? true : false;
  12. export type HasDefined<T> = Equal<T, unknown> extends true ? false : true