@bianic-ui/utils
Version:
Common utilties and types for Bianic UI
17 lines (16 loc) • 1.15 kB
TypeScript
import * as React from "react";
export declare type SafeMerge<T, P> = P & Omit<T, keyof P>;
export declare type UnionStringArray<T extends Readonly<string[]>> = T[number];
export declare type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
export declare type As<P = any> = React.ElementType<P>;
export declare type LiteralUnion<T extends U, U extends any = string> = T | (U & {
_?: never;
});
export declare type AnyFunction<T = any> = (...args: T[]) => any;
export declare type FunctionArguments<T extends Function> = T extends (...args: infer R) => any ? R : never;
export declare type Dict<T = any> = Record<string, T>;
export declare type ReactNodeOrRenderProp<P> = React.ReactNode | ((props: P) => React.ReactNode);
export declare type Booleanish = boolean | "true" | "false";
export declare type StringOrNumber = string | number;
export declare type HTMLProps<T = any> = Omit<React.HTMLAttributes<T>, "color" | "width" | "height"> & React.RefAttributes<T>;
export declare type PropGetter<T extends HTMLElement = any, P = {}> = (props?: SafeMerge<HTMLProps<T>, P>, ref?: React.Ref<any> | React.RefObject<any>) => SafeMerge<HTMLProps<T>, P>;