What does the following pattern achieve? type Prettify = { [K in keyof T]: T[K] } & {};

TypeScript Professional Hard

TypeScript Professional — Hard

What does the following pattern achieve? type Prettify = { [K in keyof T]: T[K] } & {};

Key points

  • This pattern is used to reveal the complete type information in tooltips.
  • It does not create a deep copy of T or merge with an empty intersection.
  • The goal is to improve readability and understanding of the type structure.

Ready to go further?

Related questions