From de340a83baa4a73766e226131d0e5f3413808e70 Mon Sep 17 00:00:00 2001 From: Wei Zhu Date: Wed, 22 Nov 2017 11:10:33 +0800 Subject: [PATCH] Fix implicit any error for Breadcrumb --- components/breadcrumb/Breadcrumb.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/components/breadcrumb/Breadcrumb.tsx b/components/breadcrumb/Breadcrumb.tsx index 3a4a46e1ac..22401bf385 100755 --- a/components/breadcrumb/Breadcrumb.tsx +++ b/components/breadcrumb/Breadcrumb.tsx @@ -5,17 +5,22 @@ import warning from '../_util/warning'; import BreadcrumbItem from './BreadcrumbItem'; import classNames from 'classnames'; +export interface Route { + path: string; + breadcrumbName: string; +} + export interface BreadcrumbProps { prefixCls?: string; - routes?: Array; - params?: Object; + routes?: Route[]; + params?: any; separator?: React.ReactNode; itemRender?: (route: any, params: any, routes: Array, paths: Array) => React.ReactNode; style?: React.CSSProperties; className?: string; } -function getBreadcrumbName(route, params) { +function getBreadcrumbName(route: Route, params: any) { if (!route.breadcrumbName) { return null; } @@ -27,7 +32,7 @@ function getBreadcrumbName(route, params) { 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 name = getBreadcrumbName(route, params); return isLastItem