The DefinitelyTyped library:
declare module "history/lib/createBrowserHistory" { export default function createBrowserHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History }
gives the compile error in the title when used like this (although it worked in plain old .jsx before converting to .tsx):
import React = require('react'); import reactDom = require('react-dom'); import ReactRouter = require('react-router'); import createBrowserHistory = require('history/lib/createBrowserHistory'); import routes = require('app/tools/routes'); export function createReactApp() : void { let history = createBrowserHistory(); // <-- error :( reactDom.render ( <ReactRouter.Router history={history}>{routes}</ReactRouter.Router>, document.getElementById('app') ); }
What am I doing wrong?