From ce405c074b4d53e3776e22c29bd470d0d95aa44a Mon Sep 17 00:00:00 2001 From: Josh Forisha Date: Mon, 13 Feb 2017 08:07:47 -0600 Subject: [PATCH] [soap] Apply @aleung's SoapMethod fix --- soap/index.d.ts | 6 +++++- soap/soap-tests.ts | 5 ++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/soap/index.d.ts b/soap/index.d.ts index c4d83e4b0f..151e914f63 100644 --- a/soap/index.d.ts +++ b/soap/index.d.ts @@ -10,6 +10,10 @@ import * as events from 'events'; interface Security { } +export interface SoapMethod { + (args: any, callback: (err: any, result: any) => void, options?: any, extraHeaders?: any): void; +} + export class WSSecurity implements Security { constructor(username: string, password: string, options?: any); } @@ -34,7 +38,7 @@ export interface Client extends events.EventEmitter { setEndpoint(endpoint: string): void; setSOAPAction(action: string): void; setSecurity(s: Security): void; - [method: string]: (args: any, callback: (err: any, result: any) => void, options?: any, extraHeaders?: any) => void; + [method: string]: SoapMethod | Function; } export interface Server extends events.EventEmitter { diff --git a/soap/soap-tests.ts b/soap/soap-tests.ts index df076402b3..9771b26efc 100644 --- a/soap/soap-tests.ts +++ b/soap/soap-tests.ts @@ -1,4 +1,3 @@ - import * as soap from 'soap'; import * as events from 'events'; import * as fs from "fs"; @@ -27,10 +26,10 @@ soap.createClient(url, wsdlOptions, function(err: any, client: soap.Client) { client.getHttpHeaders(); client.getSoapHeaders(); client.setSOAPAction('action'); - client['create']({ name: 'value' }, function(err: any, result: any) { + (client['create'] as soap.SoapMethod)({ name: 'value' }, function(err: any, result: any) { // result is an object }); - client['create']({ name: 'value' }, function(err: any, result: any) { + (client['create'] as soap.SoapMethod)({ name: 'value' }, function(err: any, result: any) { // result is an object }, {}); client.on('request', function(obj: any) {