Scott Rippey
Scott Rippey
Fixed in `36.6.1` 👍
Feel free to resolve my comments as you wish!
I think, at this point, using `any` is the best bet. We don't (yet) support generics on our components (eg. where we could infer the `data` type and use that...
Published as `36.6.4`! Thanks for reporting!
Looking into the source, I do see some significant changes to `next/link` in the `12.2.0` release... In `12.1.6`, it was importing the "singleton" router from `next/dist/client/router` like so: https://github.com/vercel/next.js/blob/v12.1.6/packages/next/client/link.tsx#L12 ```...
One potential solution/workaround: ```tsx jest.mock('next/dist/shared/lib/router-context', () => { const React = require("react"); const router = require("next-router-mock"); const RouterContext = createContext(router); return { RouterContext }; }) ``` This will replace the...
For reference, I started this https://github.com/vercel/next.js/discussions/38248 to discuss ways to prevent these kinds of breaking changes.
Oh I see ... this is simply a problem with `require`, versus `import` ... let's try this (adding in `.default`): ``` jest.mock("next/dist/shared/lib/router-context", () => { const React = require("react"); const...
Thanks for the feedback! As a long-term solution, I think it might be good to encapsulate some of this logic inside this package, so you could do: ``` // To...
I've started work on this `router-context` concept, but it's not quite complete, and I'm not sure if it's a long-term solution. I'll post here as I update. I'm attempting to...