Suppose you have a type that has many intersections:
export type SimpleShape = {
color: string;
} & {
size: number;
} & {
shape: "circle" | "square";
};
When you hover over the type SimpleShape
with many intersections, it can be difficult to see the resolved type. It would be helpful if there was a way to prettify the display of these types.
With Prettify
we can using:
type Shape = Prettify<SimpleShape>;
// ^? type Shape = {
// color: string;
// size: number;
// shape: "circle" | "square";
// }
This is really helpful. Thank you, Matt!
It does work for objects, but it will also break Classes, for example with this code:
you will get this:

but with this one:
you will get this:

It would be great if you could check if the
T[K]
's type is Real object, if so then prettify it