question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[typescript typings] defined overloads for `Application.on`

See original GitHub issue

For example:

on(eventName: 'push', callback: (context: PushContext) => Promise<void>): void;
on(eventName: 'issues.opened', callback: (context: IssueOpenedContext) => Promise<void>): void;
...
on(eventName: string | string[], callback: (context: Context) => Promise<void>): void;

It will improve the development experience with typescript.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
gr2mcommented, Jan 10, 2019

I think this will help, I’d recommend to subscribe to updates of this PR: https://github.com/octokit/webhooks.js/pull/53

0reactions
gr2mcommented, Jan 31, 2019

Currently Application.on is not using @octokit/webhooks, it’s a little complicated. We are working on that

Read more comments on GitHub >

github_iconTop Results From Across the Web

Define function overload types with TypeScript - Kent C. Dodds
So, here's how you'd type this kind of overloading: type asyncAddCb = (result: number) => void // define all valid function signatures function ......
Read more >
Add type declaration overloading · Issue #17636 - GitHub
All overloads must be directly adjacent so that they have order; The first matching signature is used to resolve the type ...
Read more >
Multiple interface definitions with Typescript function ... - ITNEXT
TypeScript provides the concept of function overloading. You can have multiple functions with the same name but different parameter types and ...
Read more >
Overloaded function type in typescript - Stack Overflow
You can solve this using a generic declaration: type Input = string | number function a<T extends Input>(input: T): T { return input...
Read more >
TypeScript — Generics and overloads - Charly Poly
While basic types like interfaces are useful to describe data and basic functions signatures, generics helps making types “open” and reusable.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found