微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Angular 10 Typescript 3.9 npm运行测试暂时导入失败

如何解决Angular 10 Typescript 3.9 npm运行测试暂时导入失败

我正在使用Angular v10.0.3和Typescript v 3.9.7。当我运行npm run test:ci时,我得到以下信息。 我在组件和服务中使用import moment from 'moment'。还启用了tsconfig.app.json中的“ allowSyntheticDefaultImports”标志

"compilerOptions": {
        "esModuleInterop": true,"allowSyntheticDefaultImports": true,}

任何人都可以帮助解决错误吗?

export = moment;
        ~~~~~~~~~~~~~~~~
    This module is declared with using 'export =',and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag. 
client/app/shared/services/util.service.ts:3:8 - error TS1259: Module '"E:/Dev/TPS-Web/Src/OPUS/node_modules/moment/ts3.1-typings/moment"' can only be default-imported using the 'allowSyntheticDefaultImports' flag

谢谢

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。