What does `type Prettify = { [K in keyof T]: T[K] } & {}` accomplish?

TypeScript Professional Hard

TypeScript Professional — Hard

What does `type Prettify = { [K in keyof T]: T[K] } & {}` accomplish?

Key points

  • Combines properties of type T into a single object type
  • Creates a more readable type by flattening intersections
  • Does not deeply clone the type or make properties optional

Ready to go further?

Related questions