const temp = [{component: Button, props:buttonProps}, {component: Input, props: inputProps},{component: Select, props: selectProps} ]
temp.map(cm=>{
return(<div><cm.component {...cm.props}/>)
})
when I use the above loop for dynamic components rendered in react with type script, getting some prop type definition error
error: Type '{} | { label?: string | undefined; variant?: "link" | "primary" | "icon-only" | "borderless" | "inline" | "cta" | undefined; size?: "xl" | "lg" | "sm" | "md" | undefined; id?: string | undefined; ... 277 more ...; onTransitionEndCapture?: TransitionEventHandler<...> | undefined; } | ... 7 more ... | { ...; }' is not assignable to type 'never'.
The intersection 'IntrinsicAttributes & ButtonProps & TagProps & SwitchProps & ToggleProps & BadgeProps & MessageBlockProps & AvatarProps & CardProps & ModalProps' was reduced to 'never' because property 'variant' has conflicting types in some constituents.
Type '{}' is not assignable to type 'never'.
Not sure if this meet you're looking for.
Since the
mapcouldn't make tsc to check each individual element in the tuple then we build atype safetuple for it.