Go to implementation instead of TypeScript declaration

前端 未结 2 676
北海茫月
北海茫月 2020-12-15 04:46

When I click an imported variable while holding Cmd in VSCode, I often end up looking at the TypeScript declaration of that variable. Is there any way to have V

相关标签:
2条回答
  • 2020-12-15 05:04

    This is currently a limitation of how VS Code handles JavaScript and TypeScript IntelliSense for external modules. See this issue for more info

    To summarize: VS Code's JavaScript and TypeScript support is powered by TypeScript behind the scenes. To understand the APIs of external modules, TypeScript uses d.ts files for performance and scalability reasons. This way it does not have to try to load or parse all of the module's code itself. The downside to this approach is that we cannot map back to actual JS limitation.

    To workaround this, libraries can bundle declaration maps that map from .d.ts files back to source .ts (or .js) files. However many libraries currently do not include these

    0 讨论(0)
  • 2020-12-15 05:06

    Implementation is bundled and transpiled ro javascript and vscode is not able to take you there but instead of it will take you to interface. You can search for references in javascript file or you can clone or form the repo to see the implementation in typescript.

    0 讨论(0)
提交回复
热议问题