有人可以帮我理解命名空间和模块的不同之处吗?
AWS.d.ts
public async Task<bool> EnsureAuthenticated()
{
return IsAuthenticated || (await Authenticate()).IsSuccess;
}
helper.d.ts
declare module AWS {
...
...
}
export = AWS
app.component.d.ts
export declare namespace Helpers{
...
...
}
错误:
错误 /Users/ishandutta2007/Documents/Projects/myproj/src/app/app.component.ts (1,9):模块'“/ Users / is handutta2007 /文件/项目/的Myproj / node_modules / AWS-SDK /分型/ AWS“” 没有导出的成员'AWS'。)
答案 0 :(得分:3)
添加节点定义文件的引用路径并使用* as
做了诀窍
app.component.d.ts
/// <reference path="../../node_modules/@types/node/index.d.ts"/>
import * as AWS from 'aws-sdk';
答案 1 :(得分:2)
我相信aws-sdk没有默认导出的原因是因为他们希望开发人员仅导入所需的软件包。例如
import { s3 } from 'aws-sdk';
答案 2 :(得分:0)
modeule
而不是module
答案 3 :(得分:-1)
问题已于 Github: node_modules/aws-sdk/index has no default export #2654
解决从 SELECT xmi.memberid,
xmi.value min_record_value,
xma.value max_record_value
FROM (SELECT v1.memberid,
v1.value,
row_number() OVER (PARTITION BY v1.memberid
ORDER BY v1.submit_datetime ASC,
v1.id ASC) rn
FROM membervalues v1) xmi
INNER JOIN (SELECT v2.memberid,
v2.value,
row_number() OVER (PARTITION BY v2.memberid
ORDER BY v2.submit_datetime DESC,
v2.id DESC) rn
FROM membervalues v2) xma
ON xma.memberid = xmi.memberid
AND xma.rn = xmi.rn
WHERE xma.rn = 1
AND xmi.rn = 1;
导入要使用的模块而不是 AWS
Javascript 示例:
aws-sdk
打字稿:
const aws = require('aws-sdk')
let s3 = new aws.S3();