最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - VSCode always shows type definition and not the actual implementation - Stack Overflow

programmeradmin1浏览0评论

Do any of you face this problem where vscode always takes you to the type definition of a function and not the implementation.

For example, I right click on the react setState function as below,

And VS code shows me the typescript file.

How do I look at the implementation and not the type definition of a function?

Do any of you face this problem where vscode always takes you to the type definition of a function and not the implementation.

For example, I right click on the react setState function as below,

And VS code shows me the typescript file.

How do I look at the implementation and not the type definition of a function?

Share Improve this question edited Nov 13, 2024 at 9:09 Ryan Wheale 28.5k10 gold badges86 silver badges102 bronze badges asked Mar 9, 2018 at 16:17 RahulRahul 7322 gold badges9 silver badges26 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 5

This is a limitation of VS Code's intellisense. We don't attempt to parse js from inside node_modules for IntelliSense, so we have no way of mapping back to the original source code. Instead we rely on *.d.ts to provide definitions.

These two issues are tracking possible improvements to this:

  • https://github./Microsoft/TypeScript/issues/6209
  • https://github./Microsoft/TypeScript/issues/16792

In vscode v1.67 there is update with new Go to Source Definition mand

Jump directly to a JavaScript implementation of a library function using the new Go to Source Definition mand. You can learn more about this feature and share feedback in TypeScript issue #49003.

HTML project live preview option on clicking in show in browser the whole project showing that window cannot find web view , type name correctly and then try again

发布评论

评论列表(0)

  1. 暂无评论