Skip to content

fix: explicit type annotations for throttle callbacks broken by @octokit/plugin-retry v8.1.0#1719

Closed
Kesin11 with Copilot wants to merge 2 commits into
renovate/octokit-monorepofrom
copilot/sub-pr-1704
Closed

fix: explicit type annotations for throttle callbacks broken by @octokit/plugin-retry v8.1.0#1719
Kesin11 with Copilot wants to merge 2 commits into
renovate/octokit-monorepofrom
copilot/sub-pr-1704

Conversation

Copilot AI commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

@octokit/plugin-retry v8.1.0 changed its module augmentation target from @octokit/core to @octokit/core/types (a distinct TypeScript module path), breaking contextual type inference for the throttle.onRateLimit and throttle.onSecondaryRateLimit callback parameters in GithubClient.

Changes

  • src/client/github_client.ts: Add explicit type annotations to throttle callback parameters; extract a shared ThrottleRequestOptions type alias to avoid duplication.
// Before – inference broke, parameters became implicit `any`
onRateLimit: (retryAfter, options, _octokit, retryCount) => { ... }

// After – explicit annotations restore type safety
type ThrottleRequestOptions = { method: string; url: string };
onRateLimit: (retryAfter: number, options: ThrottleRequestOptions, _octokit: unknown, retryCount: number) => { ... }

{ method: string; url: string } is a structural supertype of Required<EndpointDefaults>, so it satisfies the contra-variant parameter check under strictFunctionTypes.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…rors with @octokit/plugin-retry v8.1.0

Co-authored-by: Kesin11 <1324862+Kesin11@users.noreply.github.com>
Copilot AI changed the title [WIP] Update dependency @octokit/plugin-retry to v8.1.0 fix: explicit type annotations for throttle callbacks broken by @octokit/plugin-retry v8.1.0 Mar 6, 2026
@Kesin11

Kesin11 commented Mar 6, 2026

Copy link
Copy Markdown
Owner

Thanks to implement workaround copilot. However, it might fix octokit/plugin-retry.js#666

@Kesin11 Kesin11 closed this Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants