Closed nasheomirro closed 1 year ago
Hi, I am trying to use onlyAs to create a button that can have the following types OnlyAs<'button' | 'a' | typeof Link>
where Link is next/link. However, whenever I add this I get the error 'href' is declared here
. It appears that it doesn't apply unknown to typeof props
Adding constraints lead to errors when using newer versions of @types/react.
This is also the case when using a single prop:
I think this has something to do with the props being known, props become
ComponentProps<"button"> | ComponentProps<"a">
instead of the usualComponentProps<ElementType<any>>
.As
can either be "button" | "a" so there is a mismatch whereAs
could be "button" but it's props could beComponentProps<"a">