Merge pull request #17559 from brianjleeofcl/master

[node] Add missing properties in util.promisify and util.inspect
This commit is contained in:
Paul van Brenk
2017-06-28 11:42:05 -07:00
committed by GitHub
2 changed files with 21 additions and 3 deletions
+16 -3
View File
@@ -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" {
+5
View File
@@ -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<any> = readPromised(__filename).then((data: string): void => {}).catch((error: Error): void => {})
assert(typeof util.promisify.custom === 'symbol')
}
}