-
Notifications
You must be signed in to change notification settings - Fork 44
Type constructEvent payload parameter as Record<string, unknown> #1307
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
Type constructEvent payload parameter as Record<string, unknown> #1307
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.
PR Summary
Modified the type signature of the constructEvent method's payload parameter in src/webhooks/webhooks.ts to improve type safety for webhook handling.
- Changed payload type from
unknowntoRecord<string, unknown>for better type safety and autocomplete support - Caution: Implementation uses unsafe type assertion (
unknown as EventResponse) which could lead to runtime errors if payload structure doesn't match - Consider implementing runtime validation to ensure payload matches
EventResponsetype before assertion
1 file reviewed, 1 comment
Edit PR Review Bot Settings | Greptile
| constructor( | ||
| readonly key?: string, | ||
| readonly options: WorkOSOptions = {}, | ||
| ) { |
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.
Not sure why CI was giving me a formatter error for this.
…sconstructevent-type-should-only
## Description version bump that includes: - #1307 - #1308 ## Documentation Does this require changes to the WorkOS Docs? E.g. the [API Reference](https://workos.com/docs/reference) or code snippets need updates. ``` [ ] Yes ``` If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.
Type constructEvent payload parameter as Record<string, unknown>.
Type constructEvent payload parameter as Record<string, unknown>.
Type constructEvent payload parameter as Record<string, unknown>.
Type constructEvent payload parameter as Record<string, unknown>.
Type constructEvent payload parameter as Record<string, unknown>.
Type constructEvent payload parameter as Record<string, unknown>.
Type constructEvent payload parameter as Record<string, unknown>.
Type constructEvent payload parameter as Record<string, unknown>.
Type constructEvent payload parameter as Record<string, unknown>.
Type constructEvent payload parameter as Record<string, unknown>.
Type constructEvent payload parameter as Record<string, unknown>.
Type constructEvent payload parameter as Record<string, unknown>.
Type constructEvent payload parameter as Record<string, unknown>.
Type constructEvent payload parameter as Record<string, unknown>.
Type constructEvent payload parameter as Record<string, unknown>.
Type constructEvent payload parameter as Record<string, unknown>.
Type constructEvent payload parameter as Record<string, unknown>.
Description
Type constructEvent payload parameter as Record<string, unknown>.
Example usage:
Documentation
Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.
If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.