Skip to content

Bad error message for type used as index #25770

Description

TypeScript Version: 3.1.0-dev.20180717

Code

type S = "a" | "b";
type O = { [S]: number };

Expected behavior:

Error message telling me to use K in S.

Actual behavior:

src/a.ts:2:13 - error TS2693: 'S' only refers to a type, but is being used as a value here.

Activity

  1. ghost added
    BugA bug in TypeScript
    on Jul 18, 2018
  2. ghost added on Jul 18, 2018
  3. ghost added on Jul 18, 2018
  4. a-tarasyuk commented on Jul 18, 2018

    @a-tarasyuk
    Contributor
  5. DanielRosenwasser commented on Aug 21, 2020

    @DanielRosenwasser
    Member
  6. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions