UNPKG

variance-authority

Version:
24 lines (23 loc) 924 B
export type OmitUndefined<T> = T extends undefined ? never : T; export type StringToBoolean<T> = T extends "true" | "false" ? boolean : T; export type ConfigSchema<T> = Record<string, Record<string, T>>; export type ConfigVariants<T, CS extends ConfigSchema<T>> = { [Variant in keyof CS]?: StringToBoolean<keyof CS[Variant]> | null | undefined; }; export type Config<T, CS extends ConfigSchema<T>> = { base: T | T[]; compoundVariants?: [ConfigVariants<T, CS>, T][]; defaultVariants?: ConfigVariants<T, CS>; variants?: CS; }; export interface VA { <T, CS extends ConfigSchema<T>>(config: Omit<Config<T, CS>, "base"> & { base: T; }): (props: ConfigVariants<T, CS>, extra?: T) => T; } export interface VA { <T, CS extends ConfigSchema<T>>(config: Omit<Config<T, CS>, "base"> & { base: T[]; }): (props: ConfigVariants<T, CS>, extra?: T) => T[]; } export declare const va: VA;