From b7d3dc48f5db229d546e58d213bcdb453970e6bd Mon Sep 17 00:00:00 2001 From: Oliver Wales Date: Sun, 29 Sep 2024 13:20:07 -0700 Subject: [PATCH] Add TS type declarations --- index.d.ts | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 index.d.ts diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..7faabeb --- /dev/null +++ b/index.d.ts @@ -0,0 +1,33 @@ +declare module "whois" { + interface WhoisOptions { + server?: string | { host: string; port: number }; + follow?: number; + timeout?: number; + verbose?: boolean; + bind?: string; + proxy?: { + ipaddress: string; + port: number; + type?: number; + }; + punycode?: boolean; + encoding?: string; + } + + interface WhoisResult { + server: string; + data: string; + } + + type WhoisCallback = ( + err: Error | null, + data: string | WhoisResult[] + ) => void; + + function lookup(addr: string, callback: WhoisCallback): void; + function lookup( + addr: string, + options: WhoisOptions, + callback: WhoisCallback + ): void; +}