gpt4 book ai didi

node.js - 模块没有导出成员 'AWS'

转载 作者:行者123 更新时间:2023-12-02 14:29:36 24 4
gpt4 key购买 nike

有人可以帮助我了解命名空间和模块有多么不同吗?

AWS.d.ts

declare module AWS {
...
...
}
export = AWS

helper.d.ts

export declare namespace Helpers{
...
...
}

app.component.d.ts

import {Helpers} from 'mystartup_commons'; //<= works fine
import {AWS} from 'aws-sdk';

错误:

ERROR in /Users/ishandutta2007/Documents/Projects/myproj/src/app/app.component.ts (1,9): Module '"/Users/is handutta2007/Documents/Projects/myproj/node_modules/aws-sdk/typings/AWS"' has no exported member 'AWS'.)

最佳答案

添加 Node 定义文件的引用路径并使用* as 就可以了

app.component.d.ts

/// <reference path="../../node_modules/@types/node/index.d.ts"/>
import * as AWS from 'aws-sdk';

关于node.js - 模块没有导出成员 'AWS',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43020889/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com