Skip to content

Commit

Permalink
type: LiteralUnion optimization (#39871)
Browse files Browse the repository at this point in the history
  • Loading branch information
li-jia-nan authored and yoyo837 committed Dec 31, 2022
1 parent 4f16966 commit dedbbda
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion components/_util/type.ts
Original file line number Diff line number Diff line change
@@ -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 & {});
2 changes: 1 addition & 1 deletion components/badge/Ribbon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion components/badge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion components/tag/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
2 changes: 1 addition & 1 deletion components/tooltip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit dedbbda

Please sign in to comment.