From 4e4890ccc88561afcd2064dab10195db58e65929 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 30 May 2017 00:53:43 -0700 Subject: [PATCH 1/3] Added tests for 'children' set to both elements and functions to elements in 'react-router'. --- types/react-router/test/Children.tsx | 22 ++++++++++++++++++++++ types/react-router/tsconfig.json | 1 + 2 files changed, 23 insertions(+) create mode 100644 types/react-router/test/Children.tsx diff --git a/types/react-router/test/Children.tsx b/types/react-router/test/Children.tsx new file mode 100644 index 0000000000..8e4faad089 --- /dev/null +++ b/types/react-router/test/Children.tsx @@ -0,0 +1,22 @@ +import * as React from 'react'; +import { Route } from 'react-router'; + +function RouteWithFunctionChildrenAttribute() { + return
Hello!
} /> +} + +function RouteWithFunctionJsxChildren() { + return + {() =>
Hello!
} +
+} + +function RouteWithElementChildrenAttribute() { + return Hello!} /> +} + +function RouteWithElementJsxChildren() { + return + {
Hello!
} +
+} \ No newline at end of file diff --git a/types/react-router/tsconfig.json b/types/react-router/tsconfig.json index df074843df..f3a225ece1 100644 --- a/types/react-router/tsconfig.json +++ b/types/react-router/tsconfig.json @@ -18,6 +18,7 @@ "test/Animation.tsx", "test/Auth.tsx", "test/Basic.tsx", + "test/Children.tsx", "test/CustomLink.tsx", "test/ModalGallery.tsx", "test/NavigateWithContext.tsx", From 65cfdaef9429d61b2d6a65581980946fdaac45eb Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 30 May 2017 01:01:22 -0700 Subject: [PATCH 2/3] Fixed the type of 'children' for 'Route' in 'react-router'. --- types/react-router/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-router/index.d.ts b/types/react-router/index.d.ts index d5bc7240c7..384cb2289e 100644 --- a/types/react-router/index.d.ts +++ b/types/react-router/index.d.ts @@ -65,7 +65,7 @@ export interface RouteProps { location?: H.Location; component?: React.SFC | undefined> | React.ComponentClass | undefined>; render?: ((props: RouteComponentProps) => React.ReactNode); - children?: ((props: RouteComponentProps) => React.ReactNode | React.ReactNode); + children?: ((props: RouteComponentProps) => React.ReactNode) | React.ReactNode; path?: string; exact?: boolean; strict?: boolean; From 3b8b7625b71efa6cfcd06787ef37c848a28fa508 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 30 May 2017 01:17:26 -0700 Subject: [PATCH 3/3] Lints. --- types/react-router/test/Children.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/types/react-router/test/Children.tsx b/types/react-router/test/Children.tsx index 8e4faad089..c3dea4f482 100644 --- a/types/react-router/test/Children.tsx +++ b/types/react-router/test/Children.tsx @@ -2,21 +2,21 @@ import * as React from 'react'; import { Route } from 'react-router'; function RouteWithFunctionChildrenAttribute() { - return
Hello!
} /> + return
Hello!
} />; } function RouteWithFunctionJsxChildren() { return {() =>
Hello!
} -
+
; } function RouteWithElementChildrenAttribute() { - return Hello!} /> + return Hello!} />; } function RouteWithElementJsxChildren() { return {
Hello!
} -
-} \ No newline at end of file +
; +}