type: LiteralUnion optimization (#39871)

This commit is contained in:
lijianan 2022-12-28 23:59:55 +08:00 committed by yoyo837
parent 4f16966e28
commit dedbbda5f2
5 changed files with 5 additions and 5 deletions

View File

@ -1,2 +1,2 @@
/** https://github.com/Microsoft/TypeScript/issues/29729 */
export type LiteralUnion<T extends U, U> = T | (U & {});
export type LiteralUnion<T extends string> = T | (string & {});

View File

@ -13,7 +13,7 @@ export interface RibbonProps {
prefixCls?: string;
style?: React.CSSProperties; // style of ribbon element, not the wrapper
text?: React.ReactNode;
color?: LiteralUnion<PresetColorType, string>;
color?: LiteralUnion<PresetColorType>;
children?: React.ReactNode;
placement?: RibbonPlacement;
}

View File

@ -30,7 +30,7 @@ export interface BadgeProps {
scrollNumberPrefixCls?: string;
className?: string;
status?: PresetStatusColorType;
color?: LiteralUnion<PresetColorType, string>;
color?: LiteralUnion<PresetColorType>;
text?: React.ReactNode;
size?: 'default' | 'small';
offset?: [number | string, number | string];

View File

@ -15,7 +15,7 @@ export type { CheckableTagProps } from './CheckableTag';
export interface TagProps extends React.HTMLAttributes<HTMLSpanElement> {
prefixCls?: string;
className?: string;
color?: LiteralUnion<PresetColorType | PresetStatusColorType, string>;
color?: LiteralUnion<PresetColorType | PresetStatusColorType>;
closable?: boolean;
closeIcon?: React.ReactNode;
/** @deprecated `visible` will be removed in next major version. */

View File

@ -71,7 +71,7 @@ interface LegacyTooltipProps
export interface AbstractTooltipProps extends LegacyTooltipProps {
style?: React.CSSProperties;
className?: string;
color?: LiteralUnion<PresetColorType, string>;
color?: LiteralUnion<PresetColorType>;
placement?: TooltipPlacement;
builtinPlacements?: typeof Placements;
openClassName?: string;