Problem
When using typescript I can access hover-help from the language server for my variables. Given this snippet of code:
interface X {
x1: string;
x2: number;
}
type Y = {
y1: boolean;
y2: number;
};
export type Z = X | Y;
getting the types for Z
, Y
, and X
produce different kinds of results. See the screenshots below:
✔️ Help for Y
As you can see, the help for Y
is great. It shows me all the members of Y
.
❌ Help for X
The help for X
however, is pretty awful because "what is X?" results in "X is X." Not great.
❌ Help for Z
And for Z, it isn't much better. It just regurgitates the exact definition from the line on which it was defined.
Desired Outcome
When I activate hover-help for a type/interface, I am usually interested in seeing all the members of that type. However, with nested interfaces I just get the top-level and it's often minimally helpful if not totally useless.
Is there a way to get more information here? Perhaps I can "expand" the types in the hover-help? Or maybe there's a setting to recursively expand?
Workaround
Currently I just type const foo = null as unknown as Z;
to get myself a quick and dirty "instance of Z
" and then I type foo.
and use the auto-suggestion popup after the .
to see all the members. As you can imagine, I really hate doing this.
Other Information
Note: I'm using Vim with CoC, but this should also apply to other editors.