microsoft / microsoft/TypeScript
cmd+click function name goes to type definition file instead of source
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
duplicate of microsoft/vscode#68782 but that was closed without fix.
- VSCode Version: 1.41.1
- OS Version: macOS 10.14.6
Steps to Reproduce:
- Create a project folder with 2 files:
lib.js
export const testMethod = (name, params) => {
params && params.age
? `hello ${name} with age: ${params.age}`
: `hello ${name}`;
};
test.js
import { testMethod } from "./lib";
testMethod("foo", { age: 3 });
cmd+click works and jumps to definition.

now add a type definition file
lib.d.ts
declare namespace MyModule {
interface IParams {
age: number;
}
function testMethod(name: string, params: IParams): string;
}
export = MyModule;
cmd+click jumps to type definition instead of source definition.

I do not think this should be the default behavior. I would expect cmd+click to bring me to the function definition.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the navigation behavior with the mentioned lib.js and test.js files, then add lib.d.ts and compare the cmd-click target. Start by tracing the definition lookup behavior in the TypeScript language service; done means navigation reaches the source function in lib.js rather than only the declaration in lib.d.ts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript, vscode
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100