Skip to content

Document supported @octokit/rest versions #690

@noqcks

Description

@noqcks

I'm trying to use @octokit/rest w/ this plugin

package.json

 "dependencies": {
    "@octokit/plugin-throttling": "^9.1.0",
    "@octokit/rest": "^20.1.0",
  }

index.ts

import { Octokit } from "@octokit/rest";
import { throttling } from "@octokit/plugin-throttling";

const MyOctokit = Octokit.plugin(throttling);

and I get the type error

Argument of type 'typeof throttling' is not assignable to parameter of type 'OctokitPlugin'.
  Types of parameters 'octokit' and 'octokit' are incompatible.
    Type 'import("/Users/noqcks/go/src/github.com/xeol-io/swe-bump-bench/node_modules/.pnpm/@[email protected]/node_modules/@octokit/core/dist-types/index").Octokit' is not assignable to type 'import("/Users/noqcks/go/src/github.com/xeol-io/swe-bump-bench/node_modules/.pnpm/@[email protected]/node_modules/@octokit/core/dist-types/index").Octokit'.
      The types of 'hook.before' are incompatible between these types.
        Type '<Name extends keyof Hooks>(name: Name, beforeHook: BeforeHook<GetType<Hooks[Name], "Options", "O">>) => void' is not assignable to type '<Name extends keyof Hooks>(name: Name, beforeHook: BeforeHook<GetType<Hooks[Name], "Options">>) => void'.
          Types of parameters 'beforeHook' and 'beforeHook' are incompatible.
            Types of parameters 'options' and 'options' are incompatible.
              Type 'GetType<Hooks[Name], "Options", "O">' is not assignable to type 'GetType<Hooks[Name], "Options">'.
                Type 'Hooks[Name][keyof Hooks[Name] & "Options"] | ("O" extends keyof Hooks[Name] ? Hooks[Name][keyof Hooks[Name] & "O"] : any)' is not assignable to type 'GetType<Hooks[Name], "Options">'.
                  Type 'Hooks[Name][keyof Hooks[Name] & "Options"]' is not assignable to type 'GetType<Hooks[Name], "Options">'.
                    Type 'Hooks[Name]["Options"]' is not assignable to type 'GetType<Hooks[Name], "Options">'

it looks @octokit/plugin-throttling and @octokit/rest are using different versions of @octokit/core -- 5.1.0 and 6.1.1 respectively.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions