Skip to content

Use

export type Use = <T>(target: UsedAs<T>) -> T

A function which extracts a value of T from something that can be used as T.

The most generic implementation of this is the peek() function, which performs this extraction with no additional steps.

However, certain APIs may provide their own implementation, so they can perform additional processing for certain representations. Most notably, computeds provide their own use() function which adds inputs to a watchlist, which allows them to re-calculate as inputs change.


Parameters

target : UsedAs<T>

The representation of T to extract a value from.


Returns -> T

The current value of T, derived from target.


Learn More

Back to top