Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad Typescript usage #62

Open
SrRapero720 opened this issue Jan 5, 2022 · 1 comment
Open

Bad Typescript usage #62

SrRapero720 opened this issue Jan 5, 2022 · 1 comment

Comments

@SrRapero720
Copy link

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:

node-dns/README.md

Lines 160 to 163 in b2e994c

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

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

Create a patch and make a pull request, I think that would be a big help for the developer :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants