[BUG]: app.eachInstallation Type Doesn't include Account Details
codingdiaz opened this issue · 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
- I agree to follow this project's Code of Conduct
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labled with Status: Up for grabs
. You & others like you are the reason all of this works! So thank you & happy coding! 🚀
This seems like an issue from GitHub's side from their OpenAPI spec.
This seems like the same as octokit/openapi-types.ts#339
Can you upgrade to v13.1.8 as there has been some accidental breaking changes that were released in previous versions.
Is there a particular reason you aren't upgrading to v14?
@wolfy1339 ah, we figured it was something with the types. We run into this error on v13.1.8. We are trying to use v14 but we have the same issue. We currently put a workaround in to parse the data we need from an HTML URL instead using v14.