-
Notifications
You must be signed in to change notification settings - Fork 33
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
Export Additional Functions #41
Conversation
A quick fix for the typings.
Maybe we should use export = whoiser;
declare function whoiser(query: any, options: any): any;
declare namespace whoiser {
function allTlds(): any;
function asn(query: any, { host = null, timeout = 15000, raw = false }: any): any;
function domain(domain: any, { host = null, timeout = 15000, follow = 2, raw = false }: any): any;
function firstResult(whoisResults: any): any;
function ip(query: any, { host = null, timeout = 15000, raw = false }: any): any;
function query({ host = null, port = 43, timeout = 15000, query = '', querySuffix = '\r\n' }: any): any;
function tld(query: any, { timeout = 15000, raw = false }: any): any;
} Or maybe this should be done like this? declare module 'whoiser' {
...
export default whoiser;
export {
tld,
allTlds,
ip,
query,
whoiser,
WhoisSearchResult,
Options,
OptionsGeneric,
OptionsIp,
OptionsDomain,
OptionsTld,
OptionsQuery,
OptionsAsn,
};
} |
I believe the inline exports are bit more intuitive than exporting at the end of the file and more preferable than using a namespace. In my project where I'm using whoiser, I override the typings using the ones proposed, so I'm sure there isn't any problem with them specifically. I'm okay with changing the pull request if the direction is clear, please let me know how to proceed. |
I'm not a ts programmer, so that was my mistake. Also it seems modules are better then namespace according to this document https://www.typescriptlang.org/docs/handbook/namespaces-and-modules.html. |
@JAD3N what have happened? I think this PR is 👍 and have to be merged into the upstream. @AndreiIgna can you merge this PR? You can do it locally if it's not possible with web. |
A quick fix for the typings.