Skip to content

Commit b01b5af

Browse files
author
Kanchalai Tanglertsampan
committed
Add console into Node.d.ts
1 parent adb0f81 commit b01b5af

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

src/lib/node.d.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,39 @@ declare var Buffer: {
138138
compare(buf1: NodeJS.Buffer, buf2: NodeJS.Buffer): number;
139139
};
140140

141+
declare namespace console {
142+
export function assert(value: boolean, message?: string, ...optionalParams: any[]): void;
143+
export function dir(obj: any, ...optionalParams: any[]): void;
144+
export function error(data?: any, ...optionalParams: any[]): void;
145+
export function info(data?: any, ...optionalParams: any[]): void;
146+
export function log(data?: any, ...optionalParams: any[]): void;
147+
export function time(label: string): void;
148+
export function timeEnd(label: string): void;
149+
export function trace(message: any, ...optionalParams: any[]): void;
150+
export function warn(data?: any, ...optionalParams: any[]): void;
151+
export var Console: {
152+
new(stdout: NodeJS.WritableStream, stderr? :NodeJS.WritableStream): NodeJS.Console;
153+
}
154+
}
155+
141156
/************************************************
142157
* *
143158
* GLOBAL INTERFACES *
144159
* *
145160
************************************************/
146161
declare namespace NodeJS {
162+
export interface Console {
163+
assert(value: boolean, message?: string, ...optionalParams: any[]): void;
164+
dir(obj: any, ...optionalParams: any[]): void;
165+
error(data?: any, ...optionalParams: any[]): void;
166+
info(data?: any, ...optionalParams: any[]): void;
167+
log(data?: any, ...optionalParams: any[]): void;
168+
time(label: string): void;
169+
timeEnd(label: string): void;
170+
trace(message: any, ...optionalParams: any[]): void;
171+
warn(data?: any, ...optionalParams: any[]): void;
172+
}
173+
147174
export interface ErrnoException extends Error {
148175
errno?: number;
149176
code?: string;
@@ -441,6 +468,10 @@ declare module "buffer" {
441468
export { BuffType as Buffer, SlowBuffType as SlowBuffer };
442469
}
443470

471+
declare module "console" {
472+
export = console;
473+
}
474+
444475
declare module "querystring" {
445476
export interface StringifyOptions {
446477
encodeURIComponent?: Function;

0 commit comments

Comments
 (0)