* Add getSnapshotBeforeUpdate test for React.createElement
* Add test for using component with new lifecycles
* Add test for pure component with new lifecycle methods
* Chage react snapshot SS to default to any
* Add new RenderProps-style Context from React 16.3
React 16.3 has a new recommended API for Context, with new Context, Provider, and Consumer typings.
* Add overload for createContext() to be called with no arguments
* Fix syntax
* Refactor out Props for Consumer & Provider
* feat(react): add forwardRef and createRef functions
* fix(tests): fix failing tests
- datepicker needs to be updated to use optional generic types since it was using ClassAttributes incorrectly
* [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
* Add new lifecycle events to React (16.3)
* Add tests, fix lint
* Bump version
* Improve inference of snapshot
* Improve tests
* Correctly support returning partial state from getDerivedStateFromProps
* Remove redundant type
* Fix lint error
* Write the incorrect subclassing test in a more verbose way
Allow setState to accept an updater which is null or is a function that
may return null.
In React 16, passing null to setState or returning null from the updater
function does not cause an update.
* Fix setState to work in callback form and to allow partial intellisense
* Fix lint and add tests
* Fix more lint
* Fixing more lint errors i didnt cause
* Add another test case
* Fix more lint
* Test
* Fix react typings
* Revert "Use []-syntax for some cases."
This reverts commit 5f6e55843980b2cff9ace4174f72b4f8aa7ad278.
* Modify another render function's return type
* Use Array<T> instead in react.d.ts & Fix issues with the typescript linter & Adapt changes in react-router
* Convert Array<T> to T[]
* Add support for string and number return types.
* Add hydrate method
* Add hydrate to react-dom-tests.ts
* Fix whitespace
* Create shared interface for `render` and `hydrate`
* Add renderToNodeStream and renderToStaticNodeStream methods in ReactDomServer
* Add proper nodejs.readablestream
* Add react-dom v15 for backwards compatibility
* Add proper baseUrl for react-dom/v15
* Change react test _interval type to NodeJS.Timer
* Export the renderer interface
* Change react/v15 to use NodeJS.Timer
DOMAttributes, HTMLAttributes and SVGAttributes are all weak types.
In React.DOMElement, people always pass either HTMLAttributes or
SVGAttributes, so the type parameter is just constrained to
DOMAttributes. This is not as good as a union of (HTML | SVGAttrs) for 2
reasons:
1. Valid HTMLAttributes objects that don't include some DOMAttributes
properties fail TS 2.4's weak type check.
2. Invalid HTMLAttributes objects don't get type checking for
HTMLAttributes properties.
For example:
```ts
var e: React.DOMElement<{
style: {
checked: "no"
}
}, Element>;
```
But `checked` is actually a boolean. Previously, this was not an error.