Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

[no-use-before-declare] False positive for keyof/typeof parameter types #3655

Closed
JoshuaKGoldberg opened this issue Jan 15, 2018 · 2 comments
Closed

Comments

@JoshuaKGoldberg
Copy link
Contributor

Bug Report

  • TSLint version: 5.9.1
  • TypeScript version: 2.7.0-dev*
  • Running TSLint via: (pick one) CLI / Node.js API / VSCode / grunt-tslint / Atom / Visual Studio / etc

TypeScript code being linted

interface IGroupTypes {
    Scenery: { type: "scenery "},
    Solid: { type: "solid" },
}

function addToGroup(thing: IGroupTypes[typeof groupName], groupName: keyof IGroupTypes): void {
    // ...
}

with tslint.json configuration:

{
    "rules": {
        "no-use-before-declare": true
    }
}

Actual behavior

ERROR: 6:47   no-use-before-declare  variable 'groupName' used before declaration

Expected behavior

There shouldn't be complaints about type parameters, as their types aren't runtime constructs.

@JoshuaKGoldberg
Copy link
Contributor Author

Marking this as very low priority because no-use-before-declare is no longer a recommended rule. Sorry, @JoshuaKGoldberg from January!

michaeldoberenz pushed a commit to SeedCompany/cord-field that referenced this issue Jan 4, 2019
@JoshuaKGoldberg
Copy link
Contributor Author

This might be re-opened per discussion in #4789.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant