forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ember__routing] Add types from Router Service RFC (DefinitelyTyped#3…
…4199) * [ember__routing] Add types from Router Service RFC emberjs/rfcs#95 * [ember__routing] Add `RouteInfo` tests Also includes tweaks to `RouteInfo` definition and docs
- Loading branch information
1 parent
20573fa
commit 20f7b52
Showing
5 changed files
with
118 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// https://api.emberjs.com/ember/3.6/classes/RouteInfo | ||
/** | ||
* A `RouteInfo` is an object that contains metadata about a specific route within a `Transition`. | ||
* It is read-only and internally immutable. | ||
* It is also not observable, because a `Transition` instance is never changed after creation. | ||
*/ | ||
export default interface RouteInfo { | ||
/** | ||
* A reference to the childe route's `RouteInfo`. | ||
* This can be used to traverse downward to the leafmost `RouteInfo`. | ||
*/ | ||
readonly child: RouteInfo | null; | ||
/** | ||
* The final segment of the fully-qualified name of the route, like "index". | ||
*/ | ||
readonly localName: string; | ||
/** | ||
* The dot-separated, fully-qualified name of the route, like "people.index". | ||
*/ | ||
readonly name: string; | ||
/** | ||
* The ordered list of the names of the params required for this route. | ||
* It will contain the same strings as `Object.keys(params)`, but here the order is significant. | ||
* This allows users to correctly pass params into routes programmatically. | ||
*/ | ||
readonly paramNames: string[]; | ||
/** | ||
* The values of the route's parameters. | ||
* These are the same params that are received as arguments to the route's `model` hook. | ||
* Contains only the parameters valid for this route, if any (params for parent or child routes are not merged). | ||
*/ | ||
readonly params: { [key: string]: string | undefined }; | ||
/** | ||
* A reference to the parent route's `RouteInfo`. | ||
* This can be used to traverse upward to the topmost `RouteInfo`. | ||
*/ | ||
readonly parent: RouteInfo | null; | ||
/** | ||
* The values of any query params on this route. | ||
*/ | ||
readonly queryParams: { [key: string]: string | undefined }; | ||
/** | ||
* Allows you to traverse through the linked list of `RouteInfo`s from the topmost to leafmost. | ||
* Returns the first `RouteInfo` in the linked list for which the callback returns true. | ||
* | ||
* @param callback the callback to execute. | ||
*/ | ||
find(callback: (item: RouteInfo) => boolean): RouteInfo | undefined; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters