当前位置:   article > 正文

typescript报错“can only be default-imported using the 'esModuleInterop' flag

can only be default-imported using the 'esmoduleinterop' flag

typescript报错:

can only be default-imported using the
‘esModuleInterop’ flag

2 import request from ‘request’
~~~~~~~

…/node_modules/@types/request/index.d.ts:399:1
399 export = request;
This module is declared with using ‘export =’, and can only be used with a default import when using the ‘esModuleInterop’ flag.


can only be default-imported using the
'esModuleInterop' flag

2 import request from 'request'
         ~~~~~~~

  ../node_modules/@types/request/index.d.ts:399:1
    399 export = request;
This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

解决方案:

import _ = require('mongoose-sequence');
  • 1

我这里的解决方式为:

import request = require('request');
  • 1

并不一定能解决你的问题,只是提供一种可能的解决方案

参考:https://stackoverflow.com/questions/57960016/what-does-can-only-be-default-imported-using-the-esmoduleinterop-flag-mean

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号