microsoft / microsoft/TypeScript

Weird error message for mixed exported/non-exported declarations under `isolatedModules`

Open
#36,041 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Needs Proposal Suggestion
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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.