Skip to content

Commit

Permalink
feat(params): add option to use generic type for Transition.params (#17)
Browse files Browse the repository at this point in the history
* added option to use generic type for Transition.params, e.g., `trans.params<MyInterface>()`
Closes #16
  • Loading branch information
csvn authored and christopherthielen committed Dec 19, 2016
1 parent aa551e4 commit eb12ec8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/transition/transition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,9 @@ export class Transition implements IHookRegistry {
*
* @returns transition parameter values for the desired path.
*/
params(pathname: string = "to"): { [key: string]: any } {
params(pathname?: string): any;
params<T>(pathname?: string): T;
params(pathname: string = "to") {
return this._treeChanges[pathname].map(prop("paramValues")).reduce(mergeR, {});
}

Expand Down

0 comments on commit eb12ec8

Please sign in to comment.