user3301565 user3301565 - 3 years ago 234
TypeScript Question

Getting intellisense suggestions for declared typescript interfaces in function params

I made a pretty simple example right here:

enter image description here

As you can see, intellisense gives me the suggestions for the interface of the object named test in foo function. Perfect, love it!

But, if you declare that interface somewhere else like this:

enter image description here

intellisense tells me just that the test parameter has the Itest interface, but it does not tell me the parameters of it.

So, in this case, how can I "see" params of the interface "Itest", without opening the file or looking for compiler errors?

Answer Source

The thing you're looking for is not possible, and in any real life code, unreasonable. Imagine interfaces with 20 (interface) fields, which have another 20 fields (go on and go on). The fastest you can "deal" with it is just clicking on your function name and then f12 to show declaration of your function, then you can do the same with interface names. To go back you can use alt + left arrow.

Edit: To get jcalz's solution to work you need to move cursor between braces and hit alt + space

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download