Skip to content

Commit

Permalink
Add some type definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
hwwi committed Jul 18, 2019
1 parent 6f55794 commit 0734f82
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 1 deletion.
5 changes: 5 additions & 0 deletions types/ActionTypes.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module 'found/lib/ActionTypes' {
import { ActionTypes } from 'found';

export default ActionTypes;
}
5 changes: 5 additions & 0 deletions types/Matcher.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module 'found/lib/Matcher' {
import { Matcher } from 'found';

export default Matcher;
}
5 changes: 5 additions & 0 deletions types/createInitialBrowserRouter.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module 'found/lib/createInitialBrowserRouter' {
import { createInitialBrowserRouter } from 'found';

export default createInitialBrowserRouter;
}
5 changes: 5 additions & 0 deletions types/createInitialFarceRouter.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module 'found/lib/createInitialFarceRouter' {
import { createInitialFarceRouter } from 'found';

export default createInitialFarceRouter;
}
5 changes: 5 additions & 0 deletions types/getStoreRenderArgs.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module 'found/lib/getStoreRenderArgs' {
import { getStoreRenderArgs } from 'found';

export default getStoreRenderArgs;
}
5 changes: 5 additions & 0 deletions types/hotRouteConfig.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module 'found/lib/hotRouteConfig' {
import { hotRouteConfig } from 'found';

export default hotRouteConfig;
}
22 changes: 21 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ declare module 'found' {
*/
state: S;
}
interface ActionTypes {
UPDATE_MATCH: '@@found/UPDATE_MATCH';
RESOLVE_MATCH: '@@found/RESOLVE_MATCH';
}

const ActionTypes: ActionTypes;

type Params = ObjectStringMap;

Expand Down Expand Up @@ -319,6 +325,8 @@ declare module 'found' {
children?: RouteConfig[];
}

function hotRouteConfig(routeConfig: RouteConfig): RouteConfig;

class HttpError {
constructor(status: number, data?: any);
status: number;
Expand Down Expand Up @@ -402,7 +410,7 @@ declare module 'found' {

function createMatchEnhancer(
matcher: Matcher,
): () => StoreEnhancer<{
): StoreEnhancer<{
found: {
matcher: Matcher;
replaceRouteConfig: (routes: RouteConfig) => void;
Expand Down Expand Up @@ -480,6 +488,18 @@ declare module 'found' {
...options
}: CreateInitialFarceRouterArgs): ConnectedRouter;

interface createInitialBrowserRouterArgs
extends Omit<
CreateInitialFarceRouterArgs,
'resolver' | 'historyProtocol'
> {
matchContext?: any;
}

function createInitialBrowserRouter(
options: createInitialBrowserRouterArgs,
): ConnectedRouter;

interface GetStoreRenderArgsArgs {
store: Store;
getFound?: (store: any) => FoundState;
Expand Down

0 comments on commit 0734f82

Please sign in to comment.