diff --git a/types/react-router/index.d.ts b/types/react-router/index.d.ts index 81244caa29..a955271aae 100644 --- a/types/react-router/index.d.ts +++ b/types/react-router/index.d.ts @@ -12,6 +12,7 @@ // Tanguy Krotoff // Huy Nguyen // Jérémy Fauvel +// Daniel Roth // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -84,7 +85,7 @@ export interface StaticRouterProps { export class StaticRouter extends React.Component {} export interface SwitchProps { - children?: JSX.Element | JSX.Element[]; + children?: React.ReactNode; location?: H.Location; } export class Switch extends React.Component {} diff --git a/types/react-router/test/Switch.tsx b/types/react-router/test/Switch.tsx index 6a8b50f247..fe959504ce 100644 --- a/types/react-router/test/Switch.tsx +++ b/types/react-router/test/Switch.tsx @@ -2,12 +2,18 @@ import * as React from 'react'; import { BrowserRouter, Redirect, Route, Switch } from 'react-router-dom'; const Home = () =>

Home

; +const About = () =>

About

; +const User = () =>

User

; const SwitchTest = () => ( + {[ + , + + ]} );