Commit Graph

20 Commits

Author SHA1 Message Date
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