Michael_Scharf Michael_Scharf - 1 year ago 152
TypeScript Question

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

Is there a way in WebStrom 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 to better understand the code.

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

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

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

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