Use string literal type for dgram.createServer (#16713)

Fixes #16712
This commit is contained in:
Matt Bierner
2017-06-02 07:58:56 -07:00
committed by Andy
parent 54c909470e
commit 1d18924b49

View File

@@ -2277,12 +2277,14 @@ declare module "dgram" {
exclusive?: boolean;
}
type SocketType = "udp4" | "udp6";
interface SocketOptions {
type: "udp4" | "udp6";
type: SocketType;
reuseAddr?: boolean;
}
export function createSocket(type: string, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
export function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
export function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
export interface Socket extends events.EventEmitter {