Next.js Discord

Discord Forum

Error TypeScript and NextJS

Unanswered
Hanover Hound posted this in #help-forum
Open in Discord
Hanover HoundOP
Hi guys, can you help me with the following?

TS is giving an error

Property 'components' does not exist on type 'NextRouter'.ts(2339)

however, this property Exists. I can see it with a console.log

I am doing:

const router = useRouter(); console.log(router.components)

2 Replies

this isn't documented so I would assume it isn't intended for user usage
the type definition of this property in next.js code:
components: {
  [pathname: string]: PrivateRouteInfo;
};