Skip to content

TypeScript error when trying to use config in extends with typescript-eslint #439

@TrevorBurnham

Description

@TrevorBurnham

Consider this eslint.config.mjs:

// @ts-check
import { defineConfig } from "eslint/config";
import eslint from "@eslint/js";
import importX from "eslint-plugin-import-x";

export default defineConfig({
  ignores: ["build/"],
  extends: [
    eslint.configs.recommended,
    importX.flatConfigs.recommended // TypeScript error
  ],
});

If you have typescript-eslint@8.48.0 installed, tsc complains:

eslint.config.mjs:10:5 - error TS2322: Type 'PluginFlatConfig' is not assignable to type 'ExtendsElement'.
  Type 'PluginFlatConfig' is not assignable to type 'ConfigObject<RulesConfig>'.
    Types of property 'languageOptions' are incompatible.
      Type 'import("/project/workspace/node_modules/.pnpm/@typescript-eslint+utils@8.48.0_eslint@9.39.1_typescript@5.9.3/node_modules/@typescript-eslint/utils/dist/ts-eslint/Config").FlatConfig.LanguageOptions' is not assignable to type 'import("/project/workspace/node_modules/.pnpm/@eslint+core@0.17.0/node_modules/@eslint/core/dist/esm/types").LanguageOptions'.
        Index signature for type 'string' is missing in type 'LanguageOptions'.

10     importX.flatConfigs.typescript
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I haven't seen this issue with any other ESLint library that exports flat configs.

Here's a reproduction: https://codesandbox.io/p/devbox/objective-ganguly-h4h4v7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions