Skip to content

Conversation

@seb-cr
Copy link
Contributor

@seb-cr seb-cr commented Dec 8, 2023

Further work to make SQSMessageModel more type-safe.

  • Properties that have only a getter (no setter) are made readonly
  • body type changed from string (incorrect) to unknown

Jira: ENG-2733

This is the parsed JSON body, so could have any type. Using `unknown`
because this is safer -- you will have to cast or validate the value
before accessing fields from it.

I thought about adding a type parameter to `SQSMessageModel` for a
generic body type, however without any validation this is not type-safe.
I think we should stick to the `RequestModel` approach of just returning
data and letting the user validate and type it as needed.
@seb-cr seb-cr requested a review from corinja December 11, 2023 13:18
@seb-cr seb-cr merged commit baa4966 into beta Dec 11, 2023
@seb-cr seb-cr deleted the ENG-2733/better-sqsmessagemodel-types branch December 11, 2023 16:22
@github-actions
Copy link

🎉 This PR is included in version 2.0.0-beta.13 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants