Skip to content

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

Closed
@po35

Description

@po35
  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.

Activity

jcalz

jcalz commented on Jul 30, 2019

@jcalz
Contributor

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 commented on Jul 30, 2019

@RyanCavanaugh
Member

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

po35

po35 commented on Jul 31, 2019

@po35
Author

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

typescript-bot commented on Aug 2, 2019

@typescript-bot
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

brillout commented on Oct 6, 2023

@brillout

Related feature request: #56010.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jcalz@brillout@RyanCavanaugh@typescript-bot@po35

        Issue actions

          Intellisense shows full internals of a type declaration but not of an interface declaration on hover · Issue #32616 · microsoft/TypeScript