Skip to content

Commit

Permalink
fix(typescript): Another Typescript quirk
Browse files Browse the repository at this point in the history
  • Loading branch information
Ostap Chervak committed Jan 3, 2018
1 parent 0dda65b commit 7fe3ddd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
16 changes: 7 additions & 9 deletions src/poa.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
// Workaround for typescript usage
declare module 'mobx-little-router-react*';
declare module 'mobx-little-router-react/lib/*';

import * as React from 'react';
import { Outlet, RouterProvider } from 'mobx-little-router-react/lib';
const MLRR = require('mobx-little-router-react');

import { reactDomPromisify } from './utils/react-dom-wrapper';
import { Component } from './component';
Expand Down Expand Up @@ -31,9 +27,9 @@ class PoaApp extends React.Component<{ config: PoaBootConfig; router: Router }>

render() {
return (
<RouterProvider router={this.props.router}>
<Outlet />
</RouterProvider>
<MLRR.RouterProvider router={this.props.router}>
<MLRR.Outlet />
</MLRR.RouterProvider>
);
}
}
Expand Down Expand Up @@ -108,4 +104,6 @@ export { observable, action, when, autorun, autorunAsync, IComputedValue, observ
// router
import { Link } from './router-lib/link';

export { RouterType, Link, Route, Navigation, Outlet };
export const Outlet: any = MLRR.Outlet;

export { RouterType, Link, Route, Navigation };
2 changes: 1 addition & 1 deletion src/router-lib/link.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Link as MobxRouterLink } from 'mobx-little-router-react';
const { Link: MobxRouterLink } = require('mobx-little-router-react');

export function Link(props: any) {
return <MobxRouterLink {...props} />;
Expand Down
2 changes: 1 addition & 1 deletion src/router-lib/router.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createBrowserHistory, createHashHistory, createMemoryHistory, History } from 'history';
import { install, Outlet, RouterProvider } from 'mobx-little-router-react';
const { install, Outlet, RouterProvider } = require('mobx-little-router-react');
import { PoaBootConfig, RouterType, PoaRouteBootConfig } from '../poa.interfaces';
import { getStore, getActions } from '../state-lib/state';
import { addComponentToRegistry, injectPropertyToAllComponents } from '../components-registry';
Expand Down

0 comments on commit 7fe3ddd

Please sign in to comment.