microsoft / microsoft/TypeScript
Module is present in declarations even though it is unused.
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
🔎 Search Terms
module unused declarations
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ
⏯ Playground Link
💻 Code
export {}
declare module mod1 {
export type test1 = string;
}
declare module mod2 {
import test1 = mod1.test1;
export { test1 };
}
🙁 Actual behavior
mod1 is kept in the declaration.
🙂 Expected behavior
mod1 is not kept in the declaration file since it is only used in mod2 which is omitted from the declaration file.
Additional information about the issue
Found while working on isolated declarations in test reExportAliasMakesInstantiated.ts added by #54816 (cc @andrewbranch )
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 behavior with the linked TypeScript Playground example, then read the isolated-declarations test reExportAliasMakesInstantiated.ts mentioned in the issue and compare its emitted declaration output. Done means the unused mod1 declaration is omitted when mod2 itself is omitted from the declaration file, with the relevant test covering the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100