Open
Description
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:
- Docs: add type annotation for
tseslint.config()
usage examples #10508 - fix(typescript-eslint): export types so that declarations can be named for dts files #10513 (merged in v8.18.2)
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
Labels
Go ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issueSomething isn't workingSomething isn't workingGood for newcomersGood for newcomersIssues related to the typescript-eslint packageIssues related to the typescript-eslint package