typescript - "can only be default-imported using the ' esModuleInterop'标志”是什么意思?

标签 typescript mongoose-sequence

我收到以下错误:

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

在以下代码行上:
import _ from 'mongoose-sequence';

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

我正在尝试导入此:
declare module 'mongoose-sequence' {
  import mongoose = require('mongoose');
  var _: (schema: mongoose.Schema, options?: Object) => void;
  export = _;

来自 Mongoose 序列DefinitelyTyped定义。

我想念什么?

最佳答案

关于typescript - "can only be default-imported using the ' esModuleInterop'标志”是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57960016/

相关文章:

node.js - NestJs/Mongoose 中的自动增量序列

typescript - 如何在 TypeScript 中定义不透明类型?

typescript - 递归函数的类型

javascript - 如何从 Mongodb 中删除数组元素

angular - 不推荐使用 FormBuilder 组

class - 在与语言无关的上下文和 typescript 中,环境类是什么?