在打字稿无服务器模板中配置functionResponseType
我正在尝试在无服务器框架模板中配置 functionResponseType
(为了使用部分批处理响应)。
这是我对所讨论函数的事件声明:
events: [
{
sqs: {
arn: {
'Fn::GetAtt': [
'TheQueue',
'Arn'
]
},
batchSize: 40,
maximumBatchingWindow: 10,
functionResponseType: "ReportBatchItemFailures",
},
},
],
这是类型声明文件中的SQS块的样子:(
{
sqs:
| AwsArnString
| {
arn: AwsArn;
batchSize?: number;
enabled?: boolean;
maximumBatchingWindow?: number;
functionResponseType?: "ReportBatchItemFailures";
filterPatterns?: FilterPatterns;
};
}
源在这里:)
noreferrer“ > 不编译,带有以下错误:
属性“ functionResponseType”的类型是不兼容的。键入'字符串'不能分配给'reportbatchitemfailures'''。ts(2322)
如果我删除 function> function> functionResponseType
属性属性模板填充了,并且函数按预期部署(但是没有部分SQS响应)功能)。
我不是打字稿的专家,所以我有点被困在这里。我在做什么错?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
“ reportbatchitemfailures”作为const
使其键入安全You can use
"ReportBatchItemFailures" as const
to make it type safe