-
-
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 TestType<T> = T extends number[] ? string[] : number[];
isTypeReadonly(checker, type, {})
Expected Result
isTypeReadonly
should return false
Actual Result
isTypeReadonly
returns true
for any conditional type.
Additional Info
Conditional types aren't being tested for and are thus being treated as primitives.
typescript-eslint/packages/type-utils/src/isTypeReadonly.ts
Lines 201 to 205 in 97c0e86
// all non-object, non-intersection types are readonly. | |
// this should only be primitive types | |
if (!isObjectType(type) && !isUnionOrIntersectionType(type)) { | |
return Readonlyness.Readonly; | |
} |
Versions
package | version |
---|---|
@typescript-eslint/type-utils |
5.9.0 |
@typescript-eslint/type-utils |
5.9.0 |
TypeScript |
4.5.4 |
node |
17.1.0 |
Also note the error in the template in Versions: @typescript-eslint/type-utils
's version is requested twice. I assume there is supposed to be only one or one is supposed to be @typescript-eslint/experimental-utils
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