diff --git a/types/cote/cote-tests.ts b/types/cote/cote-tests.ts index 8fd52a73a4..1851654625 100644 --- a/types/cote/cote-tests.ts +++ b/types/cote/cote-tests.ts @@ -80,10 +80,10 @@ class Readme { payload: { val: number }; } - randomResponder.on('randomRequest', (req: RandomRequest, callback: (answer: number) => void) => { + randomResponder.on('randomRequest', (req: RandomRequest, callback: (error: any, answer?: number) => void) => { const answer = Math.floor(Math.random() * 10); console.log('request', req.payload.val, 'answering with', answer); - callback(answer); + callback(null, answer); }); } diff --git a/types/cote/index.d.ts b/types/cote/index.d.ts index f6c60c54a2..4c959af76b 100644 --- a/types/cote/index.d.ts +++ b/types/cote/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for cote 0.14 +// Type definitions for cote 0.17 // Project: https://github.com/dashersw/cote#readme // Definitions by: makepost +// Labat Robin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import { EventEmitter2 } from "eventemitter2"; @@ -55,7 +56,7 @@ export class Requester extends Component { * @param event Request. * @param callback Function to execute after getting a result. */ - send(event: T, callback: (result: any) => void): void; + send(event: T, callback: (error: any, result: any) => void): void; } /** @@ -100,7 +101,7 @@ export class Responder extends Component { on( type: string | string[], listener: ( - ((event: T, callback: (result: any) => void) => void) | + ((event: T, callback: (error: any, result: any) => void) => void) | ((event: T) => Promise) ) ): this;