I'm trying to filter some props and then pass down the rest of the props to a native html element like so:
const Placeholder = (
display: boolean,
...rest: Array<React.LabelHTMLAttributes<HTMLLabelElement>>
) => <label {...rest} />
The problem is that this is giving me this error:
Type '{ length: number; toString(): string; toLocaleString(): string; pop(): LabelHTMLAttributes<HTMLLabelElement> | undefined; push(...items: LabelHTMLAttributes<HTMLLabelElement>[]): number; ... 28 more ...; flat<U>(this: U[][][][][][][][], depth: 7): U[]; flat<U>(this: U[][][][][][][], depth: 6): U[]; flat<U>(this: U[]...' has no properties in common with type 'DetailedHTMLProps<LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>'.ts(2559)
How would I define the types for the ...rest parameters for a native html element like a label in Typescript / React?
Array<React.LabelHTMLAttributes<T>>