There’s a pretty common typescript helper called Prettify
:
type Prettify<T> = {
[K in keyof T]: T[K];
} & {};
It is meant to get more helpful type displays in your IDEs and error messages. I never understood why there’s an intersection with an object type at the end. Can someone explain? Why is it not just:
type Prettify<T> = {
[K in keyof T]: T[K];
}