ts-morph icon indicating copy to clipboard operation
ts-morph copied to clipboard

[Question] Find an identifier's original source file and position by resolving its declaration source map

Open velut opened this issue 4 years ago • 1 comments

Hi,

Is it possible to find the original definition in a .ts source file starting from the compiled .d.ts declaration file when its .d.ts.map source map file is also available?

To better explain this issue, I've created the following repository: https://github.com/velut/ts-morph-goto-definition-issue

If you open the repository in VSCode and Ctrl-click on the adder declaration in project/dist/index.d.ts, you should be taken to the adder definition in project/src/index.ts. This happens because VSCode queries the tsserver which in turns queries Typescript's language service.

I'm trying to replicate this behavior with ts-morph, however my queries to the language service resolve only to the .d.ts file, apparently ignoring the available source map.

Thanks for your time.

velut avatar May 05 '20 16:05 velut

may be you could exclude "dist" from tsconfig.json

foolishchow avatar Dec 31 '21 09:12 foolishchow