Jay Fong
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
13 additions and
2 deletions
-
components/_util/type.ts
-
components/tag/index.tsx
|
|
@ -9,3 +9,8 @@ export const tupleNum = <T extends number[]>(...args: T) => args; |
|
|
|
* Extract the type of an element of an array/tuple without performing indexing |
|
|
|
*/ |
|
|
|
export type ElementOf<T> = T extends (infer E)[] ? E : T extends readonly (infer E)[] ? E : never; |
|
|
|
|
|
|
|
/** |
|
|
|
* https://github.com/Microsoft/TypeScript/issues/29729
|
|
|
|
*/ |
|
|
|
export type LiteralUnion<T extends U, U> = T | (U & {}); |
|
|
|
|
|
@ -5,15 +5,21 @@ import CloseOutlined from '@ant-design/icons/CloseOutlined'; |
|
|
|
|
|
|
|
import CheckableTag from './CheckableTag'; |
|
|
|
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider'; |
|
|
|
import { PresetColorTypes, PresetStatusColorTypes } from '../_util/colors'; |
|
|
|
import { |
|
|
|
PresetColorTypes, |
|
|
|
PresetStatusColorTypes, |
|
|
|
PresetColorType, |
|
|
|
PresetStatusColorType, |
|
|
|
} from '../_util/colors'; |
|
|
|
import Wave from '../_util/wave'; |
|
|
|
import { LiteralUnion } from '../_util/type'; |
|
|
|
|
|
|
|
export { CheckableTagProps } from './CheckableTag'; |
|
|
|
|
|
|
|
export interface TagProps extends React.HTMLAttributes<HTMLSpanElement> { |
|
|
|
prefixCls?: string; |
|
|
|
className?: string; |
|
|
|
color?: string; |
|
|
|
color?: LiteralUnion<PresetColorType | PresetStatusColorType, string>; |
|
|
|
closable?: boolean; |
|
|
|
visible?: boolean; |
|
|
|
onClose?: Function; |
|
|
|