Long expanded TypeScript type aliases clutter IDE

If you have typescript types with a lot of generic parameters, sub-types etc, sometimes the added type annotation in the IDE window is very annoying.

For example I was working with an API using a `Request<Body, Headers, Query, ...>` type, and when implementing an interface having some functions that take `(req, res)`, the expanded type annotations are hundreds of characters long (`Request<RequestBody<...>, Params<...>, ...`, it just goes on forever and runs outside the screen. This means I cannot even see parameters 2, 3, ... of my function as they come outside of the screen.

Is there a setting or similar that allows me to only see compact type annotations? If my function is typed as `(req: FooRequest, res, FooResponse)`, I just want to see those types - not the "exploded type aliases" derived from `FooRequest`. Alternatively, is there a setting to say "expand types but limit to, say, 20 characters?

 

I know how to disable type annotations from inlay hints completely, but it would be really nice to keep them but not expanding the aliases!

1
2 comments

There are no options for that... But long types are normally collapsed by default in the hints - doesn't it work for you?

0

I have the same problem, I have most of the types defined as type aliases instead of interfaces and WebStorm shows a very long type hint (hundreds of characters) even though the types have shorter names. Some king of limiting option would be very helpful.

0

Please sign in to leave a comment.