Commit Graph

37 Commits

Author SHA1 Message Date
Eric Anderson
6bf1827a0a Adjust React's setState to work in more edge cases (#22236)
* Adjust React's setState to work in more edge cases

Fixes DefinitelyTyped/DefinitelyTyped#22230
Fixes DefinitelyTyped/DefinitelyTyped#18365

* Restore test and naming I lost
2017-12-15 21:50:19 +00:00
Eric Anderson
62c2219a6e Fix setState to work in callback form and to allow partial intellisense (#22127)
* 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
2017-12-13 23:15:45 +00:00
Bowden Kelly
8f8dda2fd4
Merge pull request #21895 from appsforartists/borderRadius
Add borderRadius to @types/react
2017-12-06 13:37:09 -08:00
John Gozde
d105bd4c8d Use ComponentType for React.Fragment 2017-12-04 10:27:42 -07:00
Brenton Simpson
cfc910c1d0 Replaced tslint-disable with tsline-disable-line
These aren't lines this PR otherwise touches, but it won't build without them.
2017-12-01 16:30:31 -08:00
Brenton Simpson
8ca44be1a4 Fixed borderRadius types
React's `borderRadius` [can only be](https://github.com/facebook/react/blob/master/packages/react-dom/src/shared/dangerousStyleValue.js) a `string` or a `number`, so the type should reflect that.

See also #20743
2017-12-01 16:30:30 -08:00
Benjamin Lichtman
b4855506d3
Merge pull request #21146 from uniqueiniquity/jsxFragment
Add React.Fragment to top-level API in React
2017-11-30 16:50:24 -05:00
Igor Oleinikov
ecabf5526f
Merge pull request #20987 from pelotom/patch-10
[react] Make component constructor props non-optional
2017-11-08 13:58:44 -08:00
Rasmus Eneman
4657bbe7ac fix rendering types for React 16 2017-11-01 14:33:09 +01:00
uniqueiniquity
4d07771b6c Add create fragment test 2017-10-31 10:19:43 -07:00
uniqueiniquity
f6904a2eab Update test 2017-10-31 08:50:40 -07:00
Tom Crockett
e9f19bb876 Make component constructor props non-optional 2017-10-24 17:45:37 -07:00
John Gozde
bbf3e9cb0b [react]: Remove deprecated+removed APIs (#20409)
* create-react-class: add definitions

* react-dom-factories: add definitions

* create-react-class: add tests, fix errors

* react-dom-factories: add tests, fix lint

* react: remove previously deprecated APIs

* Remove deprecated usages in other definitions

* redux-form: disable strictFunctionTypes

Changes to react typings revealed errors in redux-form that are present
in 'master'. This needs to be handled separately.

* Update create-react-class, react-dom-factories author

* Avoid importing create-react-class where possible

* Move top-level createReactClass tests to create-react-class
2017-10-16 15:22:04 -07:00
cynecx
0b21b7dd63 [react] [react-dom] Add support for rendering an array of elements (#19363)
* 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.
2017-10-06 19:08:29 +01:00
Steven
e54b30fafc react-dom: Upgrade to v16.0.0 (#20065)
* 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
2017-10-02 16:08:01 -07:00
York Yao
29ca22c8b0 [React] change createElement declaration (#19858)
* fix https://github.com/Microsoft/TypeScript/issues/15019

* change the stable v15 declaration too

* catch-all case also take string

* add string for test
2017-09-26 01:14:17 +09:00
Andy
cf0172024a react: Fix compile error (#19210)
* react: Fix compile error

* Better fix: Use InputHTMLAttributes

* Use a separte overload just for "input"
2017-08-22 06:06:49 +01:00
Andy
5d6c651a1a Apply stricter lint rules (#19063) 2017-08-17 14:53:41 -07:00
Nathan Shively-Sanders
cc271b097d Merge branch 'master' into improve-react-domelement-type-parameter 2017-07-06 09:37:55 -07:00
Dovydas Navickas
929b4a206d Fixes for comments. 2017-06-29 20:57:10 +03:00
Dovydas Navickas
fc3bbed6db React.cloneElement overloads for ReactHTMLElement and SVGElement added. 2017-06-29 17:44:15 +03:00
Dovydas Navickas
d3901d1290 Tslint disabling updated to disable only one line. 2017-06-29 15:28:23 +03:00
Dovydas Navickas
e94d1c1c03 React tslint errors fixed. 2017-06-29 14:43:22 +03:00
Nathan Shively-Sanders
0d61b71678 Improve React.DOMElement type parameter for 2.4 weak type checks
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.
2017-06-28 09:39:36 -07:00
Dovydas Navickas
9e62632e24 Added tslint.json for react. 2017-06-28 15:03:32 +03:00
Nathan Shively-Sanders
0a2007983a createElement splits SVG/HTML props based on type parameter
This is required for 2.4 to avoid a weak type error since DOMAttributes
is a weak type.
2017-06-26 11:26:52 -07:00
Gaspard Bucher
3d4ac4abf9 [types/react] Allow null return from stateless components.
Fixes #14064
2017-06-26 16:16:07 +02:00
Tanguy Krotoff
b0c9072f43 Change React.Component<P, ...> to React.Component<P = {}, ...> 2017-06-21 09:47:00 +02:00
Tanguy Krotoff
b81d97133a Merge branch 'master' into react-default-type-arguments 2017-06-20 22:39:06 +02:00
Albert Kurniawan
f3527f0040 Updated Ref signature to handle null cases 2017-06-20 10:16:26 +10:00
Tanguy Krotoff
ea9de8a518 Replace React.Component<(.*), (any|void|\{\}|null)> by React.Component<$1>
+ many manual adjustments
2017-06-19 13:35:50 +02:00
Tanguy Krotoff
3c9eba9d3f Change React.Component<P, S> to React.Component<P, S = {}> 2017-06-19 13:35:47 +02:00
Tanguy Krotoff
27acfc741a Change require('react') to import * as React from 'react' 2017-06-19 12:09:31 +02:00
Nathan Shively-Sanders
4874667de9 Fix primitive weak type errors
These weak type errors were not caught in TS 2.4 RC. The final TS 2.4
will catch weak type errors with primitives, so this PR fixes those
now-caught errors.
2017-06-15 11:46:46 -07:00
Wayne Dela Cruz
e4c860c1ba React specific typings for css position (#15575)
* React CSSProperties position made specific

* Add test for css position
2017-04-17 08:34:07 -07:00
Wayne Dela Cruz
6f8a10f1a1 Wrote tests for css overflow props 2017-03-28 21:12:19 +08:00
Andy Hanson
354cec620d Move all packages to a types directory 2017-03-24 14:27:52 -07:00