]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
docs: add more tsdocs
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 21 Jul 2020 14:55:26 +0000 (16:55 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Tue, 21 Jul 2020 14:55:26 +0000 (16:55 +0200)
src/matcher/types.ts
src/types/index.ts

index 726f8fe3be95221d4f68a7d8ce60ca0fcca35efd..a58924c031a2f0db3fa5522fe61194e36dd93d3b 100644 (file)
@@ -9,28 +9,72 @@ import { ComponentPublicInstance } from 'vue'
 
 // normalize component/components into components and make every property always present
 export interface RouteRecordNormalized {
-  path: RouteRecordMultipleViews['path']
+  /**
+   * {@inheritDoc _RouteRecordBase.path}
+   */
+  path: _RouteRecordBase['path']
+  /**
+   * {@inheritDoc _RouteRecordBase.redirect}
+   */
   redirect: _RouteRecordBase['redirect'] | undefined
-  name: RouteRecordMultipleViews['name']
+  /**
+   * {@inheritDoc _RouteRecordBase.name}
+   */
+  name: _RouteRecordBase['name']
+  /**
+   * {@inheritDoc RouteRecordMultipleViews.components}
+   */
   components: RouteRecordMultipleViews['components']
-  children: Exclude<RouteRecordMultipleViews['children'], void>
-  meta: Exclude<RouteRecordMultipleViews['meta'], void>
+  /**
+   * {@inheritDoc _RouteRecordBase.components}
+   */
+  children: Exclude<_RouteRecordBase['children'], void>
+  /**
+   * {@inheritDoc _RouteRecordBase.meta}
+   */
+  meta: Exclude<_RouteRecordBase['meta'], void>
   /**
    * Object of props options with the same keys as `components`
+   * {@inheritDoc RouteRecordMultipleViews.props}
    */
   props: Record<string, _RouteRecordProps>
+  /**
+   * {@inheritDoc _RouteRecordBase.props}
+   */
   beforeEnter: RouteRecordMultipleViews['beforeEnter']
+  /**
+   * Registered leave guards
+   *
+   * @internal
+   */
   leaveGuards: NavigationGuard[]
+  /**
+   * Registered update guards
+   *
+   * @internal
+   */
   updateGuards: NavigationGuard[]
+  /**
+   * Registered beforeRouteEnter callbacks passed to `next` or returned in guards
+   *
+   * @internal
+   */
   enterCallbacks: Record<string, NavigationGuardNextCallback[]>
-  // having the instances on the record mean beforeRouteUpdate and
-  // beforeRouteLeave guards can only be invoked with the latest mounted app
-  // instance if there are multiple application instances rendering the same
-  // view, basically duplicating the content on the page, which shouldn't happen
-  // in practice. It will work if multiple apps are rendering different named
-  // views.
+  /**
+   * Mounted route component instances
+   * Having the instances on the record mean beforeRouteUpdate and
+   * beforeRouteLeave guards can only be invoked with the latest mounted app
+   * instance if there are multiple application instances rendering the same
+   * view, basically duplicating the content on the page, which shouldn't happen
+   * in practice. It will work if multiple apps are rendering different named
+   * views.
+   */
   instances: Record<string, ComponentPublicInstance | undefined | null>
   // can only be of of the same type as this record
+  /**
+   * Defines if this record is the alias of another one. This property is
+   * `undefined` if the record is the original one.
+   */
   aliasOf: RouteRecordNormalized | undefined
 }
 
index cb8138f4a640364380a1916fb5f456e4219c8ba1..629219e814c913e7702b8b1c7a0c889611c5ab14 100644 (file)
@@ -88,13 +88,39 @@ export interface RouteLocationMatched extends RouteRecordNormalized {
  * @internal
  */
 export interface _RouteLocationBase {
+  /**
+   * Percentage encoded pathname section of the URL.
+   */
   path: string
+  /**
+   * The whole location including the `search` and `hash`. This string is
+   * percentage encoded.
+   */
   fullPath: string
+  /**
+   * Object representation of the `search` property of the current location.
+   */
   query: LocationQuery
+  /**
+   * Hash of the current location. If present, starts with a `#`.
+   */
   hash: string
+  /**
+   * Name of the matched record
+   */
   name: RouteRecordName | null | undefined
+  /**
+   * Object of decoded params extracted from the `path`.
+   */
   params: RouteParams
+  /**
+   * Contains the location we were initially trying to access before ending up
+   * on the current location.
+   */
   redirectedFrom: RouteLocation | undefined
+  /**
+   * Merged `meta` properties from all of the matched route records.
+   */
   meta: Record<string | number | symbol, any>
 }
 
@@ -156,6 +182,8 @@ export interface _RouteRecordBase extends PathParserOptions {
   /**
    * Path of the record. Should start with `/` unless the record is the child of
    * another record.
+   *
+   * @example `/users/:id` matches `/users/1` as well as `/users/posva`.
    */
   path: string
   /**