Skip to content

[eslint-plugin-react-compiler] Fix type error with recommended config #32666

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

Merged
merged 1 commit into from
Mar 19, 2025

Conversation

niklasholm
Copy link
Contributor

Summary

In the recommended configuration for eslint-plugin-react-compiler, i.e. reactCompiler.configs.recommended, the rule is typed as string rather than eslint.Linter.RuleEntry or anything assignable thereto, which results in the following type error if you type check your eslint configuration:

Property ''react-compiler/react-compiler'' is incompatible with index signature.
  Type 'string' is not assignable to type 'RuleEntry | undefined'.

Simply adding a const assertion fixes the error.

How did you test this change?

I emitted declarations for the module and confirmed that the rule is now typed as the string literal 'error'

@niklasholm niklasholm changed the title Fix type error with recommended config [eslint-plugin-react-compiler] Fix type error with recommended config Mar 19, 2025
@poteto
Copy link
Member

poteto commented Mar 19, 2025

Thanks!

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

Successfully merging this pull request may close these issues.

3 participants