@tempots/dom

Ensure() function

Represents a function that ensures a signal has a value before rendering a TNode.

Signature:

Ensure: (value: Valuenull> | Valueundefined> | Valuenull | undefined>, then: (value: Signal<NonNullable>) => TNode, otherwise?: () => TNode) => Renderable

Parameters

Parameter

Type

Description

value

Value | Value | Value

The signal or literal that may hold a value of type T or null or undefined.

then

(value: Signal>) => TNode

The function that returns a TNode when the signal has a value. It takes a signal of the non-nullable type of T.

otherwise

() => TNode

(Optional) The function that returns a TNode when the signal does not have a value.

Returns: Renderable

A renderable function that ensures the signal has a value before rendering a TNode.