@@ -14,6 +14,7 @@ const {
1414 validateTimeout,
1515 validateTries,
1616 emitInvalidHostnameWarning,
17+ emitTypeCoercionDeprecationWarning,
1718 getDefaultVerbatim,
1819} = require ( 'internal/dns/utils' ) ;
1920const { codes, dnsException } = require ( 'internal/errors' ) ;
@@ -110,15 +111,29 @@ function lookup(hostname, options) {
110111 if ( hostname && typeof hostname !== 'string' ) {
111112 throw new ERR_INVALID_ARG_TYPE ( 'hostname' , 'string' , hostname ) ;
112113 } else if ( options !== null && typeof options === 'object' ) {
114+ if ( options . hints != null && typeof options . hints !== 'number' ) {
115+ emitTypeCoercionDeprecationWarning ( ) ;
116+ }
113117 hints = options . hints >>> 0 ;
118+ if ( options . family != null && typeof options . family !== 'number' ) {
119+ emitTypeCoercionDeprecationWarning ( ) ;
120+ }
114121 family = options . family >>> 0 ;
122+ if ( options . all != null && typeof options . all !== 'boolean' ) {
123+ emitTypeCoercionDeprecationWarning ( ) ;
124+ }
115125 all = options . all === true ;
116126 if ( typeof options . verbatim === 'boolean' ) {
117127 verbatim = options . verbatim === true ;
128+ } else if ( options . verbatim != null ) {
129+ emitTypeCoercionDeprecationWarning ( ) ;
118130 }
119131
120132 validateHints ( hints ) ;
121133 } else {
134+ if ( options != null && typeof options !== 'number' ) {
135+ emitTypeCoercionDeprecationWarning ( ) ;
136+ }
122137 family = options >>> 0 ;
123138 }
124139
0 commit comments