mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* [react] Workaround for --strictFunctionTypes
Under --strictFunctionTypes, when assigning a class with `getDerivedStateFromProps` to `React.ComponentClass` or `React.ComponentType`, the type of the second argument was expected to be `Readonly<any>`, which is, actually, the same as `Readonly<{}>`.
This was preventing using classes that try to refer to the previous state in `getDerivedStateFromProps` from being given to HOC factories.
There are no tests as testing this change is only possible with `--strictFunctionTypes`, and the `tsconfig.json` here specifically disables it. Perhaps another PR should enable it.
* Add a test anyway
Though it wouldn't have failed unless `--strictFunctionTypes` were enabled.
* Fix lint error on the test
|
||
|---|---|---|
| .. | ||
| cssProperties.tsx | ||
| index.ts | ||
| tsx.tsx | ||