Description
Is there an existing issue for this?
- I have searched the existing issues and my issue is uniqueMy issue appears in the command-line and not only in the text editor
Description Overview
This is a follow up of #3874, since flat
is Record<string, ReactFlatConfig>
, flat.xxx
or flat["xxx"]
could be undefined. The fix might be explicitly list recommended
, all
and jsx-runtime
as the key of the Record instead of using string
.

import tseslint from 'typescript-eslint'
import reactPlugin from 'eslint-plugin-react'
export default tseslint.config(
reactPlugin.configs.flat.recommended
)
Argument of type 'ReactFlatConfig | undefined' is not assignable to parameter of type 'InfiniteDepthConfigWithExtends'.
Expected Behavior
No type error
eslint-plugin-react version
v7.37.4
eslint version
9.17.0
node version
v22.13.0
Activity
fix(types): fix types of flat configs
ljharb commentedon Jan 14, 2025
To be clear, this is not a bug - the types are correct - but you're right they could be more helpful.
[-][Bug]: flat configs are possibly undefined[/-][+][enhancement]: flat configs are possibly undefined[/+]fix(types): fix types of flat configs
fix(types): fix types of flat configs
fix(types): fix types of flat configs
fix(types): fix types of flat configs
CHC383 commentedon Jan 14, 2025
Just to share a workaround for Typescript users until we figure out how to type the configs properly
fix(types): fix types of flat configs
6 remaining items