Fix implicit any error for Breadcrumb

pull/8292/head
Wei Zhu 7 years ago
parent ebce4b3599
commit de340a83ba

@ -5,17 +5,22 @@ import warning from '../_util/warning';
import BreadcrumbItem from './BreadcrumbItem'; import BreadcrumbItem from './BreadcrumbItem';
import classNames from 'classnames'; import classNames from 'classnames';
export interface Route {
path: string;
breadcrumbName: string;
}
export interface BreadcrumbProps { export interface BreadcrumbProps {
prefixCls?: string; prefixCls?: string;
routes?: Array<any>; routes?: Route[];
params?: Object; params?: any;
separator?: React.ReactNode; separator?: React.ReactNode;
itemRender?: (route: any, params: any, routes: Array<any>, paths: Array<string>) => React.ReactNode; itemRender?: (route: any, params: any, routes: Array<any>, paths: Array<string>) => React.ReactNode;
style?: React.CSSProperties; style?: React.CSSProperties;
className?: string; className?: string;
} }
function getBreadcrumbName(route, params) { function getBreadcrumbName(route: Route, params: any) {
if (!route.breadcrumbName) { if (!route.breadcrumbName) {
return null; return null;
} }
@ -27,7 +32,7 @@ function getBreadcrumbName(route, params) {
return name; return name;
} }
function defaultItemRender(route, params, routes, paths) { function defaultItemRender(route: Route, params: any, routes: Route[], paths: string[]) {
const isLastItem = routes.indexOf(route) === routes.length - 1; const isLastItem = routes.indexOf(route) === routes.length - 1;
const name = getBreadcrumbName(route, params); const name = getBreadcrumbName(route, params);
return isLastItem return isLastItem

Loading…
Cancel
Save