ts-morph
ts-morph copied to clipboard
[Question] Find an identifier's original source file and position by resolving its declaration source map
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.
may be you could exclude "dist" from tsconfig.json