Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Bug: error TS2742 in eslint.config.mjs with "composite": true and pnpm #10893

Copy link
Copy link
Open
@andersk

Description

@andersk
Issue body actions

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.

Issue Description

In a project configured with "composite": true and installed with pnpm, TypeScript flags error TS2742 in this minimal eslint.config.mjs.

// @ts-check
import tseslint from "typescript-eslint";
export default tseslint.config(tseslint.configs.recommended);

eslint.config.mjs:3:1 - error TS2742: The inferred type of 'default' cannot be named without a reference to '.pnpm/@typescript-eslint+utils@8.25.0_eslint@9.21.0_typescript@5.7.3/node_modules/@typescript-eslint/utils/ts-eslint'. This is likely not portable. A type annotation is necessary.

Full tsconfig.json:

{
  "compilerOptions": {
    "allowJs": true,
    "composite": true,
    "module": "nodenext",
    "noEmit": true,
    "strict": true
  }
}

The error is not shown without "composite": true, nor is it shown when using npm instead of pnpm.

Related:

Reproduction Repository Link

https://gist.github.com/andersk/44d8dd0d3c2508f758bf51e5cbf12c2f

Repro Steps

$ git clone https://gist.github.com/andersk/44d8dd0d3c2508f758bf51e5cbf12c2f test
$ cd test
$ pnpm i
Packages: +116
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 116, reused 116, downloaded 0, added 116, done

dependencies:
+ eslint 9.21.0
+ typescript 5.7.3
+ typescript-eslint 8.25.0

Done in 1.9s using pnpm v10.5.1

$ pnpm exec tsc
eslint.config.mjs:3:1 - error TS2742: The inferred type of 'default' cannot be named without a reference to '.pnpm/@typescript-eslint+utils@8.25.0_eslint@9.21.0_typescript@5.7.3/node_modules/@typescript-eslint/utils/ts-eslint'. This is likely not portable. A type annotation is necessary.

3 export default tseslint.config(tseslint.configs.recommended);
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 1 error in eslint.config.mjs:3

Versions

package version
@typescript-eslint/eslint-plugin 8.25.0
@typescript-eslint/parser 8.25.0
@typescript-eslint/scope-manager 8.25.0
@typescript-eslint/typescript-estree 8.25.0
@typescript-eslint/type-utils 8.25.0
@typescript-eslint/utils 8.25.0
TypeScript 5.7.3
ESLint 9.21.0
node 22.14.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuebugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomerspackage: typescript-eslintIssues related to the typescript-eslint packageIssues related to the typescript-eslint package

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.