update angular-ui-router state get to use union type

This commit is contained in:
Haas, Mike
2017-09-13 21:35:59 -04:00
parent acc37d8b9d
commit ff76d52f28
2 changed files with 10 additions and 6 deletions

View File

@@ -197,6 +197,11 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
this.$state.get(this.$state.current);
this.$state.get(this.$state.current, "yourState");
this.$state.get(this.$state.current, this.$state.current);
// make sure get() accepts a discriminated union type as well
let myState: string | ng.ui.IState;
this.$state.get(myState);
this.$state.reload();
// http://angular-ui.github.io/ui-router/site/#/api/ui.router.state.$state#properties

View File

@@ -1,6 +1,8 @@
// Type definitions for Angular JS (ui.router module) 1.1.5
// Type definitions for Angular JS (ui.router module) 1.1.38
// Project: https://github.com/angular-ui/ui-router
// Definitions by: Michel Salib <https://github.com/michelsalib>, Ivan Matiishyn <https://github.com/matiishyn>
// Definitions by: Michel Salib <https://github.com/michelsalib>
// Ivan Matiishyn <https://github.com/matiishyn>
// Mike Haas <https://github.com/mikehaas763>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -272,10 +274,7 @@ declare module 'angular' {
is(state: IState, params?: {}): boolean;
href(state: IState, params?: {}, options?: IHrefOptions): string;
href(state: string, params?: {}, options?: IHrefOptions): string;
get(state: string, context?: string): IState;
get(state: IState, context?: string): IState;
get(state: string, context?: IState): IState;
get(state: IState, context?: IState): IState;
get(state: string | IState, context?: string | IState): IState;
get(): IState[];
/** A reference to the state's config object. However you passed it in. Useful for accessing custom data. */
current: IState;