dyna-record
    Preparing search index...

    Type Alias LibraryBrandToValue<T>

    LibraryBrandToValue: T extends undefined
        ? undefined
        : T extends NullableForeignKey
            ? string
            : T extends ForeignKey
                ? string
                : T extends Searchable
                    ? string
                    : T extends { __searchFilterable: infer U } ? LibraryBrandToValue<U> : T

    Resolves an attribute's declared type to the value a caller may pass for it, by stripping the brands dyna-record imposes on its own behalf.

    A consumer never asked for ForeignKey or Searchable — the library added them to track a relationship or an embedded field — so requiring a caller to satisfy them would be the library's leak to clean up. A consumer's own Brand, by contrast, exists precisely so that a plain value fails, and is therefore passed through untouched. The rule in one line: dyna-record strips its own brands, never yours.

    Branch order is load-bearing twice over:

    • undefined is tested first because NullableForeignKey includes undefined in its own definition. Unguarded, an optional attribute's undefined member matches that branch and widens the whole property to string.
    • The SearchFilterable payload is recovered after the brand branches, so a filterable that wraps a library brand (SearchFilterable<ForeignKey<T>>) strips through the outer branch while a plain SearchFilterable<string> still reduces to string rather than falling through to pass-through and keeping its brand.

    Distribution over unions is what lets the optional forms share the branches above instead of needing duplicates of their own.

    Type Parameters

    • T

      The attribute's declared type.