2017-10-06 138 views
0

node.d.ts其宣布为util.inspect.defaultOptions在打字稿

declare module "util" { 
    export function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string; 
    export function inspect(object: any, options: InspectOptions): string; 
} 

,所以我不能扩展它

我试图

declare module 'util' { 
    export interface inspect { 
    defaultOptions: InspectOptions; 
    } 
} 

但它一直示数 Property 'defaultOptions' does not exist on type '{ (object: any, showHidden?: boolean, depth?: number, color?: boolean): string; (object: any, opt...'.

回答

0

e。使用namespace xtend功能。

它已经固定在@ types /节点