I'm unable to deploy to vercel because of an error with the Button.tsx component. Everything looks good, code-wise, but PrismicNextLink is throwing an error. I'm new to all of this so the error message isn't helping me out much. I've also used PrismicNextLink in other files without issue (and I'm doing the same imports). The error I'm seeing in vercel (on deploy) is below. Any thoughts on what I'm doing wrong?
This is not an error happening in your local environment? Sometimes deployment environments are a bit stricter. What button is causing this issue? The error indicates a type mismatch, so are you able to tell what you're passing to this button component in your code?
Thanks Ezekiel! Well, the error is being called out in the local environment (in VSCode) but it doesn't seem to fail there, or at least I can run the npm run dev command is ok. The error seems contained to that component file as well and isn't because of the way that I'm referencing (passing properties to ) the button component in other files. I've been digging in on it quite a bit and I think the issue is that some of the properties in {...restProps} aren't compatible between NextLink and NextLinkProps but I'm super new to React / Next / ... prismic... (first project with all of it) so I'm struggling a bit to get the big picture here.
that last screeshot show the red error squigly in VSCode along with the error that is being reporting in the definition of the button component. This is straight from the video tutorial that was put out by prismic
I think the issue is that some of the properties in {...restProps} aren't compatible between NextLink and NextLinkProps
This sounds about right to me PrismicNextLink is its own custom React component, and it doesn't accept the href prop that next/link has, which could be causing the problem here. I asked earlier what you were passing to this button, because usually this error means that some of the props from ...restProps are incompatible with what PrismicNextLink expects.
You say that you're able to run npm run dev "ok", do you mean that it won't stop you navigating your website locally, but your button doesn't work?
I saw you posted in that thread, did you try this?
The button works in dev. I did try to add the field property in PrismicNextLink but that doesn't help. I'm looking at the definitions but having a hard time figuring out which properties I should keep along... or if I should just swap PrismicNextLinkProps out for a more generic object ? Like I said, this is all very new to me so I'm having a tough time understanding how these properties are applied, etc. Was looking at the below code to try and figure it out.
Next.js ignores TypeScript errors in development, which is why you're not seeing the error until deployment. It's likely you'd see the same type error if you built the project locally with npm run build.
Are all your dependencies up to date? To guarantee they are, you can run npx npm-upgrade@latest, delete the node_modules folder, and re-install all the dependencies.
If that doesn't work, the easiest way we could diagnose this issue for you would be with your project's code. You can send me a GitHub link (via DM if you'd like) or a .zip file, and we'll be able to look directly at the code to see if we can figure it out.