绝对类型库:
declare module "history/lib/createBrowserHistory"
{
export default function createBrowserHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History
}
像这样使用时会在标题中给出编译错误(尽管它在转换为 .tsx 之前在普通的旧 .jsx 中工作):
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')
);
}
我究竟做错了什么?