Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bug: [no-shadow] false positive with augmented modules #5681

Closed
@dereli

Description

@dereli

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

Playground Link

https://typescript-eslint.io/play/#ts=4.8.3&sourceType=module&code=JYWwDg9gTgLgBDAnmApnA3nAsogKstAXzgDMoIQ4ByAOgHolUBnKgbgCh2ATFAYwBsAhlDQgIXAK780tBgRYZ2cBAWx5VAXgykIEAFxwmMKMAB2AcziEOhTigAekWHF4RTRuACNhBnPlRwWpgkugZUAIwATFRWHEA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1uQAsBDACYcA7uiiJo0DtEjgwAXxDygA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA

Repro Code

import type { MyType } from './types';

declare module './types' {
  type MyType = { foo: string };
}

export const bar: MyType = { foo: '' };

ESLint Config

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

tsconfig

No response

Expected Result

No error is expected on line 4 column 8.

Actual Result

Error is reported: 'MyType' is already declared in the upper scope on line 1 column 15.

Additional Info

No response

Versions

package version
@typescript-eslint/eslint-plugin 5.33.0
@typescript-eslint/parser 5.35.1
TypeScript 4.7.4
ESLint 8.23.0
node 16.14.2

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