app.js icon indicating copy to clipboard operation
app.js copied to clipboard

[BUG]: app.eachInstallation Type Doesn't include Account Details

Open codingdiaz opened this issue 1 year ago • 4 comments

What happened?

When upgrading from v13.1.1 to v13.1.3 we have seen issues using data with app.eachInstallation.

This is an example of our code that breaks when upgrading to anything past v13.1.1.

import { App } from "@octokit/app";
import * as fs from "fs";

const privateKey = fs.readFileSync("./key.pem", { encoding: "utf8" });

const app = new App({
  appId: "123456",
  privateKey,
});

async function run() {

  for await (const { octokit, installation } of app.eachInstallation.iterator()) {
    console.log(installation.account?.login);
   }

}

run();

On v13.1.1 it works, but, on v13.1.2 and beyond, we get this type error.

script.ts:14:39 - error TS2339: Property 'login' does not exist on type '{ name?: string | null | undefined; email?: string | null | undefined; login: string; id: number; node_id: string; avatar_url: string; gravatar_id: string | null; url: string; html_url: string; ... 11 more ...; starred_at?: string | undefined; } | { ...; }'.
  Property 'login' does not exist on type '{ description?: string | null | undefined; html_url: string; website_url?: string | null | undefined; id: number; node_id: string; name: string; slug: string; created_at: string | null; updated_at: string | null; avatar_url: string; }'.

14     console.log(installation.account?.login);

Versions

Node: v18.14.0

Relevant log output

No response

Code of Conduct

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

codingdiaz avatar Sep 15 '23 19:09 codingdiaz