Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode always shows type definition and not the actually implementation

do any of you face this problem , where vscode always take you to the type definition of a function and not the implementation.

For example, I right click on the react setState function as below, enter image description here

And VS code shows me the typescript file. enter image description here

If its problem a, how do i fix it. If not then how do I look at the implementation and not the type definition of a function.

like image 595
Rahul Avatar asked Mar 09 '18 16:03

Rahul


1 Answers

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.com/Microsoft/TypeScript/issues/6209
  • https://github.com/Microsoft/TypeScript/issues/16792
like image 167
Matt Bierner Avatar answered Oct 03 '22 00:10

Matt Bierner