type-alias / @typed/template

Renderable.ErrorFromObject

Traverse all keys in an object and extract the error from each value. If the value is a function, extract the error from the return type of the function.

Package version
1.0.0-beta.7
Category
Renderable failures
Since
1.0.0
Member of
Renderable

Import

import { Renderable } from "@typed/template";

Access Renderable.ErrorFromObject through the imported Renderable export. Its declaration below describes the member.

Signatures

type ErrorFromObject<T> = [
    {
        [K in keyof T]-?: T[K] extends (...args: Array<any>) => any ? FunctionError<ReturnType<T[K]>> : Error<T[K]>;
    }[keyof T]
] extends [
    infer U
] ? U : never;

Why

Nested object renderables contribute failures to the enclosing template instead of hiding them behind runtime property access.

Ownership and lifetime

This compile-time traversal has no runtime lifetime.

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source