Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to view full type definition on hover in VSCode, TypeScript?

Hovering over a variable or function in VSCode is really helpful by showing its type. However, there are certain use-cases where I would like to see the full type definition of a variable and not just the type alias.

For example: UseState with full type UseState with full type will allow me to see the full type of the variable campaign:

Hover with full def.

But I would really like to extrapolate that type definition and export it so other components can use it too. So when I change things to this: UseState with type alias and hover and hover over the variable it only shows the type alias. How can I get TypeScript or VSCode to emit the full type definition for a type alias? Thanks!

like image 964
Noah Anderson Avatar asked Apr 24 '20 16:04

Noah Anderson


People also ask

What is TypeScript IntelliSense?

IntelliSense shows you intelligent code completion, hover information, and signature help so that you can write code more quickly and correctly. VS Code provides IntelliSense for individual TypeScript files as well as TypeScript tsconfig. json projects.

How do you jump to define in VS Code?

Go to Definition# Tip: You can jump to the definition with Ctrl+Click or open the definition to the side with Ctrl+Alt+Click.

How do I view code in VS?

You can open code into Visual Studio in the following ways: On the Visual Studio menu bar, choose File > Open > Folder, and then browse to the code location. On the context (right-click) menu of a folder containing code, choose the Open in Visual Studio command.


1 Answers

Right click and click go to Type Definition should always take you to the typescript type.

enter image description here

like image 159
Nathaniel Avatar answered Oct 16 '22 09:10

Nathaniel