【问题标题】:What does "can only be default-imported using the 'esModuleInterop' flag" mean?“只能使用 'esModuleInterop' 标志默认导入”是什么意思?
【发布时间】:2020-01-17 11:28:09
【问题描述】:

我收到以下错误:

lib/app.ts:1:8 - error TS1259: Module '"mongoose-sequence"' can only be default-imported using the 'esModuleInterop' flag

在以下代码行:

import _ from 'mongoose-sequence';

现在,我很高兴承认我遗漏了整个“下划线作为函数名”的东西,但这个错误没有任何意义,因为 esModuleInterop 标志绝对肯定设置为 true在我的 ts.config 文件中。

我正在尝试导入这个:

declare module 'mongoose-sequence' {
  import mongoose = require('mongoose');
  var _: (schema: mongoose.Schema, options?: Object) => void;
  export = _;

来自猫鼬序列的肯定类型定义。

我错过了什么?

【问题讨论】:

    标签: typescript mongoose-sequence


    【解决方案1】:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-02
      • 2020-11-28
      • 1970-01-01
      • 2020-09-28
      • 1970-01-01
      • 2020-06-18
      • 2020-08-13
      • 1970-01-01
      相关资源
      最近更新 更多