Skip to content

[WIP] Reference missing with declare module #61854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Jun 12, 2025

Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.

Original issue description:

🔎 Search Terms

missing reference

🕗 Version & Regression Information

  • Typescript 5.8.3 with VisualStudio Code 1.100.2
  • Typescript 5.0.2 with MonacoEditor 0.39.0

⏯ Playground Link

No response

💻 Code

bugReportApi.d.ts

declare module '@bug/api/index' {

  export * from "@bug/api/miscFunctions";

}
declare module '@bug/api/miscFunctions' {

  export function myFunction(testParam: string): Promise<void>;
  

}

declare namespace bug.v0 {const api: typeof import('@bug/api/index')}

test.ts

bug.v0.api.myFunction('test')

🙁 Actual behavior

When I search for references to "myFunction", I only find the declaration in 'bugReportApi.d.ts', but not its usage in 'test.ts'.
However, if I copy the contents of 'bugReportApi.d.ts' into a new file named 'bugReportApiC.d.ts' and search for references again, I find two declarations ('bugReportApi.d.ts' and 'bugReportApiC.d.ts') as well as the usage in 'test.ts'.

🙂 Expected behavior

The usage in 'test.ts' is found as reference.

Additional information about the issue

Maybe it's the same issue as #61741

Fixes #61766.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@RyanCavanaugh
Copy link
Member

@copilot try again

Copy link
Author

Copilot AI commented Jun 12, 2025

@copilot try again

Fixed the issue in commit a7f0df5. The problem was in the getSymbolScope function which incorrectly limited the search scope for declare module exports to just their source file, when they should have global visibility. The fix ensures declare module exports use global search scope so references across files are found correctly.

Copilot finished work on behalf of RyanCavanaugh June 12, 2025 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Milestone Bug PRs that fix a bug with a specific milestone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reference missing with declare module
3 participants