Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(typescript): workaround for trouble with aggregate-error type exports (#245) #270

Merged
merged 6 commits into from
Sep 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19,458 changes: 19,403 additions & 55 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -77,6 +77,13 @@
"functions": 100,
"lines": 100
}
},
"globals": {
"ts-jest": {
"tsConfig": {
"esModuleInterop": true
}
}
}
},
"release": {
1 change: 1 addition & 0 deletions src/event-handler/receive.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-ignore to address #245
import AggregateError from "aggregate-error";

import { wrapErrorHandler } from "./wrap-error-handler";
1 change: 1 addition & 0 deletions src/middleware/get-payload.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-ignore to address #245
import AggregateError from "aggregate-error";

import { IncomingMessage } from "http";
1 change: 0 additions & 1 deletion src/middleware/middleware.ts
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@ import { debug } from "debug";
import { IncomingMessage, ServerResponse } from "http";
import { State, WebhookError, WebhookEventHandlerError } from "../types";
import { EventNames } from "../generated/event-names";
import AggregateError from "aggregate-error";

const debugWebhooks = debug("webhooks:receiver");

10 changes: 9 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type AggregateError from "aggregate-error";
import type { RequestError } from "@octokit/request-error";

import type { EventNames } from "./generated/event-names";
@@ -47,3 +46,12 @@ export interface WebhookEventHandlerError extends AggregateError<WebhookError> {
*/
errors: WebhookError[];
}

declare class AggregateError<T extends Error = Error>
Copy link
Member

@oscard0m oscard0m Sep 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though is a temporary fix, we should mention and give credit to the original repo? #248 (comment) @gr2m

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oopsies sorry I missed your comment. You are right. I'll send a follow up pR

extends Error
implements Iterable<T> {
readonly name: "AggregateError";
constructor(errors: ReadonlyArray<T | { [key: string]: any } | string>);

[Symbol.iterator](): IterableIterator<T>;
}
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"compilerOptions": {
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"strict": true,