[英]How to show inferred TypeScript type in WebStorm?
In VS2012, you can hover over a typescript variable and it will show you the inferred type.在 VS2012 中,您可以在 typescript 变量上使用 hover,它会显示推断的类型。 Is there a similar feature in webstorm? webstorm中是否有类似的功能?
Although not perfect.虽然不完美。 Press the Ctrl key (or ⌘ Cmd on macOS) and hover over a variable with the mouse to kick in the inference logic in webstorm:使用鼠标在变量上按Ctrl键(或⌘ Cmd在 macOS 上)和 hover 以启动 webstorm 中的推理逻辑:
Assuming the cursor is already on the variable the best way is:假设 cursor 已经在变量上,最好的方法是:
Starting from WS2017.2 Ctrl (Cmd) + Hover shows inferred type.从WS2017.2开始Ctrl (Cmd) + Hover显示推断类型。
Also you can try Quick Documentation : Ctrl + Q ( F1 for OS X )您也可以尝试快速文档: Ctrl + Q ( F1 for OS X)
Updated: in 2020.1 it will work as a part of the quick documentation and it works on hover if Preferences > EditoGeneral > Show quick documentation on mouse move is checked更新:在 2020.1 中,它将作为快速文档的一部分工作,并且如果选中Preferences > EditoGeneral > Show quick documentation on mouse move ,则它适用于 hover
Late to the party, and not sure when this came out, but there is a setting:派对迟到了,不知道什么时候出来的,但有一个设置:
Show quick documentation on mouse move. Delay: [500] ms
Where delay is editable.延迟是可编辑的。
You can get to it by你可以通过
File -> Settings -> Editor/General -> #Other / Show quick documentation on mouse move
Works similar to VS工作类似于 VS
Depending on the context, there are different ways to get type information.根据上下文,有不同的方法来获取类型信息。 (Shortcuts for OS X) (OS X 的快捷方式)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.