From 0d06ba4519bcd8a49c3eb1242fec1f11ff567096 Mon Sep 17 00:00:00 2001 From: Philipp Zins Date: Thu, 23 Mar 2017 12:53:32 +0100 Subject: [PATCH] updated test and component prop of router --- react-router/index.d.ts | 5 ++--- react-router/test/Recursive.tsx | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/react-router/index.d.ts b/react-router/index.d.ts index 3faa19968d..040a9f3af7 100644 --- a/react-router/index.d.ts +++ b/react-router/index.d.ts @@ -48,12 +48,11 @@ declare module 'react-router' { history: H.History; } - interface PartialRouteComponentProps

extends Partial> { - } + interface PartialRouteComponentProps

extends Partial> {} interface RouteProps { location?: H.Location; - component?: React.SFC | void> | React.ComponentClass | void>; + component?: React.SFC | void> | React.ComponentClass | void>; render?: (props: RouteComponentProps) => React.ReactNode; children?: (props: RouteComponentProps) => React.ReactNode | React.ReactNode; path?: string; diff --git a/react-router/test/Recursive.tsx b/react-router/test/Recursive.tsx index 53a600487f..748e00a968 100644 --- a/react-router/test/Recursive.tsx +++ b/react-router/test/Recursive.tsx @@ -19,15 +19,22 @@ const find = (id: number) => PEEPS.find(p => p.id == id) const RecursiveExample = () => ( - + ) -interface PersonProps extends Partial> { - match: match<{id: number}>; +interface InitialPersonProps { + match: { + params: { + id: number; + }; + url: string; + }; } -const Person: React.SFC = ({ match }) => { +type PersonProps = RouteComponentProps<{ id: number }>; + +const Person: React.SFC = ({ match }) => { const person = find(match.params.id) return ( @@ -42,9 +49,9 @@ const Person: React.SFC = ({ match }) => { ))} - + }/> ) } -export default RecursiveExample \ No newline at end of file +export default RecursiveExample