2017-10-06 133 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 /節點