Skip to content

Commit

Permalink
Remove old ts-ignores and extra value in routeInfo (#10429)
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Feb 5, 2020
1 parent 0b1ef7c commit 924f8ae
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions packages/next/next-server/lib/router/router.ts
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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)
})
Expand Down

0 comments on commit 924f8ae

Please sign in to comment.