Utility Types

Utility types provided by Signality for working with signals, elements, and reactive values.

SignalValue<Type>

Extracts the value type from a Signal.

typescript
type SignalValue<S> = S extends Signal<infer V> ? V : never;

MaybeSignal<Type>

Union type that accepts either a static value or a reactive Signal.

typescript
type MaybeSignal<T> = T | Signal<T>;

MaybeElementSignal<Type>

Union type for element references that can be an element, ElementRef, or a Signal containing either of these (including null or undefined).

typescript
type MaybeElementSignal<T extends Element> =
  | T
  | ElementRef<T>
  | Signal<T | ElementRef<T> | null | undefined>;

Note: The signal variant includes null and undefined because elements may dynamically change in reactive scenarios, particularly with conditional rendering where elements can appear or disappear based on signal values.

UnrefElement<Type>

Extracts the element type from ElementRef or returns the type as-is.

typescript
type UnrefElement<T> = T extends ElementRef<infer E> ? E : T;
  • Key Concepts — Learn about Signal-First Design and common patterns
  • Debounced — Uses MaybeSignal for debounce timing
  • ElementSize — Uses MaybeElementSignal for target elements
Edit this page on GitHub Last updated: Mar 19, 2026, 23:28:23