-
-
Notifications
You must be signed in to change notification settings - Fork 670
Re-export chain not working as expected #1751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This may well be a bug, hmm. Just one thing I notice is that // common.ts
import * as Foo from './foo';
import * as Bar from './bar';
export {Foo, Bar}; is not equivalent to // common.ts
export * from './bar';
export * from './foo' in that the former introduces new namespaces, i.e. the class |
Yeah exactly, it's probably the namespacing that's causing the issue here as per my investigation. I provided both examples just to make it (hopefully) clearer. |
Just so I understand correctly, does the equivalent to the star exports work? // common.ts
import { Foo } from './foo';
import { Bar } from './bar';
export {Foo, Bar}; |
Oh my bad, I misinterpreted your previous comment. The equivalent of the star exports doesn't work either. I get the same error. The namespacing might not be the issue after all. |
In this case, we are very likely looking at a perhaps not-so-trivial bug here, thanks :) |
Hey, I will give this bug a try. When I reproduce, the "equivalent of the star exports" works for me. /** assembly/foo/foo.ts **/
export const Foo = 123;
/** assembly/foo/index.ts **/
export * from './foo';
/** assembly/common.ts **/
import * as Foo from './foo';
export {Foo};
// export * from './foo'; // <-- WORKS
/** assembly/reexport **/
export * from './common';
/** assembly/index.ts **/
import {Foo} from './reexport'; Running
One more note, Will do more digging! |
@dcodeIO @saulecabrera Is there a way to execute the program without importing all the default helpers functions? There are about 40 default import that makes it a little hard to debug. I used conditioned breaking point, but wondering if there is clever way. |
I guess what you are seeing there are the imports across stdlib. These are necessary unfortunately to set the program up, since otherwise compilation would not work. One workaround could be to check whether the current file path of interest starts with |
Was able to reduce this a bit: // index.ts
import { Foo } from './reexport'; // reexport.ts
export * from './common'; // changing to `export { Foo }` suppresses the problem // common.ts
export { Foo } from "./foo"; // foo.ts
export class Foo {
} So there seems to be something going on with the |
Given a directory structure like the one below:
where:
foo
andbar
are directories that contain two files each:common.ts
aggregates the imports from Foo and Bar:and
reexport
just reexports everything incommon
:When trying to import
*
fromreexport
, the following compilation error is raised:If the named export in
common.ts
is replaced by a star export, things work:Is this expected?
The text was updated successfully, but these errors were encountered: