UNPKG

antd

Version:

An enterprise-class UI design language and React components implementation

13 lines (12 loc) 908 B
import type React from 'react'; /** https://github.com/Microsoft/TypeScript/issues/29729 */ export type LiteralUnion<T extends string> = T | (string & {}); export type AnyObject = Record<PropertyKey, any>; export type CustomComponent<P = AnyObject> = React.ComponentType<P> | string; export type GetProps<T extends React.ComponentType<any> | object> = T extends React.ComponentType<infer P> ? P : T extends object ? T : never; export type GetProp<T extends React.ComponentType<any> | object, PropName extends keyof GetProps<T>> = NonNullable<GetProps<T>[PropName]>; type ReactRefComponent<Props extends { ref?: React.Ref<any>; }> = (props: Props) => React.ReactElement | React.ReactNode | null; export type GetRef<T extends ReactRefComponent<any> | React.Component<any>> = T extends React.Component<any> ? T : T extends ReactRefComponent<React.RefAttributes<infer RefType>> ? RefType : never; export {};