标签: node.js typescript amazon-web-services aws-lambda
我是 Typescript 的新手,我正在寻找有关如何从处理程序函数访问 event.body 类型而不是定义接口的建议。我正在使用无服务器 aws-nodejs-typescript 模板。
请求架构:
处理函数:
正如你所看到的 createBeneficiary 函数接受任何类型,现在我更喜欢它是强类型的,我可以创建和接口,但我想知道是否有更好的方法,因为它已经在请求模式中定义。谢谢!