-
Notifications
You must be signed in to change notification settings - Fork 83
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(typescript): compile-time missing secret error #461
Conversation
src/index.ts
Outdated
if (!options || !options.secret) { | ||
throw new Error("[@octokit/webhooks] options.secret required"); | ||
} | ||
|
||
const state: State = { | ||
const state = { |
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.
const state = { | |
const state: State & { secret: string }= { |
This needs to be explicitly typed as it's an object
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.
I've applied this change although I confess I don't understand it: why do objects need to be explicitly typed?
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.
Answered in #466 (comment), thanks!
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.
Thanks! We shoudl have that a long time ago! I am sure we will be able to make the types much more elegant once we split out the event handling into its own module
🎉 This PR is included in version 8.10.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Should this be a compile-time as well as a run-time error?