This allows passing children to `StatelessComponent<P>` exactly like base components without the need to use React.Props<T> or extending the P interface with an explicit 'children' property:
# Before
````typescript
type FooProps = {
bar: number;
}
const Foo: React.SFC<FooProps> = props => (
<div>
{props.children} = {props.bar} // error TS2459: Type 'FooProps' has no property 'children' and no string index signature.
</div>
);
````
# After
````typescript
type FooProps = {
bar: number;
}
const Foo: React.SFC<FooProps> = props => (
<div>
{props.children} = {props.bar}
</div>
);
<Foo bar="42">6×9</Foo> // <div>6×9 = 42</div>
````
* For ReactDOM.render, make element parameter nullable to match React API and match Typescript 2.0 definition for Document.getElementById
* one more test
this allows getting the actual html element type from events.
Example:
```ts
render() {
return <input onChange={e => console.log(e.target.value)}/>
}
```
Previously you would have to cast the target manually:
```ts
render() {
return <input onChange={e => console.log((e.target as
HTMLInputElement).value)}/>
}
```
* SyntheticEventData extends browser Event
From https://facebook.github.io/react/docs/events.html
Your event handlers will be passed instances of SyntheticEvent, a
cross-browser wrapper around the browser's native event. It has the same
interface as the browser's native event, including stopPropagation() and
preventDefault(), except the events work identically across all
browsers.
* make react synthetic event properties optional
* Allow specifying `void` for component state type parameter.
Per comments on https://github.com/DefinitelyTyped/DefinitelyTyped/pull/8543,
the type parameter for component state was changed to `{}` from `any` for
increased type safety, but prevents specifying (non-functional) stateless
components without having empty state parameters, which seems messy. This
changes the type to `{} | void` to allow this while staying stricter than
`any`.
* Make react tests a bit more strict.
* Rename State -> ComponentState to make it a bit more explicit.
- `StatelessComponent` is missing an optional `displayName` property
- `ReactChildren.only` always returns a `ReactElement`
- add tests for the above and `ReactTestUtils.renderIntoDocument`
- Also add image to JSX.IntrinsicElements
- Add tests for callback and string refs
- Fix bug where Component<P, S> subclasses are required to have defaultProps