12170

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:

<img src=https://www.e-learn.cn/content/wangluowenzhang/"https://i.stack.imgur.com/PF8G6.jpg" alt="Hover in VSCode">

It can also show the effective type of a variable:

<img src=https://www.e-learn.cn/content/wangluowenzhang/"https://i.stack.imgur.com/0NYav.jpg" alt="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?

Answer1:

    <li>

    Ctrl+Shift+I</kbd> (View/Quick Definition)

    </li> <li>

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

    </li> </ul>

    Since WS2017.2 Ctrl+Hover</kbd> shows inferred type.

Recommend

  • Is it a bad practice to rely on local objects get destructed in the reverse order of construction in
  • Feature Event Handler called multiple times for Farm level feature - sharepoint 2007
  • Is it possible to run a playbook in “pull mode”?
  • Why would you want to use composition in golang?
  • Deploying a sample Spring Web MVC project
  • JAR doesn't work with Absolute Layout
  • Render QGraphicsScene according to zoom level
  • How to lookup value with multiple criteria in excel 2007 and newer
  • Why does this empty dict break shared references?
  • Query timeout expired in django-mssql when executing custom SQL directly
  • Receiver has no segue with identifier“***”
  • Tools for understanding HTML layout
  • Pre-populated SQLite Database not reading properly in Android Studio
  • Converting query results into DataFrame in python
  • Where these are stored?
  • CSS bleed-through with cfinput type=“datefield”
  • how do i write assembly code from c#?
  • Possible to get mouse events fired when cursor is outside page?
  • IE7 and TinyMCE with Plone
  • Unable to get column index with table.getColumn method using custom table Model
  • C: Incompatible pointer type initializing
  • why xml file does not aligned properly after append the string in beginning and end of the file usin
  • DirectX11 ClearRenderTargetViewback with transparent buffer?
  • Sending data from AppleScript to FileMaker records
  • Why is the timeout on a windows udp receive socket always 500ms longer than set by SO_RCVTIMEO?
  • Weird JavaScript statement, what does it mean?
  • Web-crawler for facebook in python
  • Unit Testing MVC Web Application in Visual Studio and Problem with QTAgent
  • KeystoneJS: Relationships in Admin UI not updating
  • AngularJs get employee from factory
  • Load html files in TinyMce
  • python draw pie shapes with colour filled
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • Django query for large number of relationships
  • Running Map reduces the dimensions of the matrices
  • Reading document lines to the user (python)
  • Binding checkboxes to object values in AngularJs
  • Net Present Value in Excel for Grouped Recurring CF
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?