Skip to content

Typescript doesn't handle reexporting modules with default exports correctly #4513

@weswigham

Description

@weswigham

check.ts:

import it from './a';

a.ts:

export * from './b';
export * from './c';

b.ts

export default function foo() { console.log('b') };

c.ts

export default function bar() { console.log('c'); };

TS complains that it can't find a default export in a with which to define it.

Since both b and c export a member named 'default' (since that's all the default keyword really means), a should, transitively, have a default for check to import.

The JS language service in VSCode also has the same (incorrect) assumption.

Additionally, for my own information, I ran some ES6 JS through traceur/systemjs - it looks like the convention is that in the case of "collisions" in export * situations, the latter exports overshadow the prior - so in this case, it is c's bar, as a imported it second.

Metadata

Metadata

Assignees

No one assigned

    Labels

    By DesignDeprecated - use "Working as Intended" or "Design Limitation" instead

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions