Skip to main content

clear (function)​

Prints special ANSI escape characters to stdout which instruct your terminal emulator to clear the screen and clear your terminal scrollback.

Identical to console.clear.

Example

declare function clear(): void;

Console (interface)​

interface Console {
log(message?: any, ...optionalParams: any[]): void;
info(message?: any, ...optionalParams: any[]): void;
warn(message?: any, ...optionalParams: any[]): void;
error(message?: any, ...optionalParams: any[]): void;
clear(): void;
}

Console.log (method)​

Logs its arguments to stdout, with a newline appended.

Any value can be logged, not just strings. Non-string values will be formatted using inspect.

Functionally identical to console.info, echo, and print. Contrast with console.error, which prints to stderr instead of stdout.

Example

console.log("hello", 42, { some: "object" });
log(message?: any, ...optionalParams: any[]): void;

Console.info (method)​

Logs its arguments to stdout, with a newline appended.

Any value can be logged, not just strings. Non-string values will be formatted using inspect.

Functionally identical to console.log, echo, and print. Contrast with console.error, which prints to stderr instead of stdout.

Example

console.info("Build finished in", 12, "seconds");
info(message?: any, ...optionalParams: any[]): void;

Console.warn (method)​

Logs its arguments to stderr, with a newline appended.

Any value can be logged, not just strings. Non-string values will be formatted using inspect.

Functionally identical to console.error. Contrast with console.log, which prints to stdout instead of stderr.

Example

console.warn("config.toml not found; using defaults");
warn(message?: any, ...optionalParams: any[]): void;

Console.error (method)​

Logs its arguments to stderr, with a newline appended.

Any value can be logged, not just strings. Non-string values will be formatted using inspect.

Functionally identical to console.warn. Contrast with console.log, which prints to stdout instead of stderr.

Example

console.error("Something went wrong:", new Error("oh no"));
error(message?: any, ...optionalParams: any[]): void;

Console.clear (method)​

Prints special ANSI escape characters to stdout which instruct your terminal emulator to clear the screen and clear your terminal scrollback.

Identical to clear.

Example

console.clear();
clear(): void;

console (Console)​

var console: Console;