Skip to content

Unexpected "An index signature parameter type must be 'string' or 'number'." error with string union type. #8711

Closed
@Strate

Description

@Strate

TypeScript Version:

1.8.10

Code

type StringEnum = "one" | "two"

interface IndexedObject {
  [index: StringEnum]: boolean
}

Expected behavior:
No error

Actual behavior:
error TS1023: An index signature parameter type must be 'string' or 'number'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions