-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Update readme with type assertion information #310
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
Conversation
packages/github/README.md
Outdated
| ## Webhook Payload Typescript Definitions | ||
| `@octokit/webhooks` provides complete typescript definitions for the payloads associated with each event. You can cast the provided payload to these types for more type information as needed. | ||
|
|
||
| To do this, first install the npm module `npm install --save @octokit/webhooks` |
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.
is --save an option? the docs dont show that option. --save-prod is the default so i dont think we need any save flag at all?
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.
TIL npm install now does this by default, but the --save command is supported for back compat (its a no-op). You used to have to --save dependencies otherwise they wouldn't appear in your package.json
packages/github/README.md
Outdated
| }); | ||
| ``` | ||
|
|
||
| ## Webhook Payload Typescript Definitions |
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.
Consider sentence-case rather than title-case. Sentence-case seems to be the common trend, e.g. here
packages/github/README.md
Outdated
| }); | ||
| ``` | ||
|
|
||
| ## Webhook Payload Typescript Definitions |
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.
nit: consider blank line separating ## header and paragraph (typical markdown style)
packages/github/README.md
Outdated
| ## Webhook Payload Typescript Definitions | ||
| `@octokit/webhooks` provides complete typescript definitions for the payloads associated with each event. You can cast the provided payload to these types for more type information as needed. | ||
|
|
||
| To do this, first install the npm module `npm install --save @octokit/webhooks` |
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.
which version of octokit? it should match package.json
packages/github/README.md
Outdated
| import * as Webhooks from '@octokit/webhooks' | ||
| if (github.context.eventName === 'push') { | ||
| const pushPayload = github.context.payload as Webhooks.WebhookPayloadPush | ||
| core.info(`The head commit is: ${pushPayload}`) |
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.
did you mean pushPayload.head?
packages/github/README.md
Outdated
| ``` | ||
|
|
||
| ## Webhook Payload Typescript Definitions | ||
| `@octokit/webhooks` provides complete typescript definitions for the payloads associated with each event. You can cast the provided payload to these types for more type information as needed. |
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.
nit: consider removing unnecessary words. E.g: The npm module @octokit/webhooks provides complete typescript type definitions for the response payloads associated with each event. You can cast the provided payload to these types for more better type information as needed.
Related to #147