Skip to content

TS error in eslint.config.mts "Type 'Config[]' is not assignable to type 'ExtendsElement[]'." #4961

@PBonnema

Description

@PBonnema

Which @ngrx/* package(s) are the source of the bug?

eslint-plugin

Minimal reproduction of the bug/regression with instructions

  • Generate a new eslint config file with npx eslint --init.
  • Choose TypeScript as the language for the new config file.
  • Add the NgRx ESLint plugin to the new eslint.config.mts according to these instructions https://ngrx.io/guide/eslint-plugin#eslint-v9.
  • You encounter a typescript error about a type mismatch on the extends part: extends: [...ngrx.configs.all]
Type 'Config[]' is not assignable to type 'ExtendsElement[]'.
  Type 'Config' is not assignable to type 'ExtendsElement'.
    Type 'Config' is not assignable to type 'Config<RulesRecord>'.
      Types of property 'languageOptions' are incompatible.
        Type 'import("d:/repos/Fourth-World/node_modules/@typescript-eslint/utils/dist/ts-eslint/Config").FlatConfig.LanguageOptions | undefined' is not assignable to type 'import("d:/repos/Fourth-World/node_modules/eslint/lib/types/index").Linter.LanguageOptions | undefined'.
          Type 'import("d:/repos/Fourth-World/node_modules/@typescript-eslint/utils/dist/ts-eslint/Config").FlatConfig.LanguageOptions' is not assignable to type 'import("d:/repos/Fourth-World/node_modules/eslint/lib/types/index").Linter.LanguageOptions'.
            Types of property 'parser' are incompatible.
              Type 'LooseParserModule | undefined' is not assignable to type 'Parser | undefined'.
                Type '{ meta?: { name?: string | undefined; version?: string | undefined; } | undefined; parseForESLint(text: string, options?: unknown): { ast: unknown; scopeManager?: unknown; services?: unknown; visitorKeys?: unknown; }; }' is not assignable to type 'Parser | undefined'.
                  Type '{ meta?: { name?: string | undefined; version?: string | undefined; } | undefined; parseForESLint(text: string, options?: unknown): { ast: unknown; scopeManager?: unknown; services?: unknown; visitorKeys?: unknown; }; }' is not assignable to type 'ObjectMetaProperties & { parseForESLint(text: string, options?: any): ESLintParseResult; }'.
                    Type '{ meta?: { name?: string | undefined; version?: string | undefined; } | undefined; parseForESLint(text: string, options?: unknown): { ast: unknown; scopeManager?: unknown; services?: unknown; visitorKeys?: unknown; }; }' is not assignable to type '{ parseForESLint(text: string, options?: any): ESLintParseResult; }'.
                      The types of 'parseForESLint(...).ast' are incompatible between these types.
                        Type 'unknown' is not assignable to type 'Program'.ts(2322)
  • Additionally, you get another error in your regular code files:
Image
  • The result is that the plugin does not work at all.
  • When you use a JS version of eslint.config.mts, then the errors are slightly different because you don't see the type error (it's JS) but the end result is that same as in the plugin being broken.

Expected behavior

I expected the type of ngrx.configs.all to be compatible with the extends field in the object array which is the parameter of defineConfig() in the eslint config file such that the NgRxplugin works again with ES lint.

Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)

> npm ls
<omitted>
  ├── @angular-eslint/[email protected]
  ├── @angular-eslint/[email protected]
  ├── @angular-eslint/[email protected]
  ├── @angular-eslint/[email protected]
  ├── @angular-eslint/[email protected]
  ├── @angular/[email protected]
  ├── @angular/[email protected]
  ├── @angular/[email protected]
  ├── @angular/[email protected]
  ├── @angular/[email protected]
  ├── @angular/[email protected]
  ├── @angular/[email protected]
  ├── @angular/[email protected]
  ├── @angular/[email protected]
  ├── @angular/[email protected]
  ├── @angular/[email protected]
  ├── @eslint/[email protected]
  ├── @eslint/[email protected]
  ├── @eslint/[email protected]
  ├── @eslint/[email protected]
  ├── @microsoft/[email protected]
  ├── @ngrx/[email protected]
  ├── @ngrx/[email protected]
  ├── @ngrx/[email protected]
  ├── @ngrx/[email protected]
  ├── @ngrx/[email protected]
  ├── @ngrx/[email protected]
  ├── @ngrx/[email protected]
  ├── @ngrx/[email protected]
  ├── @ngrx/[email protected]
  ├── @types/[email protected]
  ├── @types/[email protected]
  ├── [email protected]
  ├── [email protected]
  ├── [email protected]
  ├── [email protected]
  ├── [email protected]
  ├── [email protected]
  ├── [email protected]
  ├── [email protected]
  ├── [email protected]
  ├── [email protected]
  ├── [email protected]
  ├── [email protected]
  ├── [email protected]
  └── [email protected]

Node.js v24.8.0
On Windows 11

Other information

No response

I would be willing to submit a PR to fix this issue

  • Yes
  • No

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions