Skip to content
Draft
Show file tree
Hide file tree
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
10 changes: 9 additions & 1 deletion test/typescript-validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,18 +173,26 @@
console.log(event.foo);
});

webhooks.onAny((event) => {
// Make sure that `TTransformed` is properly passed to `onAny`
// foo is set by options.transform
console.log(event.foo);

Check failure on line 179 in test/typescript-validate.ts

View workflow job for this annotation

GitHub Actions / validate-typescript

Property 'foo' does not exist on type 'EmitterWebhookEvent'.
});

// @ts-expect-error TS2345:
// Argument of type '"does_not_exist"' is not assignable to parameter of type ...
webhooks.on("does_not_exist", (what) => {
// this works because we pass a transform that adds foo to all events
console.log(what.foo);

Check failure on line 186 in test/typescript-validate.ts

View workflow job for this annotation

GitHub Actions / validate-typescript

Expression produces a union type that is too complex to represent.
});

webhooks.onError((error) => {
console.log(error.event.name);
// Make sure that `TTransformed` is properly passed to `onError`
console.log(error.event.foo);

Check failure on line 192 in test/typescript-validate.ts

View workflow job for this annotation

GitHub Actions / validate-typescript

Property 'foo' does not exist on type 'BaseWebhookEvent<"push"> | BaseWebhookEvent<"release"> | BaseWebhookEvent<"public"> | BaseWebhookEvent<"label"> | ... 318 more ... | (BaseWebhookEvent<...> & { ...; })'.
const [firstError] = Array.from(error.errors);
console.log(firstError.status);
console.log(firstError?.request.headers);
console.log(firstError?.request?.headers);
console.log(firstError.request);
});

Expand Down
6 changes: 0 additions & 6 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
{
"extends": "./node_modules/@octokit/tsconfig/tsconfig.json",
"include": ["src/**/*"],
"ts-node": {
"compilerOptions": {
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": false
}
},
"compilerOptions": {
"allowImportingTsExtensions": true,
"erasableSyntaxOnly": true,
Expand Down
Loading