Skip to content

Type 'keyof T' does not satisfy the constraint 'string'. #25260

Description

TypeScript Version: 3.0.0-dev.201xxxxx
Issue still happens on dev version.

Search Terms: keyof T

Code

I am getting this error in Typescript 2.9.

(106,55): Type 'keyof T' does not satisfy the constraint 'string'.
  Type 'string | number | symbol' is not assignable to type 'string'.
    Type 'number' is not assignable to type 'string'.

This is the line that deals with keyof T in the react router types index.d.ts

type Omit<T, K extends keyof T> = Pick<T, ({ [P in keyof T]: P } & { [P in K]: never } & { [x: string]: never, [x: number]: never })[keyof T]>;

Expected behavior:
When I used Typescript 2.8 this error did not show up. However, when I updated Typescript the error showed up. The react router types should work properly like in 2.8.

Actual behavior:
I am getting the error above.

Playground Link:
No link but I am using react router with Typescript.

Related Issues:
No related issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions