Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find out the type of a TypeScript element (variable, function) in WebStorm?

Is there a way in WebStorm to get the type of a function or a variable?

In Visual Studio Code, I can hover over an identifier, and I get type information about the element under the cursor:

Hover in VSCode

It can also show the effective type of a variable:

Hover in VSCode

Both are extremely helpful tools for better understanding the code.

Is there a way in WebStorm to access the effective type of an element in the editor?

like image 592
Michael_Scharf Avatar asked Oct 27 '25 07:10

Michael_Scharf


1 Answers

  • Ctrl+Shift+I (View/Quick Definition)

  • Try Ctrl+Shift+P (View/Expression Type) - it normally shows the inferred variable type

Since WS2017.2 Ctrl+Hover shows inferred type.

like image 74
lena Avatar answered Oct 28 '25 22:10

lena



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!