MaybeAccessor
A value or an accessor returning it.
A value or an accessor returning it. Use it for function parameters that should accept a plain value or a signal-like getter; the accessor is read where it is needed.
Import#
ts
import type { MaybeAccessor } from "@shadow-js/web";
Signature#
ts
type MaybeAccessor<T> = T | (() => T)
Examples#
ts
import type { MaybeAccessor } from "@shadow-js/web";
function label(text: MaybeAccessor<string>): string {
return typeof text === "function" ? text() : text;
}