Bug: [no-shadow] Doesn't catch shadowing of global types in generics #5935
8000
Labels
accepting prs
Go ahead, send a pull request that resolves this issue
bug
Something isn't working
locked due to age
Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
Uh oh!
There was an error while loading. Please reload this page.
Before You File a Bug Report Please Confirm You Have Done The Following...
Playground Link
https://typescript-eslint.io/play/#ts=4.8.4&sourceType=module&code=MYGwhgzhAECyCeBhcUA8AJAKrAMgURAFMBbQgOwBcA+aAbwFgAoJgXyaYvgAdDpEBXCBQD2xTN14BeaGX7EARoQBOAbnaNQkGAmRbMAd2GoBQ0eJ40GzRm2uce0LLgIlyFaNKFKAlmQDmKkA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1uQAsBDACYcA7uiiJo0DtEjgwAXxDygA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA
Repro Code
See Playground link above
ESLint Config
See Playground link above
tsconfig
See Playground link above
Expected Result
I expected both the
HTMLElement
generic and theHTMLElement
type declaration to both be an error as they both shadow the global type of the same name. The type declaration does show an error (actually a TypeScript compiler error) but there is no error for shadowing the type via a generic. I'd expectno-shadow
to catch shadowing with generics.Actual Result
Only types which are defined in the module scope are identified as shadowing when used in generic declarations.
Additional Info
No response
Versions
@typescript-eslint/eslint-plugin
5.42.1
@typescript-eslint/parser
5.42.1
TypeScript
4.8.4
ESLint
8.15.0
The text was updated successfully, but these errors were encountered: