Commit Graph

66 Commits

Author SHA1 Message Date
Ron Buckton
b73b4426dd compatibility fix for keyof T in ts 2.9 2018-04-24 19:48:14 -07:00
Rahul Raina
b21ecf8eec Updated to pull from H.History 2018-03-08 23:16:57 -08:00
Andy Hanson
45c9246c09 Remove esModuleInterop from tsconfigs (no longer mandatory) 2018-02-14 14:55:13 -08:00
Forbes Lindesay
8f8f6c4392 [react] Use HTMLDialogElement for the dialog node (#23053)
* [react] Use HTMLDialogElement for the dialog node

* Actually add the `open` property

* This update requires typescript 2.6

* Update dependents of react to also require typescript 2.6
2018-02-12 12:55:52 +00:00
Andy
2a9d2f8d59
Convert more "import *" to "import =" (#23446) 2018-02-05 18:27:31 -08:00
Andy
bef4d2b27d
Enable "esModuleInterop" in all tsconfigs (#23354) 2018-02-05 11:01:56 -08:00
Youen
2707abc38a [react-router] added possibility to specify component props in route definitions, and to specify the type of this.props.route.props when implementing such a component (#22954)
* [react-router] fixed lint error due to implicit any in CustomLink test

* [react-router] added possibility to specify component props in route definitions, and to specify the type of this.props.route.props when implementing such a component

Example:

/* component definition */
interface Props { foo: string }
class MyComponent extends React.Component<RouteComponentProps<void,void,Props>, State> {
    /* here you can use this.props.route.props.foo */
}

/* route configuration */
<Route path="/my-path" component={MyComponent} props={{ foo: 'bar' }}>

* - fixed lint errors related to T[] instead of Array<T>
- added default type for ComponentProps in RouteComponentProps<P,R,ComponentProps>, so that it stays compatible with existing code

* [react-router] added default route props type (any) so that this new feature is fully backward compatible

* [react-router] fixed lint errors (T[] instead of Array<T> for non-generic types)
2018-01-24 08:16:00 -08:00
Andy
219dd6df82
Fix 'prefer-readonly' lint failures (#22819) 2018-01-10 14:59:37 -08:00
Jeremy Fauvel
4b925d212f [react-router] Remove useless definition for withRouter as decorator (#21799)
* [react-router] Remove useless definition for `withRouter` as decorator

* Add regression test
2017-12-19 22:35:40 +00:00
Jeremy Fauvel
3289762cca [react-router] Improve withRouter return type (#21329)
* [react-router] Improve withRouter return type

* Fix lint errors

* Fix dependencies version
2017-11-23 19:33:27 +00:00
Pasi Eronen
6e4ad80b70 react-router/react-router-dom: fix typing for getUserConfirmation and Prompt props 2017-11-21 12:41:42 +02:00
Nathan Shively-Sanders
7ec29455bd
Merge pull request #21000 from OliverJAsh/oja/react-router/v2/route-component-props-non-optional
React Router v2: `RouteComponentProps` non-optional `location` and `p…
2017-11-14 10:40:49 -08:00
Nathan Shively-Sanders
17e16c428b
Merge pull request #20934 from samijaber/patch-1
React-Router v2 Link: extend LinkHTMLAttributes instead of HTMLAttributes
2017-11-14 10:13:00 -08:00
Robin Zoň
5b22167627 React.Components template arguments fixed (#21356) 2017-11-08 22:35:07 +00:00
Oliver Joseph Ash
f2c89fb7cb React Router v2: RouteComponentProps non-optional location and params 2017-10-25 14:18:46 +01:00
Sami Jaber
991d2f7905 React-Router Link: extend LinkHTMLAttributes 2017-10-23 17:28:33 -04:00
Diogo Franco
399af551e6 [react-router] Fix for --strictFunctionTypes (#20746)
* [react-router] Fix for --strictFunctionTypes

It seems it's not possible for a SFC to conform to React.ComponentType<RouteComponentProps<any> | {}> with both strictFunctionTypes and strictNullChecks (they have to either be `Partial<RouteComponentProps<any>>` or `{}`).

The whole point of the `| {}` is to allow for components that have defaulted `Props` / don't use any `Props` anyway, so adding it as another listed type should work.

* Fix dtslint errors
2017-10-20 08:28:12 -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
Andy
947a8fb761 Enable strictFunctionTypes (#20373) 2017-10-06 14:03:03 -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
Andy
5027017378 react-router/v2: Fix default export of object (#19849) 2017-09-18 11:08:36 -07:00
Andy
ccdb9e03d1 Add tslint disables for no-unnecessary-generics (#19564) 2017-09-05 09:14:04 -07:00
Andy
d74806eb3d Add lint disables for no-unnecessary-generics (#19508) 2017-09-01 08:34:37 -07:00
Andy
ba8e532a9c react-router/v3: Fix test (#19277) 2017-08-28 11:48:01 -07:00
Andy
516ed213ca Fix all lint errors (#19253) 2017-08-22 14:27:36 -07:00
Bowden Kelly
6ed0a5a845 Merge pull request #18616 from ssorallen/v3-react-router-with-router
Type and export props from react-router's `withRouter`
2017-08-22 13:18:48 -07:00
Andy
924fafffc0 Fix remaining lint errors (#19166) 2017-08-20 15:37:53 -07:00
Andy
5d6c651a1a Apply stricter lint rules (#19063) 2017-08-17 14:53:41 -07:00
Egor Shulga
b51a8da34b Add dtslint type assertion test. 2017-08-11 17:44:07 +03:00
Egor Shulga
aa596d8723 Move decorator signature comment to the top of the line. 2017-08-11 17:22:56 +03:00
Egor Shulga
1d8a7055cf add withRouter decorator 2017-08-09 15:03:53 +03:00
Ross Allen
9a1aa8923c Move author attribution to v3 version, not v4 2017-08-04 17:44:56 -07:00
Ross Allen
6d09e851c9 Add detailed react-router withRouter example 2017-08-03 17:52:18 -07:00
Ross Allen
4023dce879 Type and export props from withRouter
In react-router v3.0.5, [`withRouter`][0] passes 4 props to the wrapped
component: `location`, `params`, `router`, and `routes`. These props are
different than those passed to `Route` components; these all come
directly from the Router either via `this.props` or `this.context`.

The component passed to `withRouter` are passed these props, but the
component returned from `withRouter` require only the component's own
props.

[0]: https://github.com/ReactTraining/react-router/blob/v3.0.5/modules/withRouter.js#L40
2017-08-03 16:49:26 -07:00
Stéphane Goetz
a24aee6125 Improve react typings for HTML attributes, fix tests in other libraries 2017-07-10 22:43:07 +02:00
Ryan Cavanaugh
fec422d226 Merge pull request #17611 from tkrotoff/react-router-component
Refactoring: use React.ComponentType
2017-07-10 09:41:41 -07:00
mtpc
bc710a72d6 Make Route component extensible
Shouldn't have any impact whatsoever in existing codebases due to default generics
2017-07-04 21:17:49 +02:00
Tanguy Krotoff
552051f56f Default props should be {}, not undefined or void 2017-06-29 14:00:18 +02:00
Tanguy Krotoff
51e7287c86 React.SFC<...> | React.ComponentClass<...> => React.ComponentType<...> 2017-06-29 14:00:00 +02:00
Tanguy Krotoff
13a594f24e Move the official examples to directory examples-from-react-router-website 2017-06-28 03:03:42 +02:00
Tanguy Krotoff
b6cc600508 null! => null thanks to PR #17021 2017-06-28 02:23:02 +02:00
Tanguy Krotoff
573083a518 Replace React.Component<(any|void|\{\}|null)> by React.Component
+ many manual adjustments
2017-06-21 09:48:37 +02: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
eeb262e1d8 Update react to TypeScript 2.3 2017-06-19 13:34:54 +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
Michael Strobel
3b1ba96df2 [react-router] add RouteComponentProps.staticContext (#16812)
* [react-router] add RouteComponentProps.staticContext

* [react-router] revert RouteConfig test file

* [react-router] Add example for StaticRouter and staticContext
2017-05-31 21:56:38 -07:00
Daniel Rosenwasser
3b8b7625b7 Lints. 2017-05-30 01:17:26 -07:00
Daniel Rosenwasser
65cfdaef94 Fixed the type of 'children' for 'Route' in 'react-router'. 2017-05-30 01:01:22 -07:00
Daniel Rosenwasser
4e4890ccc8 Added tests for 'children' set to both elements and functions to elements in 'react-router'. 2017-05-30 00:58:35 -07:00
Yui
1d19461b6e Update state type parameter (#16361) 2017-05-05 16:36:51 -07:00