mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
fix function signature for createserver (#45386)
This commit is contained in:
parent
ec066e7aa9
commit
461ecd94e3
4
types/xmlrpc/index.d.ts
vendored
4
types/xmlrpc/index.d.ts
vendored
@ -46,8 +46,8 @@ declare module 'xmlrpc' {
|
||||
function createClient(options: string | ClientOptions): Client;
|
||||
function createSecureClient(options: string | ClientOptions): Client;
|
||||
|
||||
function createServer(options: string | ServerOptions, callback: () => void): Server;
|
||||
function createSecureServer(options: string | TlsOptions, callback: () => void): Server;
|
||||
function createServer(options: string | ServerOptions, callback?: () => void): Server;
|
||||
function createSecureServer(options: string | TlsOptions, callback?: () => void): Server;
|
||||
|
||||
interface Client {
|
||||
options: ClientOptions;
|
||||
|
||||
@ -5,12 +5,14 @@ const serverOpts = {
|
||||
port: 9000
|
||||
};
|
||||
|
||||
const server = xmlrpc.createServer(serverOpts, () => {
|
||||
server.on('NotFound', method => {
|
||||
const serverWithOutCallback = xmlrpc.createServer(serverOpts);
|
||||
|
||||
const serverWithCallback = xmlrpc.createServer(serverOpts, () => {
|
||||
serverWithCallback.on('NotFound', method => {
|
||||
console.log(`Method ${method} not found`);
|
||||
})
|
||||
|
||||
server.on('hello', (err, params, cb) => {
|
||||
serverWithCallback.on('hello', (err, params, cb) => {
|
||||
cb(null, `Hello, ${params[0]}!`);
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user