In the nextjs docs under the imperative routing example, there is a usage of Router.push('about-url')
But when using typescript, there is an error saying Property 'push' does not exist on type SingletonRouter. Sample snippet as follows:
import Router from 'next/router'
Router.push('/url') // <--- error
The SingletonRouter has nested router property in order to use the push like Router.router.push.
@Dru89 @brikou
Solved after upgrading to v6.0.1
I'm having this issue with "@types/next": "^9.0.0",
Property 'push' does not exist on type 'typeof Router'.ts(2339)
I also have the same issue.
Most helpful comment
I'm having this issue with
"@types/next": "^9.0.0",Property 'push' does not exist on type 'typeof Router'.ts(2339)