What does this type-level programming pattern produce? type LastOf = UnionToIntersection T : never> extends () => infer R ? R : never;

TypeScript Professional Hard

TypeScript Professional — Hard

What does this type-level programming pattern produce? type LastOf = UnionToIntersection T : never> extends () => infer R ? R : never;

Key points

  • This pattern involves converting the union to an intersection of function types
  • It infers the return type to accurately extract the last member
  • Helps in handling complex type manipulations in TypeScript

Ready to go further?

Related questions