preact-redux icon indicating copy to clipboard operation
preact-redux copied to clipboard

Error with Typescript >= 2.9: Type 'keyof T' does not satisfy the constraint 'string'

Open greengiraffe opened this issue 7 years ago • 1 comments

Using Typescript >= 2.9 an error occurs while bundling a typescript/preact/preact-redux project due to some breaking changes regarding keyof.

Versions I'm using:

[email protected]
[email protected]

The error:

ERROR in [at-loader] ./node_modules/preact-redux/src/preact-redux.d.ts:16:48
    TS2344: 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'.

A quick fix suggested over at https://github.com/Microsoft/TypeScript/issues/25260#issuecomment-400600877 is to set "keyofStringsOnly": true in the tsconfig.json

greengiraffe avatar Jul 08 '18 11:07 greengiraffe

I just noticed that this will probably be fixed with this PR: https://github.com/developit/preact-redux/pull/30

greengiraffe avatar Jul 08 '18 12:07 greengiraffe