diff --git a/.jest.js b/.jest.js index 12370cd640..e360991e71 100644 --- a/.jest.js +++ b/.jest.js @@ -31,7 +31,7 @@ module.exports = { '!components/*/style/index.tsx', '!components/style/index.tsx', '!components/*/locale/index.tsx', - '!components/form/__tests__/type.test.tsx', + '!components/*/__tests__/type.test.tsx', '!components/**/*/interface.{ts,tsx}', ], transformIgnorePatterns, diff --git a/components/icon/__tests__/logo.svg b/components/icon/__tests__/logo.svg new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/icon/__tests__/type.test.tsx b/components/icon/__tests__/type.test.tsx new file mode 100644 index 0000000000..bb6a01b329 --- /dev/null +++ b/components/icon/__tests__/type.test.tsx @@ -0,0 +1,12 @@ +/* eslint-disable */ +import React from 'react'; +import Icon from '..'; +import { ReactComponent as logo } from './logo.svg'; + +describe('Icon TypeScript test', () => { + it('empty test case placeholder to avoid jest error', () => { + // empty + }); +}); + +; diff --git a/components/icon/index.tsx b/components/icon/index.tsx index 13ebff8f28..20edda2240 100755 --- a/components/icon/index.tsx +++ b/components/icon/index.tsx @@ -67,7 +67,7 @@ export interface IconProps { title?: string; onKeyUp?: React.KeyboardEventHandler; onClick?: React.MouseEventHandler; - component?: React.ComponentType; + component?: React.ComponentType>; twoToneColor?: string; viewBox?: string; spin?: boolean; diff --git a/typings/custom-typings.d.ts b/typings/custom-typings.d.ts index a25c923f7f..9329d4f92d 100644 --- a/typings/custom-typings.d.ts +++ b/typings/custom-typings.d.ts @@ -1,4 +1,12 @@ -declare module '*.svg'; +// https://github.com/facebook/create-react-app/blob/f09d3d3a52c1b938cecc977c2bbc0942ea0a7e70/packages/react-scripts/lib/react-app.d.ts#L42-L49 +declare module '*.svg' { + import * as React from 'react'; + + export const ReactComponent: React.FunctionComponent>; + + const src: string; + export default src; +} declare module 'rc-calendar*';