Skip to content

Re-export chain not working as expected #1751

Closed
@saulecabrera

Description

@saulecabrera

Given a directory structure like the one below:

.
├── asconfig.json
├── assembly
│   ├── bar
│   ├── common.ts
│   ├── foo
│   ├── index.ts
│   ├── reexport.ts
│   └── tsconfig.json
├── index.js
├── package-lock.json
├── package.json
└── tests
    └── index.js

5 directories, 15 files

where:

foo and bar are directories that contain two files each:

//index.ts

export * from '<foo|bar>';
// Foo | Bar

export class <Foo | Bar> {
}

common.ts aggregates the imports from Foo and Bar:

import * as Foo from './foo';
import * as Bar from './bar';

export {Foo, Bar};

and reexport just reexports everything in common:

export * from './common';

When trying to import * from reexport, the following compilation error is raised:

ERROR TS2305: Module 'assembly/reexport' has no exported member 'Foo'.

 import {Foo, Bar} from './reexport';
         ~~~
 in assembly/index.ts(4,9)

If the named export in common.ts is replaced by a star export, things work:

export * from './bar';
export * from './foo'

Is this expected?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions