Skip to content

Commit d33127d

Browse files
authored
chore: update to stabilized Deno.consoleSize() API (#2813)
1 parent f2c97ea commit d33127d

File tree

3 files changed

+6
-22
lines changed

3 files changed

+6
-22
lines changed

node/_process/streams.mjs

+3-13
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,13 @@ function createWritableStdioStream(writer, name) {
4141
enumerable: true,
4242
configurable: true,
4343
get: () =>
44-
Deno.isatty?.(writer?.rid)
45-
// TODO(bartlomieju):
46-
// @ts-ignore Deno.consoleSize is getting stabilized and its signature changes
47-
? Deno.consoleSize?.(writer?.rid).columns
48-
: undefined,
44+
Deno.isatty?.(writer?.rid) ? Deno.consoleSize?.().columns : undefined,
4945
},
5046
rows: {
5147
enumerable: true,
5248
configurable: true,
5349
get: () =>
54-
Deno.isatty?.(writer?.rid)
55-
// TODO(bartlomieju):
56-
// @ts-ignore Deno.consoleSize is getting stabilized and its signature changes
57-
? Deno.consoleSize?.(writer?.rid).rows
58-
: undefined,
50+
Deno.isatty?.(writer?.rid) ? Deno.consoleSize?.().rows : undefined,
5951
},
6052
isTTY: {
6153
enumerable: true,
@@ -67,9 +59,7 @@ function createWritableStdioStream(writer, name) {
6759
configurable: true,
6860
value: () =>
6961
Deno.isatty?.(writer?.rid)
70-
// TODO(bartlomieju):
71-
// @ts-ignore Deno.consoleSize is getting stabilized and its signature changes
72-
? Object.values(Deno.consoleSize?.(writer?.rid))
62+
? Object.values(Deno.consoleSize?.())
7363
: undefined,
7464
},
7565
});

node/assertion_error.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ import { stripColor as removeColors } from "../fmt/colors.ts";
2626

2727
function getConsoleWidth(): number {
2828
try {
29-
// TODO(bartlomieju):
30-
// @ts-ignore Deno.consoleSize is getting stabilized and its signature changes
31-
return Deno.consoleSize(Deno.stderr.rid).columns;
29+
return Deno.consoleSize().columns;
3230
} catch {
3331
return 80;
3432
}

node/process_test.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,7 @@ Deno.test({
330330
assertEquals(process.stdout.fd, Deno.stdout.rid);
331331
const isTTY = Deno.isatty(Deno.stdout.rid);
332332
assertEquals(process.stdout.isTTY, isTTY);
333-
// TODO(bartlomieju):
334-
// @ts-ignore Deno.consoleSize is getting stabilized and its signature changes
335-
const consoleSize = isTTY ? Deno.consoleSize(Deno.stdout.rid) : undefined;
333+
const consoleSize = isTTY ? Deno.consoleSize() : undefined;
336334
assertEquals(process.stdout.columns, consoleSize?.columns);
337335
assertEquals(process.stdout.rows, consoleSize?.rows);
338336
assertEquals(
@@ -360,9 +358,7 @@ Deno.test({
360358
assertEquals(process.stderr.fd, Deno.stderr.rid);
361359
const isTTY = Deno.isatty(Deno.stderr.rid);
362360
assertEquals(process.stderr.isTTY, isTTY);
363-
// TODO(bartlomieju):
364-
// @ts-ignore Deno.consoleSize is getting stabilized and its signature changes
365-
const consoleSize = isTTY ? Deno.consoleSize(Deno.stderr.rid) : undefined;
361+
const consoleSize = isTTY ? Deno.consoleSize() : undefined;
366362
assertEquals(process.stderr.columns, consoleSize?.columns);
367363
assertEquals(process.stderr.rows, consoleSize?.rows);
368364
assertEquals(

0 commit comments

Comments
 (0)