Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intellisense shows full internals of a type declaration but not of an interface declaration on hover #32616

Closed
po35 opened this issue Jul 30, 2019 · 5 comments
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@po35
Copy link

po35 commented Jul 30, 2019

  1. Declare an interface
  2. Consume that interface somewhere
  3. Hover over where you consume it
    => Intellisense won't show any internals of that interface

Do 1, 2 and 3 with a type declaration and Intellisense shows all internals. Discussion on reddit: https://www.reddit.com/r/typescript/comments/cisi08/getting_intellisense_to_show_function_signatures/evejcy0/?context=3

Expected behavior:
Show all internals of any declaration on hover.

Actual behavior:
Just shows internals of type declarations.

Playground Link:
https://codesandbox.io/s/small-bird-l13fg?fontsize=14

Hover with your mouse over IDuck and RealDuck in the respective const statement.

@jcalz
Copy link
Contributor

jcalz commented Jul 30, 2019

Related to #25784? Right now there is no way to selectively expand/collapse parts of a type definition. If we could do this, then it would make sense to do this for interfaces as well as type aliases (with perhaps interfaces collapsed by default and type aliases expanded by default).

Also, an actual playground link

@RyanCavanaugh RyanCavanaugh added the Working as Intended The behavior described is the intended behavior; this is not a bug label Jul 30, 2019
@RyanCavanaugh
Copy link
Member

This is one of the differences between aliases and interfaces. Interactive expansion would definitely be nice; see the above linked issue

@po35
Copy link
Author

po35 commented Jul 31, 2019

Thanks for the fast feedback and the playground link!

Related to #25784?

Yes, but #25784 is more specific since it addresses collapsing. I just want to get the same info from an interface I get from type on hover.

I am still on the fence re TS. Yes it helps and there is a lot of good stuff but there are also some subpar things. If I already make the work, declare type/interfaces for all my code I want to be able to see their definition anywhere easily. Having to go to the definition of interfaces to get the interface is not that much better than just going to a plain JS object and checking briefly its signature or its JSDoc. And there's actually no reason to treat interface differently than type. Btw, a JSDoc would have been showed on hover.

So, I'd be happy to see a PR here. Thanks!
ps. and which spec for TS reflects that 'it's working as intended', feels rather like a bug

@typescript-bot
Copy link
Collaborator

This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@brillout
Copy link

brillout commented Oct 6, 2023

Related feature request: #56010.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

5 participants