Skip to main content
Module

x/tui/mod.ts>SignalOfObject

🦕 Deno module for creating Terminal User Interfaces
Go to Latest
type alias SignalOfObject
Re-export
import { type SignalOfObject } from "https://deno.land/x/tui@2.1.3/mod.ts";

Type that defines signal, which doesn't implement any properties that T type has. This is used to enhance DX for typing unions between objects and Signals.

Examples

Example 1

// Don't do that! Autocomplete shows properties of both `Dog` and `SignalDog`
type Dog = { notHuman: true };
type SuperDog = Dog | Signal<Dog>;

// Do this instead
type SuperDuperDog = Dog | SignalOfObject<Dog>;

It doesn't matter on primitive types though

Example 2

// These would be exactly the same from DX standpoint
type Foo = number | Signal<number>;
type Bar = number | SignalOfObject<number>;
definition: Signal<T> & [key in keyof T]?: never