Skip to content

Commit

Permalink
allow unspecified arguments, fixes slackapi#482
Browse files Browse the repository at this point in the history
  • Loading branch information
clavin committed Mar 11, 2018
1 parent 9e5d144 commit 24542ef
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ import { WebAPICallOptions, WebAPIResultCallback, WebAPICallResult } from './Web
*/
export default interface Method<MethodArguments extends WebAPICallOptions> {
// TODO: can we create a relationship between MethodArguments and a MethodResult type?
(options?: MethodArguments): Promise<WebAPICallResult>;
(options: MethodArguments, callback: WebAPIResultCallback): void;
(options?: MethodArguments & AuxiliaryArguments): Promise<WebAPICallResult>;
(options: MethodArguments & AuxiliaryArguments, callback: WebAPIResultCallback): void;
}

/*
* Reusable "protocols" that some MethodArguments types can conform to
*/

export interface AuxiliaryArguments {
[unknownArg: string]: any;
}

export interface TokenOverridable {
token?: string;
}
Expand Down

0 comments on commit 24542ef

Please sign in to comment.