Hi,
I'm encountering a TypeScript error with a React component that returns a PrismicNextLink. The component is supposed to accept all props that are expected by PrismicNextLink, using the PrismicNextLinkProps type. However, I'm getting the following error:
I can't answer your question (because I don't know how), but I wanted to add my support for you finding an answer. I look forward to seeing what this solution would look like.
This seems to be an issue of conflicting/mismatched props between components that TypeScript isn't resolving. For example, PrismicNextLink accepts all props of next/link except href, which might be causing your issue here. Have you tried specifying a field for your PrismicNextLink?
The error suggests a type mismatch with the props you're spreading onto the component, particularly around href, as, or other AnchorHTMLAttributes. Are you certain that PrismicNextLinkProps correctly extends all expected types, especially when omitting or modifying some props like href or as?
For anyone else running into this issue, Josh found the solution in the following thread:
It was related to package dependencies. To guarantee up-to-date packages, you can run npx npm-upgrade@latest, delete the node_modules folder, and re-install all the dependencies.