-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
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 workingpackage: type-utilsIssues related to the @typescript-eslint/type-utils packageIssues related to the @typescript-eslint/type-utils package
Description
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have read the FAQ and my problem is not listed.
Repro
type TestTest1 = ReadonlyArray<string> & Readonly<{ foo: string; }>;
type TestTest2 = Readonly<ReadonlyArray<string>> & Readonly<{ foo: string; }>;
isTypeReadonly(checker, type, {})
Expected Result
isTypeReadonly
should return true
Actual Result
isTypeReadonly
returns false
Additional Info
The error seems to be that TypeScript treats Readonly<ReadonlyArray<string>>
the same as ReadonlyArray<string>
and thus the methods are still mutable. We need a special case to handle intersections with readonly arrays.
Versions
package | version |
---|---|
@typescript-eslint/type-utils |
5.9.0 |
TypeScript |
4.5.4 |
node |
17.1.0 |
Metadata
Metadata
Assignees
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 workingpackage: type-utilsIssues related to the @typescript-eslint/type-utils packageIssues related to the @typescript-eslint/type-utils package