-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Bug: error TS2742 in eslint.config.mjs with "composite": true
and pnpm
#10893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is very similar to an issue that eslint upstream also had. Pnpm's linking installs plays a bit funky with typescript so it needs the package to declare some additional type exports for it to work. |
I had the same error, but using a slightly different setup without tseslint.config(). I solved it by adding "eslint.config.mjs" to the exclude array in my tsconfig.json. |
Upstream related issue: ESLint recommended workaround: |
Thanks for the hint @ntnyq I can confirm this also works for me |
Hi, I've looked into this
Based on those, here are a few ways to address this issue—(just select the one suits your project):
Footnotes |
Uh oh!
There was an error while loading. Please reload this page.
Before You File a Bug Report Please Confirm You Have Done The Following...
Issue Description
In a project configured with
"composite": true
and installed with pnpm, TypeScript flags error TS2742 in this minimaleslint.config.mjs
.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
:The error is not shown without
"composite": true
, nor is it shown when using npm instead of pnpm.Related:
tseslint.config()
usage examples #10508Reproduction Repository Link
https://gist.github.com/andersk/44d8dd0d3c2508f758bf51e5cbf12c2f
Repro Steps
Versions
@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
The text was updated successfully, but these errors were encountered: