Skip to content

Commit

Permalink
refactor: fix todos
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Jun 11, 2024
1 parent 4e0d730 commit 839e45b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/router/src/location.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ export function resolveRelativePath(to: string, from: string): string {
*/
export const START_LOCATION_NORMALIZED: RouteLocationNormalizedLoaded = {
path: '/',
name: undefined,
// TODO: could we use a symbol in the future?
name: undefined,
params: {},
query: {},
hash: '',
Expand Down
10 changes: 4 additions & 6 deletions packages/router/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,6 @@ export function createRouter(options: RouterOptions): Router {
}

function resolve(
// NOTE: it's easier to by pass the type generics which are just for type inference in the resolved route
rawLocation: RouteLocationRaw,
currentLocation?: RouteLocationNormalizedLoaded
): RouteLocationResolved {
Expand Down Expand Up @@ -484,7 +483,7 @@ export function createRouter(options: RouterOptions): Router {
hash: decode(locationNormalized.hash),
redirectedFrom: undefined,
href,
}) as any // FIXME:
})
}

if (__DEV__ && !isRouteLocation(rawLocation)) {
Expand Down Expand Up @@ -582,8 +581,7 @@ export function createRouter(options: RouterOptions): Router {
? normalizeQuery(rawLocation.query)
: ((rawLocation.query || {}) as LocationQuery),
},
// make it typed
matchedRoute as RouteLocation,
matchedRoute,
{
redirectedFrom: undefined,
href,
Expand Down Expand Up @@ -642,7 +640,7 @@ export function createRouter(options: RouterOptions): Router {

if (
__DEV__ &&
(!('path' in newTargetLocation) || newTargetLocation.path == null) &&
newTargetLocation.path == null &&
!('name' in newTargetLocation)
) {
warn(
Expand Down Expand Up @@ -670,7 +668,7 @@ export function createRouter(options: RouterOptions): Router {
}

function pushWithRedirect(
to: RouteLocationRaw,
to: RouteLocationRaw | RouteLocation,
redirectedFrom?: RouteLocation
): Promise<NavigationFailure | void | undefined> {
const targetLocation: RouteLocation = (pendingLocation = resolve(to))
Expand Down

0 comments on commit 839e45b

Please sign in to comment.