dyna-record
    Preparing search index...

    Type Alias ForeignKeyToValue<T>

    ForeignKeyToValue: {
        [K in keyof T]: T[K] extends NullableForeignKey
            ? Optional<string>
            : T[K] extends ForeignKey
                ? string
                : T[K] extends Searchable
                    ? string
                    : T[K] extends Optional<Searchable>
                        ? Optional<string>
                        : T[K] extends { __searchFilterable: infer U }
                            ? U
                            : T[K] extends Optional<{ __searchFilterable: infer U }>
                                ? Optional<U>
                                : T[K]
    }

    Allow branded attributes (ForeignKey, Searchable) to be passed to the create/update methods by using their inferred primitive type Ex: If ModelA has: attr1: ForeignKey This allows" ModelA.create({ attr1: "someVal" }) Instead of: ModelA.create({ attr1: "someVal" as ForeignKey })

    Each brand needs both a plain and an optional/nullable branch — a single conditional fails against the optional form (EX: Searchable | undefined), the same reason ForeignKey needs the separate NullableForeignKey branch

    Type Parameters

    • T