Skip to content

[BUG]: Mismatch between types in v15 and v14 - Incomplete upgrade #692

@coxd

Description

@coxd

What happened?

The upgrade to v15 was completed here in core: octokit/core.js#748

However it is still pending here (and almost everywhere else @octokit/types is a dependency): #691

This code:

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

const CustomOctokit = Octokit.plugin(throttling);
const octokit = new CustomOctokit({});

async function foo() {
    const issues = await octokit.paginate(
        octokit.teams.listMembersInOrg,
        {
            org: 'blah',
            team_slug: 'blah',
            per_page: 100
        }
    );

}

Results in this error:

> tsc --project tsconfig.json

src/index.ts:9:9 - error TS2769: No overload matches this call.
  The last overload gave the following error.
    Argument of type '{ (params?: (RequestParameters & { role?: "all" | "member" | "maintainer" | undefined; per_page?: number | undefined; page?: number | undefined; org: string; team_slug: string; }) | undefined): Promise<...>; defaults: <O extends RequestParameters = RequestParameters>(newDefaults: O) => RequestInterface<...>; endpoin...' is not assignable to parameter of type 'RequestInterface<object>'.
      The types returned by 'defaults(...).defaults(...)(...)' are incompatible between these types.
        Type 'Promise<import("/Users/danielcox/work/octokit-bug/node_modules/@octokit/types/dist-types/OctokitResponse").OctokitResponse<any, number>>' is not assignable to type 'Promise<import("/Users/danielcox/work/octokit-bug/node_modules/@octokit/request/node_modules/@octokit/types/dist-types/OctokitResponse").OctokitResponse<any, number>>'.
          Property 'retryCount' is missing in type 'import("/Users/danielcox/work/octokit-bug/node_modules/@octokit/types/dist-types/OctokitResponse").OctokitResponse<any, number>' but required in type 'import("/Users/danielcox/work/octokit-bug/node_modules/@octokit/request/node_modules/@octokit/types/dist-types/OctokitResponse").OctokitResponse<any, number>'.

9         octokit.teams.listMembersInOrg,
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  node_modules/@octokit/plugin-throttling/dist-types/index.d.ts:15:9
    15         retryCount: number;
               ~~~~~~~~~~
    'retryCount' is declared here.
  node_modules/@octokit/plugin-paginate-rest/dist-types/types.d.ts:98:5
    98     <R extends OctokitTypes.RequestInterface>(request: R, parameters?: Parameters<R>[0]): Promise<NormalizeResponse<OctokitTypes.GetResponseTypeFromEndpointMethod<R>>["data"]>;
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The last overload is declared here.


Found 1 error in src/index.ts:9

Versions

...
"dependencies": {
    "@octokit/plugin-throttling": "^11.0.1",
    "@octokit/rest": "^22.0.0"
}
...

Relevant log output

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