What are the utility types?
The utility types are TypeScript aliases that the other API modules use in their signatures. They exist only at the type level, so none of them is a value you can call at runtime. They describe function shapes, predicate results, color strings, and open-ended string unions.@unbound-app/api declares them, using the definitions from @unbound-app/types.
Type reference
Where you’ll see them
storage.get returns Widen<T>, where T is the type of the default you pass. The default false would otherwise infer as the literal type false, so the result is widened to boolean to allow for the stored value.
MetroFilter and the predicates accepted by storage return PredicateResult. A filter doesn’t have to return a strict boolean. Returning the property you’re checking for is enough.
variant, border, and shadow, use LiteralUnion. Your editor suggests the known values ('primary', 'secondary', and so on), and a value Discord adds in a later build still type-checks.
The native module types loosely modeled native methods as Fn and PromiseFn when their exact arguments aren’t known.
Runtime helpers such as
lazy, debounce, and uuid are internal to the Unbound client and are not exposed to plugins.To defer a module lookup, pass { lazy: true } to a Metro search: the search runs the first time you access the result. To wait for a module that hasn’t loaded yet, use metro.findLazy(filter), which returns the module if it’s already present or a promise that resolves once it loads.