Skip to content

Bug: EcmaVersion type is out of sync vs-a-vs [email protected] #11307

Closed
@abrahamguo

Description

@abrahamguo

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Relevant Package

types

Playground Link

No response

Repro Code

import { Linter } from "eslint";
import tseslint from "typescript-eslint";

declare const x: Linter.Config;

tseslint.config(x);

tsconfig

{ "compilerOptions": { "module": "nodenext" } }

Expected Result

No TS errors should be reported.

Actual Result

A TS error was reported:

index.ts:6:17 - error TS2345: Argument of type 'Config<RulesRecord>' is not assignable to parameter of type 'InfiniteDepthConfigWithExtends'.
  Type 'Config<RulesRecord>' is not assignable to type 'ConfigWithExtends'.
    Types of property 'languageOptions' are incompatible.
      Type 'import("node_modules/eslint/lib/types/index").Linter.LanguageOptions | undefined' is not assignable to type 'import("node_modules/@typescript-eslint/utils/dist/ts-eslint/Config").FlatConfig.LanguageOptions | undefined'.
        Type 'import("node_modules/eslint/lib/types/index").Linter.LanguageOptions' is not assignable to type 'import("node_modules/@typescript-eslint/utils/dist/ts-eslint/Config").FlatConfig.LanguageOptions'.
          Types of property 'ecmaVersion' are incompatible.
            Type 'EcmaVersion | undefined' is not assignable to type 'EcmaVersion'.
              Type '17' is not assignable to type 'EcmaVersion'.

6 tseslint.config(x);

Additional Info

This is a regression beginning in ESLint 9.29.

This will surface itself if you are using a predefined config for an ESLint plugin that defines its types using types from eslint.

Obviously, this is trivial to fix, but is it worth discussing a more permanent solution to this, so that we don't have to keep manually keeping this in sync with ESLint?

Should we have some sort of automated test to catch this?

Versions

package version
@typescript-eslint/types 8.34.0
ESLint 9.29.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.triageWaiting for team members to take a look

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions