dsherret / dsherret/ts-morph

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

Open
#812 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
6.2k
Forks
238
Avg merge
2m
Merged PRs (30d)
1

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.