mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 02:49:18 +08:00
type: optimize LiteralUnion type and add Primitive type (#55599)
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import type React from 'react';
|
||||
|
||||
export type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
||||
|
||||
/** https://github.com/Microsoft/TypeScript/issues/29729 */
|
||||
export type LiteralUnion<T extends string | undefined> = T | (string & {});
|
||||
export type LiteralUnion<T, U extends Primitive = string> = T | (U & Record<never, never>);
|
||||
|
||||
export type AnyObject = Record<PropertyKey, any>;
|
||||
|
||||
|
||||
@@ -11,6 +11,6 @@ export interface FlexProps<P = AnyObject> extends React.HTMLAttributes<HTMLEleme
|
||||
justify?: React.CSSProperties['justifyContent'];
|
||||
align?: React.CSSProperties['alignItems'];
|
||||
flex?: React.CSSProperties['flex'];
|
||||
gap?: LiteralUnion<SizeType> | number;
|
||||
gap?: LiteralUnion<SizeType, React.CSSProperties['gap']>;
|
||||
component?: CustomComponent<P>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user