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: [no-shadow] inconsistent reports on function parameter names inside ambient declarations clashing with real variable declarations #10539

Closed
Labels
accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workinglocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: eslint-pluginIssues related to @typescript-eslint/eslint-plugin
@andreww2012

Description

@andreww2012

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.6.3&fileType=.tsx&code=CYUwxgNghgTiAEkoGdnwMoHsC2IDC0qAjPAN4CwAUPIpgHbIAuMArmI5jABRj1OvtOABVhRsALnhQ6ATwCUAbio1kOEAFkQjABaZgXXDr0iYYydPlLq8Vbk1HgAdQCWOgKIAPAA4RnYVwBKWiwwdAAqMl4gBlq6wCZiAPrmsnKS-M50AOZWNAD0efAAUixMUvAAZiAA7vDYnAiMIEzIAHTtyjZq9nEAgmBgIF6MmVl4UBAQAEZQYADWPBPTs3OSMQ4JElKp8AC8AHzblp22IEIwmFEwjDJrsBfVAGIsdOzO9Jsp8nuHAG6YzmAVgAvlQKi83vRaAxmGwODBNlw5GR4KDKODXiMoYY4ojkaRUWCIVi6HVYsZRNhEkiUWiMZDSfdME9ie86HjaVQqAV4O1WhgxAhtFAvFE6KN4NVXNp4DoEGIps4QHRGJVWVDQEhTCTxFzKJroHA1Zi2V1cM8TfQuPSSZ8jml4P9AVYbabXR9KTSCcCrNzCnz4FMWKq6JhVVKdLLtPLsIrlarfrBnFAphAEAbRCT4FxEzA8mnGHleDD4CAPGIfM00nqM0bc2aQAA1JMptNrMBLGbzO0WZEHR0AoFEy2kjuTLtzDnehTwHm9CCqeCh0swC4wNDOCqO2D5rRFviq5xoUogYDwTJMEBQM-RuA18CGhAFhvNmDJ1MgAAyWnbnZWm2-Rgvj7P5BxddVRz-btKUAr1UV9fUH1gBBizKU5X3fNM8APX9x3-SlsJhYCfgHZ1hwZRAoMnAiDzgn09R5AA5TAVzXDctzlGxhWAZlTyXQVzzQAADXMhN1SgqFrFDCDQLBcAIFBkAAJjITpUNhQRuHUgR4U2JTgNyBsej0dZcUpfT7RBKh620uFhHMqx6xxClTGwJSEKk40KNOC0GWtCC9IdJ0h0oet3XZByGP9dp4E4eAhILMT7y1aTFIwNQFNQABmVTrFszSeAPHT7NcrKDJObpyX0Zz4kpMrLKoNFn3y3S6qsZ8as2LKPKQo1wobXySX8kcuqCsDrNgLzbTaqLeRiuKhPUpKJMQlLEBk9L5JkgAWXKaBazhCphYqEUpbbyusU5jOqqrNnOhrKDRdToX4OzTtc3bdmzEDaSsZ7OrOvZvpI6dksfKbTR8iDhoZO6xrI0LJvCu6rCAA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1uQAsBDACYcA7uiiJo0DtEjgwAXxDygA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false

Repro Code

The minimal reproduction is as follows:

declareclassSomeClass{someMethod(methodParam:any);// ❌ `'methodParam' is already declared in the upper scope`}functionmethodParam(){}

If, however,function methodParam is instead avar,let orconst declaration, the ESLint error is not triggered.

Quite a few more examples of this strange behavior are in the playground link.

ESLint Config

module.exports={parser:"@typescript-eslint/parser",rules:{"@typescript-eslint/no-shadow":"error"},};

tsconfig

{"compilerOptions": {"strictNullChecks":true  }}

Expected Result

The error should always be reported or not reported no matter with what type of declaration the name of the parameter inside an ambient declaration clashes.

I personally can't tell whether it's technically shadowing or not. Perhaps having an option to treat clashes between real and ambient declarations' names as shadowing issues could be the solution.

Actual Result

The current behavior seems inconsistent to me.

Additional Info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workinglocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    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