-
Notifications
You must be signed in to change notification settings - Fork 153
feat(parser): allow parser set event type of handler with middy #2786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work on these types, just left one minor comment about naming (& a suggestion to fix a typo).
Looking forward to merge it!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this improvement!
Summary
This PR introduces type inference for event type of handler when using parser with middy middleware. Based on the combination of provided inputs (schema, envelope, safeParse) the type can change between a single object, an array (i.e.
SqsEnvelope
) and safeParse, where we wrap the result intoParsedResult
. I have modified the unit tests to use the inference which should have an error, if the type inference breaks.Changes
ParseOutput
to narrow down the type of the modified eventDynamoDBStreamEnvelopeResponse
to types folderIssue number: closes #2407
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.