-
Notifications
You must be signed in to change notification settings - Fork 31
Description
I'm saying 'might' because I'm a typescript n00b.
But from what I understand, the callback of the native dns.lookup, which is supposed to be what this library's types seem to be based on, always has a callback signature of (err, address, family).
Therefore, when you util.promisify it, the result will always be the address (the string).
However, that is not the case for this library's lookup (https://github.com/szmarczak/cacheable-lookup/blob/master/index.d.ts#L109), causing inconsistencies in callback handling.
Furthermore, because of the inconsistencies in the callback signatures in this library, when I util.promisify the dnsCache.lookup, it thinks the "promisified lookup async" can return a void.
Now, you may think "well, why not just use lookupAsync directly anyway?", and that would be an excellent choice if I were directly consuming CacheableLookup; however, as a got plugin author, I have to deal with the fact that got's dnsLookup option is typed as CacheableLookup['lookup'], which, as we've learned, may be incorrect.
So the hope is that the wrong types are fixed at the root of the problem (and hopefully it'll "bubble up" to got).
Thank you.