]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
refactor: minor code changes
authorEduardo San Martin Morote <posva13@gmail.com>
Fri, 20 Aug 2021 08:48:48 +0000 (10:48 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Fri, 20 Aug 2021 08:48:52 +0000 (10:48 +0200)
e2e/index.ts
e2e/transitions/index.ts
src/router.ts

index 19bfc1a34db865cb3ff6402384cfa6d781152d72..47cdb0ea18b0901a5a9bf3981ff4cb1953094010 100644 (file)
@@ -27,7 +27,6 @@ examples.sort()
 declare global {
   interface Window {
     app: App<Element>
-    // @ts-ignore: wat???
     vm: ComponentPublicInstance
     r: Router
   }
index 7a2111438ab6898bb99c2515710eaaff2cc4205b..811260fd6041b86b2a599eae27ba41e11b6056b5 100644 (file)
@@ -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 = {
       </router-view>
     </div>
   `,
-}
+})
 
 const NestedTransition = defineComponent({
   template: `
index 65900c664aad098955c8e713465ae13b3acd0460..7e0b7fc11230fe0c4830fc75a8e51c3fcc11a644 100644 (file)
@@ -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.`
         )
       }