import type { ComponentProps, ComponentPropsWithRef } from 'react' import type { RNStyle } from '../core/types' export type AnyObject = Record type StyleToClass = K extends 'style' ? 'className' : K extends `${infer StyleProp}Style` ? `${StyleProp}ClassName` : never type ColorPropToClass = K extends 'color' ? 'colorClassName' : K extends `${string}Color` | `${string}color${string}` ? `${K}ClassName` : never export type ApplyUniwind = & { [K in keyof TProps as StyleToClass]?: string } & { [K in keyof TProps as ColorPropToClass]?: string } & TProps export type ApplyUniwindOptions = & { // @ts-expect-error TS isn't smart enough to infer this [K in keyof TOptions as TOptions[K] extends undefined ? never : TOptions[K]['fromClassName']]?: string } & TProps export type Component = React.JSXElementConstructor export type OptionMapping = { fromClassName: string styleProperty?: keyof RNStyle } export type WithUniwind = { // Auto mapping >(Component: TComponent): (props: ApplyUniwind> & {}) => React.ReactNode // Manual mapping , const TOptions extends { [K in keyof ComponentProps]?: OptionMapping }>( Component: TComponent, options: TOptions, ): (props: ApplyUniwindOptions, TOptions> & {}) => React.ReactNode }