Skip to content

[BUG]: wrong @octokit/core type augmentation #665

@Andarist

Description

@Andarist

What happened?

In a specific monorepo setup types failed to be resolved/augmented correctly.

From an agent:
"The actual root cause is @octokit/plugin-retry — its module augmentation targets @octokit/core/types while plugin-throttling targets @octokit/core. When both are in the same TS program, the augmentation on the re-exporting module breaks and the OctokitOptions index signature ([option: string]: any) swallows the throttle type, making callback params any"

I couldn't repro this in a standalone file outside of our monorepo though, see TS playground

Versions

import { Octokit } from "@octokit/rest"; // types: 22.0.1
import { throttling } from "@octokit/plugin-throttling"; // types: 11.0.3
import { retry } from "@octokit/plugin-retry"; // types: 8.1.0
  • node 24

Relevant log output

from out CI logs:

15:18:10.826 
./action/utils/github.ts:407:21
15:18:10.826 
Type error: Parameter '_retryAfter' implicitly has an 'any' type.
15:18:10.826 
15:18:10.826 
  405 |     auth: token,
15:18:10.826 
  406 |     throttle: {
15:18:10.826 
> 407 |       onRateLimit: (_retryAfter, _options, _octokit, retryCount) => {
15:18:10.826 
      |                     ^
15:18:10.826 
  408 |         return retryCount <= 2;
15:18:10.826 
  409 |       },
15:18:10.826 
  410 |       onSecondaryRateLimit: (_retryAfter, _options, _octokit, retryCount) => {

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: TriageThis is being looked at and prioritizedType: BugSomething isn't working as documented

    Type

    No type

    Projects

    Status

    🆕 Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions