Skip to content

Bad Typescript usage #62

@SrRapero720

Description

@SrRapero720

There is a rather annoying error in the types. and is that although they are declared these are not exported so every time they try to use in a modular system or to declare that a value has a specific typescript type throws an error that "X type is used but not accessible"

The exported variable 'DomainNameServer' has or uses the name 'DnsServer' of the module 'C:/Servers/npanel/node_modules/@types/dns2/index' external, but cannot be named.ts(4023)

SOLUTION: use a export before declare

export declare class DnsServer extends EventEmitter {
    addresses(): {
        udp?: net.AddressInfo;
        tcp?: net.AddressInfo;
        doh?: net.AddressInfo;
    };

    listen(ports: { udp?: number; tcp?: number; doh?: number }): Promise<void>;

    close(): Promise<void>;
}

ALSO: readme on DNS Server are outdated:
https://github.com/song940/node-dns/blob/b2e994c0a61ad58902486ed4e9055965cf0bcb5d/README.md?plain=1#L160-L163

server.listen({
  // Optionally specify port and/or address for each server:
  //DELETABLE: old
  //udp: { port: 5333 }
  
  //udp: 5333
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions