From: Eduardo San Martin Morote Date: Fri, 20 Aug 2021 08:48:48 +0000 (+0200) Subject: refactor: minor code changes X-Git-Tag: v4.0.12~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b806c57135aaa7eb3ed5a7eaba3c34fbb4f16630;p=thirdparty%2Fvuejs%2Frouter.git refactor: minor code changes --- diff --git a/e2e/index.ts b/e2e/index.ts index 19bfc1a3..47cdb0ea 100644 --- a/e2e/index.ts +++ b/e2e/index.ts @@ -27,7 +27,6 @@ examples.sort() declare global { interface Window { app: App - // @ts-ignore: wat??? vm: ComponentPublicInstance r: Router } diff --git a/e2e/transitions/index.ts b/e2e/transitions/index.ts index 7a211143..811260fd 100644 --- a/e2e/transitions/index.ts +++ b/e2e/transitions/index.ts @@ -31,7 +31,7 @@ if (!__CI__) { document.head.append(styleEl) } -const Parent: RouteComponent = { +const Parent = defineComponent({ data() { return { transitionName: 'slide-right', @@ -41,7 +41,6 @@ const Parent: RouteComponent = { const toDepth = to.path.split('/').length const fromDepth = from.path.split('/').length - // @ts-ignore: move to composition api, cannot type `this` yet this.transitionName = toDepth < fromDepth ? 'slide-right' : 'slide-left' await nextTick() next() @@ -57,7 +56,7 @@ const Parent: RouteComponent = { `, -} +}) const NestedTransition = defineComponent({ template: ` diff --git a/src/router.ts b/src/router.ts index 65900c66..7e0b7fc1 100644 --- a/src/router.ts +++ b/src/router.ts @@ -464,11 +464,13 @@ export function createRouter(options: RouterOptions): Router { __DEV__ && 'params' in rawLocation && !('name' in rawLocation) && - Object.keys((rawLocation as any).params).length + // @ts-expect-error: the type is never + Object.keys(rawLocation.params).length ) { warn( `Path "${ - (rawLocation as any).path + // @ts-expect-error: the type is never + rawLocation.path }" was passed with params but they will be ignored. Use a named route alongside params instead.` ) }