diff options
| author | 2022-12-05 11:36:28 -0800 | |
|---|---|---|
| committer | 2022-12-05 11:36:28 -0800 | |
| commit | 61bf957b995a28e5aa68a2e592e49d512c96f8ee (patch) | |
| tree | 58211ff7b393d165da90e935c90105826638cb85 | |
| parent | 2cbac4bbdd8c34f8bb49cd5dbc8bb773bc63d002 (diff) | |
| download | bun-61bf957b995a28e5aa68a2e592e49d512c96f8ee.tar.gz bun-61bf957b995a28e5aa68a2e592e49d512c96f8ee.tar.zst bun-61bf957b995a28e5aa68a2e592e49d512c96f8ee.zip | |
Introduce `console.write(text, or, arrayBufferLike)`
Diffstat (limited to '')
| -rw-r--r-- | packages/bun-types/globals.d.ts | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/packages/bun-types/globals.d.ts b/packages/bun-types/globals.d.ts index 0c7ff0ab1..be58b8e02 100644 --- a/packages/bun-types/globals.d.ts +++ b/packages/bun-types/globals.d.ts @@ -64,9 +64,51 @@ type Signals = | "SIGLOST" | "SIGINFO"; +interface ArrayConstructor { + fromAsync( + asyncItems: AsyncIterable | Iterable | ArrayLike, + mapfn?: (value: any, index: number) => any, + thisArg?: any, + ): Array; +} + interface console { - assert(condition?: boolean, ...data: any[]): void; + /** + * Asynchronously read lines from standard input (fd 0) + * + * ```ts + * for await (const line of console) { + * console.log(line); + * } + * ``` + */ + [Symbol.asyncIterator](): AsyncIterableIterator<string>; + + /** + * Write text or bytes to stdout + * + * Unlike {@link console.log}, this does no formatting and doesn't add a + * newline or spaces between arguments. You can pass it strings or bytes or + * any combination of the two. + * + * ```ts + * console.write("hello world!", "\n"); // "hello world\n" + * ``` + * + * @param data - The data to write + * @returns The number of bytes written + * + * This function is not available in the browser. + */ + write(...data: Array<string | ArrayBufferView | ArrayBuffer>): number; + + /** + * Clear the console + */ clear(): void; + + assert(condition?: boolean, ...data: any[]): void; + /** * Increment a [count](https://www.youtube.com/watch?v=2AoxCkySv34&t=22s) * @param label label counter |
