Skip to content

Maintenance: improve return type for safeParse in envelopes #3340

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

Closed
1 of 2 tasks
am29d opened this issue Nov 21, 2024 · 0 comments · Fixed by #3339
Closed
1 of 2 tasks

Maintenance: improve return type for safeParse in envelopes #3340

am29d opened this issue Nov 21, 2024 · 0 comments · Fixed by #3339
Labels
confirmed The scope is clear, ready for implementation parser This item relates to the Parser Utility

Comments

@am29d
Copy link
Contributor

am29d commented Nov 21, 2024

Summary

Most of the envelopes have return type ParsedResult<unknown, z.infer<T>> which allow to infer the type from the schema used with the envelope. The envelopes EventBridge, LambdaFunctionUrl, VpcLattice and VpcLatticeV2 have only ParsedResult which we need to make more specific.

Why is this needed?

So it is easier to work with the types derived from the schema instead of casting it manually.

Which area does this relate to?

Parser

Solution

Add ParsedResult<unknown, z.infer<T>> as a return type for safeParse on the the envelopes mentioned above.

Acknowledgment

Future readers

Please react with 👍 and your use case to help us understand customer demand.

@am29d am29d added internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.) triage This item has not been triaged by a maintainer, please wait labels Nov 21, 2024
@am29d am29d moved this from Triage to Working on it in Powertools for AWS Lambda (TypeScript) Nov 21, 2024
@am29d am29d added confirmed The scope is clear, ready for implementation parser This item relates to the Parser Utility and removed triage This item has not been triaged by a maintainer, please wait internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.) labels Nov 21, 2024
@github-project-automation github-project-automation bot moved this from Working on it to Coming soon in Powertools for AWS Lambda (TypeScript) Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed The scope is clear, ready for implementation parser This item relates to the Parser Utility
Projects
Development

Successfully merging a pull request may close this issue.

1 participant