Title: Broken Octokit Types · Issue #6 · dsnsgithub/dsns.dev · GitHub
Open Graph Title: Broken Octokit Types · Issue #6 · dsnsgithub/dsns.dev
X Title: Broken Octokit Types · Issue #6 · dsnsgithub/dsns.dev
Description: The GitHub Feed types are not type safe, caused by broken Octokit types. dsns.dev/src/components/GithubFeed.astro Lines 94 to 102 in e18d09a if (type === "PullRequestEvent" && (payload as any).action === "closed" && pr.merged) { verb = "...
Open Graph Description: The GitHub Feed types are not type safe, caused by broken Octokit types. dsns.dev/src/components/GithubFeed.astro Lines 94 to 102 in e18d09a if (type === "PullRequestEvent" && (payload as any).acti...
X Description: The GitHub Feed types are not type safe, caused by broken Octokit types. dsns.dev/src/components/GithubFeed.astro Lines 94 to 102 in e18d09a if (type === "PullRequestEvent" && (pa...
Opengraph URL: https://github.com/dsnsgithub/dsns.dev/issues/6
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Broken Octokit Types","articleBody":"The GitHub Feed types are not type safe, caused by broken Octokit types.\n\nhttps://github.com/dsnsgithub/dsns.dev/blob/e18d09af6521cb842a8b400dbde1eaad241a8621/src/components/GithubFeed.astro#L94-L102\n\n\nI will have to fork it and update the types myself, since apparently there is no maintainer for the official Octokit JS repositories anymore.\nhttps://github.com/octokit/openapi-types.ts/issues/232#issuecomment-3829345747\nhttps://github.com/octokit/rest.js/issues/128\n\n# My Fix\n\n## Use my [fork](https://github.com/dsnsgithub/openapi-types.ts), add this to `package.json`[^1]:\n\n```json\n\"overrides\": {\n \"@octokit/openapi-types\": \"github:dsnsgithub/openapi-types.ts#main\"\n},\n```\n\n[^1]: You may have to delete `node_modules`/`package-lock.json` and reset Vercel build cache for the override to take effect.\n\n\nUse this hack to typeguard:\n```ts\nexport type EventPayloadMap = {\n CreateEvent: components[\"schemas\"][\"create-event\"];\n DeleteEvent: components[\"schemas\"][\"delete-event\"];\n DiscussionEvent: components[\"schemas\"][\"discussion-event\"];\n IssuesEvent: components[\"schemas\"][\"issues-event\"];\n IssueCommentEvent: components[\"schemas\"][\"issue-comment-event\"];\n ForkEvent: components[\"schemas\"][\"fork-event\"];\n GollumEvent: components[\"schemas\"][\"gollum-event\"];\n MemberEvent: components[\"schemas\"][\"member-event\"];\n PublicEvent: components[\"schemas\"][\"public-event\"];\n PushEvent: components[\"schemas\"][\"push-event\"];\n PullRequestEvent: components[\"schemas\"][\"pull-request-event\"];\n PullRequestReviewCommentEvent: components[\"schemas\"][\"pull-request-review-comment-event\"];\n PullRequestReviewEvent: components[\"schemas\"][\"pull-request-review-event\"];\n CommitCommentEvent: components[\"schemas\"][\"commit-comment-event\"];\n ReleaseEvent: components[\"schemas\"][\"release-event\"];\n WatchEvent: components[\"schemas\"][\"watch-event\"];\n};\n\nfunction isEvent\u003cT extends keyof EventPayloadMap\u003e(\n event: components[\"schemas\"][\"event\"],\n type: T\n): event is components[\"schemas\"][\"event\"] \u0026 { type: T; payload: EventPayloadMap[T] } {\n return event.type === type;\n}\n```\n\nExample Usage:\n\n```ts\nimport { Octokit } from \"@octokit/rest\";\nimport type { components } from \"@octokit/openapi-types\";\n\n...\n\nconst res = await octokit.rest.activity.listPublicEventsForUser({\n\tusername: \"dsnsgithub\"\n})\n\nfor (const event of res.data) {\n\tif (isEvent(event, \"PullRequestEvent\")) {\n\t\t// event is now PullRequestEvent and is typeguarded.\n\t} else if (isEvent(event, \"IssuesEvent\")) {\n\t\t// event is now IssuesEvent and is typeguarded.\n\t}\n}\n```","author":{"url":"https://github.com/dsnsgithub","@type":"Person","name":"dsnsgithub"},"datePublished":"2026-02-04T09:10:34.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/6/dsns.dev/issues/6"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9da2e50a-cd5b-8647-d377-6edaa0d0c245 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BC24:8184:64FDE5:818C5B:69928DFF |
| html-safe-nonce | 76d0b4ac1e84ded0a49dc5046ed9ee6e03ba8bfd034d3183cc4b08cf2ba63bcf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQzI0OjgxODQ6NjRGREU1OjgxOEM1Qjo2OTkyOERGRiIsInZpc2l0b3JfaWQiOiI3NjExNTEyODk4ODIxNzIxNTk5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 804bd0a61b28499f501fc7133a502940b44291b8e6e0cfe67f83d25abac7c863 |
| hovercard-subject-tag | issue:3895479514 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/dsnsgithub/dsns.dev/6/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a815351ed4b6a52fc90ec25ab2daed111d14e442cccc1669705c9e94ea5d518d/dsnsgithub/dsns.dev/issues/6 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a815351ed4b6a52fc90ec25ab2daed111d14e442cccc1669705c9e94ea5d518d/dsnsgithub/dsns.dev/issues/6 |
| og:image:alt | The GitHub Feed types are not type safe, caused by broken Octokit types. dsns.dev/src/components/GithubFeed.astro Lines 94 to 102 in e18d09a if (type === "PullRequestEvent" && (payload as any).acti... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dsnsgithub |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/dsnsgithub/dsns.dev git https://github.com/dsnsgithub/dsns.dev.git |
| octolytics-dimension-user_id | 48170013 |
| octolytics-dimension-user_login | dsnsgithub |
| octolytics-dimension-repository_id | 837030090 |
| octolytics-dimension-repository_nwo | dsnsgithub/dsns.dev |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 837030090 |
| octolytics-dimension-repository_network_root_nwo | dsnsgithub/dsns.dev |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width