Unverified Commit 924f8ae3 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Remove old ts-ignores and extra value in routeInfo (#10429)

parent 0b1ef7cb
......@@ -150,7 +150,6 @@ export default class Router implements BaseRouter {
// Backwards compat for Router.router.events
// TODO: Should be remove the following major version as it was never documented
// @ts-ignore backwards compatibility
this.events = Router.events
this.pageLoader = pageLoader
......@@ -355,7 +354,6 @@ export default class Router implements BaseRouter {
method = 'replaceState'
}
// @ts-ignore pathname is always a string
const route = toRoute(pathname)
const { shallow = false } = options
......@@ -394,7 +392,6 @@ export default class Router implements BaseRouter {
Router.events.emit('routeChangeStart', as)
// If shallow is true and the route exists in the router cache we reuse the previous result
// @ts-ignore pathname is always a string
this.getRouteInfo(route, pathname, query, as, shallow).then(routeInfo => {
const { error } = routeInfo
......@@ -404,7 +401,6 @@ export default class Router implements BaseRouter {
Router.events.emit('beforeHistoryChange', as)
this.changeState(method, url, addBasePath(as), options)
const hash = window.location.hash.substring(1)
if (process.env.NODE_ENV !== 'production') {
const appComp: any = this.components['/_app'].Component
......@@ -413,8 +409,7 @@ export default class Router implements BaseRouter {
!(routeInfo.Component as any).getInitialProps
}
// @ts-ignore pathname is always defined
this.set(route, pathname, query, as, { ...routeInfo, hash })
this.set(route, pathname, query, as, routeInfo)
if (error) {
Router.events.emit('routeChangeError', error, as)
......@@ -658,7 +653,6 @@ export default class Router implements BaseRouter {
return
}
// @ts-ignore pathname is always defined
const route = toRoute(pathname)
this.pageLoader.prefetch(route).then(resolve, reject)
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment