diff --git a/types/react-router/index.d.ts b/types/react-router/index.d.ts index 5ae92ababc..2b1e2f97c1 100644 --- a/types/react-router/index.d.ts +++ b/types/react-router/index.d.ts @@ -17,6 +17,7 @@ // Youen Toupin // Rahul Raina // Maksim Sharipov +// Duong Tran // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -86,10 +87,15 @@ export interface RouterProps { } export class Router extends React.Component { } +export interface StaticRouterContext { + url?: string; + action?: 'PUSH' | 'REPLACE'; + location?: object; +} export interface StaticRouterProps { basename?: string; location?: string | object; - context?: object; + context?: StaticRouterContext; } export class StaticRouter extends React.Component { } diff --git a/types/react-router/test/examples-from-react-router-website/StaticRouter.tsx b/types/react-router/test/examples-from-react-router-website/StaticRouter.tsx index c9763bdda5..3dce9a5def 100644 --- a/types/react-router/test/examples-from-react-router-website/StaticRouter.tsx +++ b/types/react-router/test/examples-from-react-router-website/StaticRouter.tsx @@ -1,7 +1,8 @@ import * as React from 'react'; import { StaticRouter, Route } from 'react-router-dom'; +import { StaticRouterContext } from 'react-router'; -interface StaticContext { +interface StaticContext extends StaticRouterContext { statusCode?: number; }