Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[isTypeReadonly] Conditional types are always marked as readonly #4420

Closed
Labels
accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingpackage: type-utilsIssues related to the @typescript-eslint/type-utils package
@RebeccaStevens

Description

@RebeccaStevens
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I haveread the FAQ and my problem is not listed.

Repro

typeTestType<T>=Textendsnumber[] ?string[] :number[];
isTypeReadonly(checker,type,{})

Expected Result

isTypeReadonly should returnfalse

Actual Result

isTypeReadonly returnstrue for any conditional type.

Additional Info

Conditional types aren't being tested for and are thus being treated as primitives.

// all non-object, non-intersection types are readonly.
// this should only be primitive types
if(!isObjectType(type)&&!isUnionOrIntersectionType(type)){
returnReadonlyness.Readonly;
}

Versions

packageversion
@typescript-eslint/type-utils5.9.0
@typescript-eslint/type-utils5.9.0
TypeScript4.5.4
node17.1.0

Also note the error in the template inVersions:@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

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingpackage: type-utilsIssues related to the @typescript-eslint/type-utils package

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp