Skip to content

Conversation

@k-yle
Copy link
Contributor

@k-yle k-yle commented Oct 7, 2025

Currently, this code:

import type * as X from 'foo';
export type { X };

is autofixed to this:

export * as X from 'foo';

which is missing the type modifier.

This PR fixes the issue. First commit adds a test case, second commit fixes the bug

@github-actions github-actions bot changed the title fix(prefer-export-from): type-import removed when using namespace import fix(prefer-export-from): type-import removed when using namespace import Oct 7, 2025
@k-yle k-yle force-pushed the kh/namespace-import-type branch from 59b7962 to deda324 Compare October 7, 2025 08:23
`␊
1 |␊
2 |␊
3 | export type * as X from 'foo';␊
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one seems unsafe to autofix, the imported module may have side effects.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, fixed in deda324...4345915.

the other cases get import type, this case does not.

@k-yle k-yle force-pushed the kh/namespace-import-type branch from deda324 to 4345915 Compare October 10, 2025 08:48
`␊
1 |␊
2 |␊
3 | export * as X from 'foo';␊
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this also change the behavior, it only expose type before, now it expose values. Maybe we can export type but not remove the import.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants