From b453db3c9b33bbb94086bfb05fc83dc608fac185 Mon Sep 17 00:00:00 2001 From: HeskeyBaozi Date: Sat, 1 Sep 2018 16:48:48 +0800 Subject: [PATCH] fix typescript type --- site/theme/template/IconDisplay/CopyableIcon.tsx | 6 ++++-- site/theme/template/IconDisplay/index.tsx | 10 ++++++---- site/theme/template/IconDisplay/themeIcons.tsx | 7 ++++--- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/site/theme/template/IconDisplay/CopyableIcon.tsx b/site/theme/template/IconDisplay/CopyableIcon.tsx index 783f89ff27..4539b34649 100644 --- a/site/theme/template/IconDisplay/CopyableIcon.tsx +++ b/site/theme/template/IconDisplay/CopyableIcon.tsx @@ -1,7 +1,9 @@ import * as React from 'react'; import CopyToClipboard from 'react-copy-to-clipboard'; -import { Icon, Badge } from 'antd'; -import { ThemeType } from '../../../../components/icon'; +import { Icon as AntdIcon, Badge } from 'antd'; +import { ThemeType, IconProps } from '../../../../components/icon'; + +const Icon: React.SFC = AntdIcon; export interface CopyableIconProps { type: string; diff --git a/site/theme/template/IconDisplay/index.tsx b/site/theme/template/IconDisplay/index.tsx index abb29c22fb..76bbfddadd 100644 --- a/site/theme/template/IconDisplay/index.tsx +++ b/site/theme/template/IconDisplay/index.tsx @@ -1,14 +1,16 @@ import * as React from 'react'; -import { ThemeType } from '../../../../components/icon'; +import { ThemeType, IconProps } from '../../../../components/icon'; import manifest from '@ant-design/icons/lib/manifest'; -import { Manifest, ThemeType as ThemeFolderType } from '@ant-design/icons/lib/types'; +import { ThemeType as ThemeFolderType } from '@ant-design/icons/lib/types'; import Category from './Category'; -import { Radio, Icon } from 'antd'; +import { Radio, Icon as AntdIcon } from 'antd'; import { RadioChangeEvent } from 'antd/lib/radio/interface'; import { FilledIcon, OutlinedIcon, TwoToneIcon } from './themeIcons'; import { categories, Categories, CategoriesKeys } from './fields'; import { injectIntl, InjectedIntlProps } from 'react-intl'; +const Icon: React.SFC = AntdIcon; + interface IconDisplayProps extends InjectedIntlProps { } @@ -50,7 +52,7 @@ class IconDisplay extends React.Component { }); } - renderCategories(list: Array<{ category: string, icons: string[] }>) { + renderCategories(list: Array<{ category: CategoriesKeys, icons: string[] }>) { return list.map(({ category, icons }) => { return ( { +export const FilledIcon: React.SFC = (props) => { const path = 'M864 64H160C107 64 64 107 64 160v' + '704c0 53 43 96 96 96h704c53 0 96-43 96-96V16' + '0c0-53-43-96-96-96z'; @@ -14,7 +15,7 @@ export const FilledIcon: React.SFC = (props: any) => { ); }; -export const OutlinedIcon: React.SFC = (props: any) => { +export const OutlinedIcon: React.SFC = (props) => { const path = 'M864 64H160C107 64 64 107 64 160v7' + '04c0 53 43 96 96 96h704c53 0 96-43 96-96V160c' + '0-53-43-96-96-96z m-12 800H172c-6.6 0-12-5.4-' + @@ -30,7 +31,7 @@ export const OutlinedIcon: React.SFC = (props: any) => { ); }; -export const TwoToneIcon: React.SFC = (props: any) => { +export const TwoToneIcon: React.SFC = (props) => { const path = 'M16 512c0 273.932 222.066 496 496 49' + '6s496-222.068 496-496S785.932 16 512 16 16 238.' + '066 16 512z m496 368V144c203.41 0 368 164.622 3' +