export type CommonFieldsProps = { id?: string name: string className?: string value: string disabled?: boolean autoFocus?: boolean required?: boolean } export type A11yProps = { id?: string role?: string title?: string tabIndex?: number 'aria-label'?: string 'aria-labelledby'?: string 'aria-describedby'?: string 'aria-controls'?: string } type A11yKeys = keyof A11yProps export function pickA11yProps(source: T): Pick { const initialValue = {} as Pick const keys: Array = [ 'id', 'role', 'title', 'tabIndex', 'aria-label', 'aria-labelledby', 'aria-describedby', 'aria-controls', ] return keys.reduce( (acc, key) => ({ ...acc, [key]: source[key], }), initialValue, ) }