Skip to content

Commit

Permalink
🤮 use gross typing hack
Browse files Browse the repository at this point in the history
* The builds suddenly started failing and I do not wish to commit the package-lock file for... reasons
  • Loading branch information
JoshuaTheMiller committed Apr 27, 2023
1 parent d6862ed commit 01d7072
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/services/gitHub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,15 @@ async function GetOrgClient(installationId: number): Promise<InstalledClient> {

const orgName = await installedOctokit.rest.apps.getInstallation({ installation_id: installationId });

if (!orgName.data.account?.login) {
// HACK: gross typing nonsense
if (!(orgName?.data?.account as any).login) {
// TODO: throw custom wrapped error...
throw new Error("Login cannot be null for orgs")
}

// TODO: wrap in caching decorator
return new InstalledGitHubClient(installedOctokit, orgName.data.account?.login);
// HACK: gross typing nonsense
return new InstalledGitHubClient(installedOctokit, (orgName?.data?.account as any)?.login);
}

function authenticatedClient() {
Expand All @@ -95,9 +97,11 @@ async function GetInstallations(client: Octokit): Promise<Org[]> {
// TODO: this function is doing too much, it is not
// just a simple facade anymore...
const mappedOrgs = installationList.map(i => {
const account = i.account as any; // HACK: gross typing nonsense

return {
id: i.id,
orgName: i.account?.login ?? "",
orgName: account.login ?? "",
suspendedAt: i.suspended_at,
suspendedBy: i.suspended_by?.login
}
Expand Down

0 comments on commit 01d7072

Please sign in to comment.