[typescript typings] defined overloads for `Application.on`
See original GitHub issueFor 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:
- Created 5 years ago
- Reactions:2
- Comments:9 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think this will help, I’d recommend to subscribe to updates of this PR: https://github.com/octokit/webhooks.js/pull/53
Currently Application.on is not using
@octokit/webhooks
, it’s a little complicated. We are working on that