import { InputBaseProps } from './types' type OmitDiff = { [K in Exclude]: T1[K] } & { [K in keyof T2]: T2[K] } type InputBaseKey = keyof InputBaseProps type BaseProps = Omit const varList:InputBaseKey[] = [ 'label', 'style', 'error', 'innerWrapper', 'leftIcon', 'rightIcon', 'description', 'wrapper', 'children', 'innerWrapperProps', 'wrapperProps', 'disabled', 'hideErrorMessage', 'style', ] /** * Splits a merged props object so InputBase receives only its own props and the * native input/control component receives the rest — prevents unknown prop warnings * on native elements and avoids spread collisions between the two prop surfaces. */ export function selectInputBaseProps(props: T): { inputBaseProps: BaseProps others: OmitDiff } { const copy = { ...props } const result = varList.reduce((acc, key) => { // @ts-ignore acc[key] = copy[key] return acc }, {} as BaseProps) return { inputBaseProps: result, others: copy as OmitDiff } }