From 8944f71961b51f9685c8b5698f5a0869150591e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20Sj=C3=B6green?= Date: Sun, 22 Sep 2024 17:02:25 +0200 Subject: [PATCH] fix: Slightly better stream type (#3) --- deno.json | 2 +- is_interactive.ts | 6 ++++-- mod.ts | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/deno.json b/deno.json index 03e662f..13dc1e1 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "name": "@denosaurs/tty", - "version": "0.2.0", + "version": "0.2.1", "exports": { ".": "./mod.ts" } diff --git a/is_interactive.ts b/is_interactive.ts index 0dc2f21..b20da5d 100644 --- a/is_interactive.ts +++ b/is_interactive.ts @@ -1,5 +1,5 @@ export async function isInteractiveAsync( - stream: { isTerminal(): boolean }, + stream: Pick, ): Promise { if (await Deno.permissions.query({ name: "env" })) { return ( @@ -11,6 +11,8 @@ export async function isInteractiveAsync( return stream.isTerminal(); } -export function isInteractive(stream: { isTerminal(): boolean }): boolean { +export function isInteractive( + stream: Pick, +): boolean { return stream.isTerminal(); } diff --git a/mod.ts b/mod.ts index 330afa3..32133ab 100644 --- a/mod.ts +++ b/mod.ts @@ -32,8 +32,8 @@ export const PREV_LINE = "1F"; export const COLUMN = "1G"; // left? export const HOME = "H"; -export type SyncStream = Pick; -export type AsyncStream = Pick; +export type SyncStream = Pick; +export type AsyncStream = Pick; export * from "./tty_async.ts"; export * from "./tty_sync.ts";