microsoft / microsoft/TypeScript
Weird error message for mixed exported/non-exported declarations under `isolatedModules`
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
// @isolatedModules: true
export function bar() {
}
interface bar {
}
export { bar as MyThing };
Expected: I actually don't know 😄. I think it should just work though.
Actual: Unclear error message
In nightlies (3.8+), the message is currently
Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
In 3.7.4 the message is still unclear.
Cannot re-export a type when the '--isolatedModules' flag is provided.
But bar is also a value!
See also
- https://github.com/microsoft/TypeScript/issues/32662 (which is about correcting the phrasing of the error)
- https://github.com/microsoft/TypeScript/issues/32601 (which is about I guess giving the user better suggestions)
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 reproducing the supplied declaration and re-export under isolatedModules in the TypeScript compiler, then compare the current diagnostics with the behavior described for 3.7.4 and later nightlies. Review issues #32662 and #32601 for related diagnostic wording and suggestions; done means the mixed value/type declaration receives a clear, agreed-upon diagnostic or valid 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
- Needs clarification
- Newbie friendliness
- 25/100