diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 016be4da20..bcb4db0bef 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -3953,8 +3953,18 @@ declare module "util" { export function puts(...param: any[]): void; export function print(...param: any[]): void; export function log(string: string): void; - export function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string; - export function inspect(object: any, options: InspectOptions): string; + export var inspect: { + (object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string; + (object: any, options: InspectOptions): string; + colors: { + [color: string]: [number, number] + } + styles: { + [style: string]: string + } + defaultOptions: InspectOptions; + custom: symbol; + } export function isArray(object: any): object is any[]; export function isRegExp(object: any): object is RegExp; export function isDate(object: any): object is Date; @@ -3973,7 +3983,10 @@ declare module "util" { export function isSymbol(object: any): object is symbol; export function isUndefined(object: any): object is undefined; export function deprecate(fn: Function, message: string): Function; - export function promisify(fn: Function): Function; + export var promisify: { + (fn: Function): Function; + custom: symbol + } } declare module "assert" { diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index 869bde66dd..a31f3e8899 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -556,6 +556,11 @@ namespace util_tests { maxArrayLength: null, breakLength: Infinity }) + assert(typeof util.inspect.custom === 'symbol') + // util.promisify + var readPromised = util.promisify(fs.readFile) + var sampleRead: Promise = readPromised(__filename).then((data: string): void => {}).catch((error: Error): void => {}) + assert(typeof util.promisify.custom === 'symbol') } }