From 7c85a623b550df791034197cefab72b3fa572412 Mon Sep 17 00:00:00 2001 From: Lapanti Date: Tue, 2 May 2017 05:55:50 +0300 Subject: [PATCH 1/6] (#16189): Add LocationChangeAction to react-router-redux --- types/react-router-redux/index.d.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/types/react-router-redux/index.d.ts b/types/react-router-redux/index.d.ts index bebaab7562..e224f92530 100644 --- a/types/react-router-redux/index.d.ts +++ b/types/react-router-redux/index.d.ts @@ -59,4 +59,20 @@ export interface RouterAction extends Action { payload: LocationActionPayload; } +export interface LocationChangeAction extends Action { + type: typeof LOCATION_CHANGE; + payload: Location & { + props?: { + match: { + path: string; + url: string; + params: any; + isExact: boolean; + }, + location: Location; + history: History; + } + }; +} + export function routerMiddleware(history: History): Middleware; From 3bd056f15eb0a0e9dec0fdce91f747c76e008ad5 Mon Sep 17 00:00:00 2001 From: Lapanti Date: Tue, 16 May 2017 11:26:25 +0300 Subject: [PATCH 2/6] Add type definitions for react-infinite-scroller --- types/react-infinite-scroller/index.d.ts | 63 ++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 types/react-infinite-scroller/index.d.ts diff --git a/types/react-infinite-scroller/index.d.ts b/types/react-infinite-scroller/index.d.ts new file mode 100644 index 0000000000..972aa14c4e --- /dev/null +++ b/types/react-infinite-scroller/index.d.ts @@ -0,0 +1,63 @@ +// Type definitions for react-infinite-scroller 1.0.12 +// Project: https://github.com/CassetteRocks/react-infinite-scroller +// Definitions by: Lauri Lavanti +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +declare module 'react-infinite-scroller' { + import * as React from 'react'; + + /** + * properties. + */ + interface InfiniteScrollProps extends React.HTMLProps { + /** + * Name of the element that the component should render as. + * Defaults to 'div'. + */ + element?: string; + /** + * Whether there are more items to be loaded. Event listeners are removed if false. + * Defaults to false. + */ + hasMore?: boolean; + /** + * Whether the component should load the first set of items. + * Defaults to false. + */ + initialLoad?: boolean; + /** + * Whether new items should be loaded when user scrolls to the top of the scrollable area. + * Default to false. + */ + isReverse?: boolean; + /** + * A callback for when more items are requested by the user. + */ + loadMore(): void; + /** + * The number of the first page to load, with the default of 0, the first page is 1. + * Defaults to 0. + */ + pageStart?: number; + /** + * The distance in pixels before the end of the items that will trigger a call to loadMore. + * Defaults to 250. + */ + threshold?: number; + /** + * Proxy to the useCapture option of the added event listeners. + * Defaults to false. + */ + useCapture?: boolean; + /** + * Add scroll listeners to the window, or else, the component's parentNode. + * Defaults to true. + */ + useWindow?: boolean; + } + + export default class InfiniteScroll extends React.Component { } +} + + From 28fcfd7877707c5249ee2f42f492ad25bf7d4c7c Mon Sep 17 00:00:00 2001 From: Lapanti Date: Tue, 16 May 2017 11:31:13 +0300 Subject: [PATCH 3/6] Add tsconfig.json for react-infinite-scroller --- types/react-infinite-scroller/tsconfig.json | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 types/react-infinite-scroller/tsconfig.json diff --git a/types/react-infinite-scroller/tsconfig.json b/types/react-infinite-scroller/tsconfig.json new file mode 100644 index 0000000000..cb169471f2 --- /dev/null +++ b/types/react-infinite-scroller/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts" + ] +} From 52524f6ad7b48f65642b80b1fba47c0c96937c06 Mon Sep 17 00:00:00 2001 From: Lapanti Date: Tue, 16 May 2017 11:36:48 +0300 Subject: [PATCH 4/6] Add tests for react-infinite-scroller --- types/react-infinite-scroller/index.d.ts | 2 +- .../react-infinite-scroller.tsx | 34 +++++++++++++++++++ types/react-infinite-scroller/tsconfig.json | 6 ++-- 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 types/react-infinite-scroller/react-infinite-scroller.tsx diff --git a/types/react-infinite-scroller/index.d.ts b/types/react-infinite-scroller/index.d.ts index 972aa14c4e..9d18446b13 100644 --- a/types/react-infinite-scroller/index.d.ts +++ b/types/react-infinite-scroller/index.d.ts @@ -23,7 +23,7 @@ declare module 'react-infinite-scroller' { hasMore?: boolean; /** * Whether the component should load the first set of items. - * Defaults to false. + * Defaults to true. */ initialLoad?: boolean; /** diff --git a/types/react-infinite-scroller/react-infinite-scroller.tsx b/types/react-infinite-scroller/react-infinite-scroller.tsx new file mode 100644 index 0000000000..e98f1dc7f8 --- /dev/null +++ b/types/react-infinite-scroller/react-infinite-scroller.tsx @@ -0,0 +1,34 @@ +import * as React from 'react'; +import InfiniteScroll from 'react-infinite-scroller'; + +class Test1 extends React.Component<{}, {}> { + public render() { + return ( + {}} + > +
Test 1
+
+ ); + } +} + +class Test2 extends React.Component<{}, {}> { + public render() { + return ( + {}} + element='section' + hasMore + initialLoad={false} + isReverse + pageStart={2} + threshold={500} + useCapture + useWindow={false} + > +
Test 1
+
+ ); + } +} diff --git a/types/react-infinite-scroller/tsconfig.json b/types/react-infinite-scroller/tsconfig.json index cb169471f2..e4dc7b4342 100644 --- a/types/react-infinite-scroller/tsconfig.json +++ b/types/react-infinite-scroller/tsconfig.json @@ -6,9 +6,10 @@ "dom" ], "noImplicitAny": true, - "noImplicitThis": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", + "jsx": "react", "typeRoots": [ "../" ], @@ -17,6 +18,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "index.d.ts" + "index.d.ts", + "react-infinite-scroller-tests.tsx" ] } From e18abed9f27e30765c3b78fd1dadc615b9948404 Mon Sep 17 00:00:00 2001 From: Lapanti Date: Tue, 16 May 2017 11:52:51 +0300 Subject: [PATCH 5/6] Rename test file to correct one in react-infinite-scroller --- ...ct-infinite-scroller.tsx => react-infinite-scroller-tests.tsx} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename types/react-infinite-scroller/{react-infinite-scroller.tsx => react-infinite-scroller-tests.tsx} (100%) diff --git a/types/react-infinite-scroller/react-infinite-scroller.tsx b/types/react-infinite-scroller/react-infinite-scroller-tests.tsx similarity index 100% rename from types/react-infinite-scroller/react-infinite-scroller.tsx rename to types/react-infinite-scroller/react-infinite-scroller-tests.tsx From aec8542e5f521857860238467a88dde280e5e752 Mon Sep 17 00:00:00 2001 From: Lapanti Date: Tue, 16 May 2017 11:59:19 +0300 Subject: [PATCH 6/6] Remove unnecessary newlines in react-infinite-scroller --- types/react-infinite-scroller/index.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/types/react-infinite-scroller/index.d.ts b/types/react-infinite-scroller/index.d.ts index 9d18446b13..a563b88966 100644 --- a/types/react-infinite-scroller/index.d.ts +++ b/types/react-infinite-scroller/index.d.ts @@ -59,5 +59,3 @@ declare module 'react-infinite-scroller' { export default class InfiniteScroll extends React.Component { } } - -