microsoft / microsoft/TypeScript
TS4082 occurs when using `composite: true`
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
Bug Report
🔎 Search Terms
TS4082, composite
🕗 Version & Regression Information
- I was unable to test this on prior versions because
compositeis a new feature added to typescript (not actually)
⏯ Playground Link
Playground link with relevant code
💻 Code
// This throws
export default (
a = () => {
interface Props {}
return {} as Props
},
) => {};
// This works
let a = () => {
interface Props {}
return {} as Props
}
🙁 Actual behavior
When composite is enabled, the export default statement throws TS4082. And disabling composite fixes this issue.
🙂 Expected behavior
They should both throw, or both not throw :(
This issue only occurs when using an interface. Using a type alias won't cause this issue.
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
Start by running the linked TypeScript Playground reproduction with composite enabled, then compare the exported and local callbacks and the interface and type-alias cases. Trace the compiler path that reports TS4082 and add a regression test; done means the two equivalent callback forms have consistent behavior without regressing the existing type-alias case.
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
- 35/100