Skip to content

typeof shouldn't count as a use of a variable with noUnusedLocals #28676

Closed
@sandersn

Description

@sandersn

Search Terms:
unused local typeof variable noUnusedLocals

Code

// @noUnusedLocals: true
import { x } from "something"
export type X = typeof x

Expected behavior:
An error on import { x }, "x is never used"

Actual behavior:
No error

Related Issues:
This bug was fixed in #28528 and then reverted in #28675 because it broke a common pattern in Redux type exports, as documented in #28620. However, it still seems correct (at least, technically correct) that a reference to x in typeof x shouldn't count as a use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions