diff --git a/xmlrpc/index.d.ts b/xmlrpc/index.d.ts index b962be4324..8425d4672c 100644 --- a/xmlrpc/index.d.ts +++ b/xmlrpc/index.d.ts @@ -84,6 +84,13 @@ declare module 'xmlrpc' { decodeIso8601(time: string): Date; encodeIso8601(date: Date): string; } + + export class CustomType { + tagName: string; + raw: string; + constructor(raw: string); + serialize(xml: any): any; // XMLElementOrXMLNode declared by xmlbuilder + } } export = xmlrpc; diff --git a/xmlrpc/xmlrpc-tests.ts b/xmlrpc/xmlrpc-tests.ts index a7e8dcffbe..b9cdff2e3f 100644 --- a/xmlrpc/xmlrpc-tests.ts +++ b/xmlrpc/xmlrpc-tests.ts @@ -23,4 +23,14 @@ const server = xmlrpc.createServer(serverOpts, () => { client.methodCall('hello', ['world'], (err, val) => { console.log(val); }); + + class Value extends xmlrpc.CustomType { + constructor(value: any) { + super(value); + this.tagName = 'Value'; + } + } + client.methodCall('hello', [new Value('custom_string_value')], (err, val) => { + console.log(val); + }); });