Skip to content

Commit

Permalink
added typescript typings
Browse files Browse the repository at this point in the history
  • Loading branch information
nrakic90 committed May 25, 2018
1 parent b0e7e73 commit d7afde2
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ coverage
dist
docs/dist
node_modules
.idea
npm-debug.log
46 changes: 34 additions & 12 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,39 @@
import {State} from "router5";
import {IComputedValue} from "mobx/lib/core/computedvalue";
import {Route, Router} from "router5/create-router";

declare module "mobx-router5" {
import {PluginFactory} from "router5/core/plugins";
import {PluginFactory} from "router5/core/plugins";
import {Params} from "router5";

class RouterStore {
public router: Router;
public previousRoute: Route;
public transitionRoute: Route;
public transitionError: any;
public intersectionNode: string;
// public toActivate: IObservableArray<any>;
// public toDeactivate: IObservableArray<any>;

class RouterStore {
public navigate: (toRoute: string, params?: any) => void;
}
public setRouter: (router: Router) => void;
public updateRoute: (routeType: string, route: Route) => void;
public resetRoute: (routeType: string) => void;
public onTransitionStart: (route: Route, previousRoute: Route) => void;
public onTransitionSuccess: (route: Route, previousRoute: Route, opts) => void;
public onTransitionCancel: (route: Route, previousRoute: Route) => void;
public onTransitionError: (route: Route, previousRoute: Route, transitionError: any) => void;
public clearErrors: () => void;
public navigate: (toRoute: string, params?: Params) => void;
public shouldUpdateNodeFactory: (nodeName) => IComputedValue<(toState: State, fromState?: State) => Boolean>;
}

function mobxPlugin(router: any): PluginFactory;
function mobxPlugin(routerStore: RouterStore): PluginFactory;

namespace RouterStore {}
namespace mobxPlugin {}
namespace RouterStore {}
namespace mobxPlugin {}

export {
RouterStore,
mobxPlugin,
};
}
export {
RouterStore,
mobxPlugin,
};
}

0 comments on commit d7afde2

Please sign in to comment.