til

How to force VSCode to show expanded types

typescriptvscode

I always forget this gem piece of TypeScript that allows you to force VSCode to show properties inside of a type. So instead of seeing a reference to the type name you get the full properties inside of the type

type Prettify<Obj> = { [k in keyof Obj]: Obj[k] } & {};

So, instead of seeing this:

Collapsed properties

You see this:

Expanded properties

Also when you have intersections like this:

type Intersected = { a: number } & { b: number };

Instead of seeing this:

Intersection before

You see this:

Intersection after

I learnt this from @mattpocockuk