From: Eduardo San Martin Morote Date: Tue, 21 Jul 2020 14:55:26 +0000 (+0200) Subject: docs: add more tsdocs X-Git-Tag: v4.0.0-beta.3~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a6a381aea35bccf20e73e79e19cc01853260748;p=thirdparty%2Fvuejs%2Frouter.git docs: add more tsdocs --- diff --git a/src/matcher/types.ts b/src/matcher/types.ts index 726f8fe3..a58924c0 100644 --- a/src/matcher/types.ts +++ b/src/matcher/types.ts @@ -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 - meta: Exclude + /** + * {@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 + /** + * {@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 - // 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 // 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 } diff --git a/src/types/index.ts b/src/types/index.ts index cb8138f4..629219e8 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -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 } @@ -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 /**