Skip to content
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

Type exports should be ignored #47

Closed
silverwind opened this issue Aug 21, 2024 · 2 comments
Closed

Type exports should be ignored #47

silverwind opened this issue Aug 21, 2024 · 2 comments

Comments

@silverwind
Copy link

silverwind commented Aug 21, 2024

In TypeScript, a type export currently triggers react-refresh/only-export-components:

type foo = string;
export const Foo = () => null;
export type {foo}; // error: Fast refresh only works when a file only exports components. Use a new file to share constants or functions between components.

As far as I understand, type aliases have no runtime behaviour and therefor should not prevent fast refresh.

@ArnaudBarre
Copy link
Owner

Funny I though I exclude them but never ran into it because types often follow PascalCase naming convention

@silverwind
Copy link
Author

silverwind commented Aug 22, 2024

Yeah, my own types are always PascalCase too, but in this case I was re-exporting a lowercase type from another module (type editor from monaco-editor).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants