serverless / typescript

TypeScript definitions for Serverless Framework service configuration
140 stars 24 forks source link

function destinations do not support CloudFront intrinsic functions #61

Closed simonmellor closed 2 years ago

simonmellor commented 2 years ago

In the documentation for functions there is an example of usage for destinations where CloudFront functions are used. This is not possible to achieve using the typescript AWS interface which specifies a string for onSuccess and onFailure.

https://www.serverless.com/framework/docs/providers/aws/guide/functions#destinations

fredericbarthelet commented 2 years ago

Hi @simonmellor, thanks for your feedback. I just release latest version of this package. The Typescript definition referring to onSuccess and onFailure property for each fonction is now updated and detailed hereafter:

https://github.com/serverless/typescript/blob/66ebd87f9516ca2116b0f3e02ae8c9007333dfbb/index.d.ts#L595-L608

This definition allows string as well as objects with an arn property refering to AwsCfFunction. The definition for such type is defined as

https://github.com/serverless/typescript/blob/66ebd87f9516ca2116b0f3e02ae8c9007333dfbb/index.d.ts#L10

allowing various kind of Cloudformation intrinsic functions.

Could you share a code snippet where you're facing a Typescript issue if you still encounter one after updating ?

simonmellor commented 2 years ago

Thank you @fredericbarthelet the update has resolved the issue I was facing.