es6 modules' export = value'

时间:2017-08-28 16:04:40

标签: typescript request

请查看此打字文件的结尾 @types/request

...
declare var request: request.RequestAPI<...>;
export = request;

我正在尝试导入&#39;请求&#39;在我的Typescript文件中

import request from 'request';

request(op).pipe(...);

我收到错误

Module has no default export

我应该如何正确导入&#39;请求&#39; ?

1 个答案:

答案 0 :(得分:1)

您是否尝试过import * as request from 'request'

要使用默认导出语法,模块必须有export default request;而不是export = request;