Skip to content

Bug: [@typescript-eslint/prefer-readonly-parameter-types] gives error "Cannot read properties of undefined (reading 'checkFlags')" #11289

Open
@stephen-carter-at-sf

Description

@stephen-carter-at-sf

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

When I have a dependency on
"@types/jest": "^29.5.14",
then I get the following error:


TypeError: Cannot read properties of undefined (reading 'checkFlags')
Occurred while linting /Users/stephen.carter/temp/typescript_eslint_bug/test/dummy.test.ts:5
Rule: "@typescript-eslint/prefer-readonly-parameter-types"
    at isTransientSymbolLinksFlagSet (/Users/stephen.carter/temp/typescript_eslint_bug/node_modules/ts-api-utils/lib/index.cjs:143:26)
    at isInConstContext (/Users/stephen.carter/temp/typescript_eslint_bug/node_modules/ts-api-utils/lib/index.cjs:994:16)
    at /Users/stephen.carter/temp/typescript_eslint_bug/node_modules/ts-api-utils/lib/index.cjs:1088:464
    at Array.some (<anonymous>)
    at symbolHasReadonlyDeclaration (/Users/stephen.carter/temp/typescript_eslint_bug/node_modules/ts-api-utils/lib/index.cjs:1087:145)
    at /Users/stephen.carter/temp/typescript_eslint_bug/node_modules/ts-api-utils/lib/index.cjs:1172:5
    at Array.some (<anonymous>)
    at isReadonlyPropertyIntersection (/Users/stephen.carter/temp/typescript_eslint_bug/node_modules/ts-api-utils/lib/index.cjs:1154:23)
    at Object.isPropertyReadonlyInType (/Users/stephen.carter/temp/typescript_eslint_bug/node_modules/ts-api-utils/lib/index.cjs:1059:41)
    at isTypeReadonlyObject (/Users/stephen.carter/temp/typescript_eslint_bug/node_modules/@typescript-eslint/type-utils/dist/isTypeReadonly.js:138:25)

If I remove this dependency then I don't get the error.

Specifically in my jest test file it doesn't seem to like parameters in my describe calls.

I'm not sure if the @typescript-eslint/prefer-readonly-parameter-types rule has a bug or there is a conflict or what. But it took me forever to reduce my project down to this super small reproduction steps.

Reproduction Repository Link

https://github.com/stephen-carter-at-sf/typescript_eslint_bug

Repro Steps

  1. clone the repo
  2. npm install
  3. npx eslint test/dummy.test.ts

Versions

"@types/jest": "^29.5.14",
"jest": "^29.7.0",
"@eslint/js": "^9.28.0",
"eslint": "^9.28.0",
"typescript": "^5.8.3",
"typescript-eslint": "^8.33.1"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingexternalThis issue is with another package, not typescript-eslint itselfpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugintriageWaiting 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