-
Notifications
You must be signed in to change notification settings - Fork 149
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
feat: Message
type guard helpers
#1572
Conversation
✅ Deploy Preview for electric-next ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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! These will be very helpful.
Could you check the examples for where these would be helpful as well? Anywhere using ShapeStream. E.g. the Redis example needs it
if (!(`key` in message)) return |
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!
Is there a reason we have packages/typescript-client/test/helpers.test.ts and packages/typescript-client/test/helpers.test-d.ts ? These are executing different tests, can we merge them into one file?
@KyleAMathews will update codebase in this same PR to use these helpers @kevin-dp the |
Addresses #1453
Adds the type guards to check whether a message is a
ControlMessage
or aChangeMessage
, documented, tested, and exported.I've also honed in on the message type definitions a bit more as I had experienced an uncaught bug due to the generality of the
Headers
type.