mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 04:49:15 +08:00
Merge pull request #26613 from ZaneHannanAU/patch-2
Missing definition for `dns.resolveAny` and `dns.resolve(domain, 'ANY')` in `@types/node`
This commit is contained in:
29
types/node/index.d.ts
vendored
29
types/node/index.d.ts
vendored
@@ -25,6 +25,7 @@
|
||||
// Alexander T. <https://github.com/a-tarasyuk>
|
||||
// Lishude <https://github.com/islishude>
|
||||
// Andrew Makarov <https://github.com/r3nya>
|
||||
// Zane Hannan AU <https://github.com/ZaneHannanAU>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/** inspector module types */
|
||||
@@ -2560,11 +2561,19 @@ declare module "dns" {
|
||||
ttl: number;
|
||||
}
|
||||
|
||||
export interface AnyRecordWithTtl extends RecordWithTtl {
|
||||
type: "A" | "AAAA";
|
||||
}
|
||||
|
||||
export interface MxRecord {
|
||||
priority: number;
|
||||
exchange: string;
|
||||
}
|
||||
|
||||
export interface AnyMxRecord extends MxRecord {
|
||||
type: "MX";
|
||||
}
|
||||
|
||||
export interface NaptrRecord {
|
||||
flags: string;
|
||||
service: string;
|
||||
@@ -2574,6 +2583,10 @@ declare module "dns" {
|
||||
preference: number;
|
||||
}
|
||||
|
||||
export interface AnyNaptrRecord extends NaptrRecord {
|
||||
type: "NAPTR";
|
||||
}
|
||||
|
||||
export interface SoaRecord {
|
||||
nsname: string;
|
||||
hostmaster: string;
|
||||
@@ -2584,6 +2597,10 @@ declare module "dns" {
|
||||
minttl: number;
|
||||
}
|
||||
|
||||
export interface AnySoaRecord extends SoaRecord {
|
||||
type: "SOA";
|
||||
}
|
||||
|
||||
export interface SrvRecord {
|
||||
priority: number;
|
||||
weight: number;
|
||||
@@ -2591,9 +2608,19 @@ declare module "dns" {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface AnySrvRecord extends SrvRecord {
|
||||
type: "SRV";
|
||||
}
|
||||
|
||||
export interface AnyTxtRecord {
|
||||
type: "TXT";
|
||||
entries: string[];
|
||||
}
|
||||
|
||||
export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "ANY", callback: (err: NodeJS.ErrnoException, addresses: ReadonlyArray<AnySrvRecord | AnySoaRecord | AnyNaptrRecord | AnyRecordWithTtl | AnyMxRecord | AnyTxtRecord>) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void;
|
||||
@@ -2607,6 +2634,7 @@ declare module "dns" {
|
||||
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
||||
export namespace resolve {
|
||||
export function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise<string[]>;
|
||||
export function __promisify__(hostname: string, rrtype: "ANY"): Promise<ReadonlyArray<AnySrvRecord | AnySoaRecord | AnyNaptrRecord | AnyRecordWithTtl | AnyMxRecord | AnyTxtRecord>>;
|
||||
export function __promisify__(hostname: string, rrtype: "MX"): Promise<MxRecord[]>;
|
||||
export function __promisify__(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
|
||||
export function __promisify__(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
|
||||
@@ -2637,6 +2665,7 @@ declare module "dns" {
|
||||
export function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
||||
}
|
||||
|
||||
export function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: ReadonlyArray<AnySrvRecord | AnySoaRecord | AnyNaptrRecord | AnyRecordWithTtl | AnyMxRecord | AnyTxtRecord>) => void): void;
|
||||
export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void;
|
||||
export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void;
|
||||
|
||||
@@ -3142,6 +3142,9 @@ namespace dns_tests {
|
||||
dns.resolve("nodejs.org", "AAAA", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
dns.resolve("nodejs.org", "ANY", (err, addresses) => {
|
||||
const _addresses: ReadonlyArray<dns.AnySrvRecord | dns.AnySoaRecord | dns.AnyNaptrRecord | dns.AnyRecordWithTtl | dns.AnyMxRecord | dns.AnyTxtRecord> = addresses;
|
||||
});
|
||||
dns.resolve("nodejs.org", "MX", (err, addresses) => {
|
||||
const _addresses: dns.MxRecord[] = addresses;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user