Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[react-router] Add explicit types for children #56277

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions types/react-router-dom/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export {

export interface BrowserRouterProps {
basename?: string | undefined;
children?: React.ReactNode;
getUserConfirmation?: ((message: string, callback: (ok: boolean) => void) => void) | undefined;
forceRefresh?: boolean | undefined;
keyLength?: number | undefined;
Expand All @@ -51,6 +52,7 @@ export class BrowserRouter extends React.Component<BrowserRouterProps, any> {}

export interface HashRouterProps {
basename?: string | undefined;
children?: React.ReactNode;
getUserConfirmation?: ((message: string, callback: (ok: boolean) => void) => void) | undefined;
hashType?: 'slash' | 'noslash' | 'hashbang' | undefined;
}
Expand Down
1 change: 1 addition & 0 deletions types/react-router-native/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export interface LinkProps {
export class Link extends React.Component<LinkProps> {}

export interface NativeRouterProps {
children?: React.ReactNode;
getUserConfirmation?: Function | undefined;
keyLength?: number | undefined;
initialEntries?: string[] | undefined;
Expand Down
3 changes: 3 additions & 0 deletions types/react-router/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export interface RouterChildContext<Params extends { [K in keyof Params]?: strin
};
}
export interface MemoryRouterProps {
children?: React.ReactNode;
initialEntries?: H.LocationDescriptor[] | undefined;
initialIndex?: number | undefined;
getUserConfirmation?: ((message: string, callback: (ok: boolean) => void) => void) | undefined;
Expand Down Expand Up @@ -102,6 +103,7 @@ export class Route<T extends {} = {}, Path extends string = string> extends Reac
> {}

export interface RouterProps {
children?: React.ReactNode;
history: H.History;
}
export class Router extends React.Component<RouterProps, any> {}
Expand All @@ -113,6 +115,7 @@ export interface StaticRouterContext extends StaticContext {
}
export interface StaticRouterProps {
basename?: string | undefined;
children?: React.ReactNode;
location?: string | object | undefined;
context?: StaticRouterContext | undefined;
}
Expand Down
3 changes: 3 additions & 0 deletions types/react-router/ts4.0/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface RouterChildContext<Params extends { [K in keyof Params]?: strin
};
}
export interface MemoryRouterProps {
children?: React.ReactNode;
initialEntries?: H.LocationDescriptor[];
initialIndex?: number;
getUserConfirmation?: (message: string, callback: (ok: boolean) => void) => void;
Expand Down Expand Up @@ -71,6 +72,7 @@ export interface RouteProps {
export class Route<T extends RouteProps = RouteProps> extends React.Component<T, any> {}

export interface RouterProps {
children?: React.ReactNode;
history: H.History;
}
export class Router extends React.Component<RouterProps, any> {}
Expand All @@ -82,6 +84,7 @@ export interface StaticRouterContext extends StaticContext {
}
export interface StaticRouterProps {
basename?: string;
children?: React.ReactNode;
location?: string | object;
context?: StaticRouterContext;
}
Expand Down
1 change: 1 addition & 0 deletions types/react-router/v3/lib/Route.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import { IndexRouteProps } from "react-router/lib/IndexRoute";

export interface RouteProps<Props = any> extends IndexRouteProps<Props> {
children?: React.ReactNode;
path?: RoutePattern | undefined;
}

Expand Down
2 changes: 2 additions & 0 deletions types/react-router/v3/lib/Router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
Search
} from "history";
import { PlainRoute } from "react-router";
import React = require("react");

export interface Params {
[key: string]: string;
Expand Down Expand Up @@ -76,6 +77,7 @@ export interface RouteComponentProps<P, R, ComponentProps = any, Q = any> {
}

export interface RouterProps extends ClassAttributes<any> {
children?: React.ReactNode;
routes?: RouteConfig | undefined;
history?: History | undefined;
createElement?(component: RouteComponent, props: any): any;
Expand Down