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

Bug:prefer-return-this-type report and fixes code to one with TS errors #11225

Open
Labels
bugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugintriageWaiting for team members to take a look
@Lightning00Blade

Description

@Lightning00Blade

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 havesearched for related issues and found none that matched my issue.
  • I haveread the FAQ and my problem is not listed.

Playground Link

https://typescript-eslint.io/play/#ts=5.8.2&fileType=.tsx&code=MYGwhgzhAEBCkFNoG8BQ1oEsIAlMBN8EA7ALmgCMB7KkBMY6AXmgBcAnAVwQG51oImCiEzEA5uXgQkAH2jFOIEM3mKQfDADMAFAEpJiaHIVKU-DJk3RtAQlYALbADpseQiV1mM36OwStOdkYHbA1vAF9zX39A4McIJ0FhUTEwyMjUUEgYAGUEYCpifC8sXAIiMkoaOgYVDm4wpJFxcjyCoqNVUxYTdX4dfTZ4zt6SiytbEITXco8x7z8AoKHQqMifRdiVhKaUtNRwoA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Y6RAM0Wls-yxoTWvgAWlZKJKJ0UXtAD20SODABfEOqA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false

Repro Code

classBase{isHidden:boolean=true;sibling:Base|null=null;f():Base|null{if(!this.isHidden){returnthis;}returnthis.sibling;}}classSecond{isHidden:boolean=true;sibling:Second|null=null;f(): this|null{if(!this.isHidden){returnthis;}returnthis.sibling;}}

ESLint Config

module.exports={parser:"@typescript-eslint/parser",rules:{"@typescript-eslint/prefer-return-this-type":"error"},};

tsconfig

{"compilerOptions": {// ...  }}

Expected Result

The code is marked as valid

Actual Result

EsLint report an error, after fixer is applied TypeScript shows an error.

Additional Info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpackage: 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


      [8]ページ先頭

      ©2009-2025 Movatter.jp