Skip to content

[BUG]: Regression with 11.4.2 adding & OctokitResponse<...> to return type #661

Closed
@chriscarpenter12

Description

@chriscarpenter12

What happened?

From 11.4.1 to 11.4.2 we're seeing an innocuous regression from PR #653

We have a couple instances like this that are showing a return type with a union of & OctokitResponse<...> to the expected data response type. Assuming from here.

Example code that's pulling org packages from GET /orgs/{org}/packages/{package_type}/{package_name}/versions

import { components } from '@octokit/openapi-types';

type Package = components['schemas']['package-version'];

  private async getPackages(): Promise<Package[]> {
    let packages = await this.octokit.paginate(this.octokit.rest.packages.getAllPackageVersionsForPackageOwnedByOrg, {
      org: this.flags.org,
      package_name: this.flags.name,
      package_type: this.flags.type,
      per_page: 100,
    });

    console.log(util.inspect(packages, false, null, true));

    if (this.flags?.filter !== '') {
      const filterRegex = new RegExp(this.flags.filter);
      packages = packages.filter((pkg) => filterRegex.test(pkg.name));
    }

    return packages;
  }

Before 11.4.2 this wasn't included:

Image

Type '{ id: number; name: string; url: string; package_html_url: string; html_url?: string | undefined; license?: string | undefined; description?: string | undefined; created_at: string; updated_at: string; deleted_at?: string | undefined; metadata?: { ...; } | undefined; }[]' is missing the following properties from type 'OctokitResponse<{ id: number; name: string; url: string; package_html_url: string; html_url?: string | undefined; license?: string | undefined; description?: string | undefined; created_at: string; updated_at: string; deleted_at?: string | undefined; metadata?: { ...; } | undefined; }[], 200>': headers, status, url, data

And looking at the actual data returned, I don't see any additional fields that aren't in the opanapi type.

[
  {
    id: 00000,
    name: '1.0.2-prettier-3-5-1.2',
    url: 'https://api.github.com/orgs/XXXX/packages/npm/playwright-testing/versions/00000',
    package_html_url: 'https://github.com/orgs/XXXX/packages/npm/package/playwright-testing',
    created_at: '2025-02-17T16:56:07Z',
    updated_at: '2025-02-17T16:56:07Z',
    html_url: 'https://github.com/orgs/XXXX/packages/npm/playwright-testing/00000',
    metadata: { package_type: 'npm' }
  },
  ...
]

Versions

Node v20.15.0
octokit 4.1.1
@octokit/plugin-paginate-rest 11.4.2
@octokit/types 13.7.0

Relevant log output

Code of Conduct

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugSomething isn't working as documentedreleased

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions