Nestjs

typescript 模块引用错误

2019-10-27  本文已影响0人  思考蛙

typescript 模块引用错误,配置 ts ,添加 esModuleInterop 与 allowSyntheticDefaultImports 这样,之前的

import * as module from "module"

的模式全部改回为

import module from "module"
  error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'esModuleInterop' flag and referencing its default export.

tsconfig.json

    "esModuleInterop": true,  // <-- ADD THIS LINE
    "allowSyntheticDefaultImports": true,
上一篇 下一篇

猜你喜欢

热点阅读