developit / developit/preact-redux

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

Open
#31 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
285
Forks
26
PR merge metrics
No merged PRs in 30d

Description

Using Typescript >= 2.9 an error occurs while bundling a typescript/preact/preact-redux project due to some [breaking changes regarding `keyof`](https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#keyof-now-includes-string-number-and-symbol-keys).

Versions I'm using:

```
preact-redux@2.0.3
typescript@2.9.2
```

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_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.