Type Alias BelongsToField<T, FK>

BelongsToField: FK extends keyof T
    ? BelongsToTarget<T, FK> extends never
        ? never
        : undefined extends T[FK]
            ? Optional<BelongsToTarget<T, FK>>
            : BelongsToTarget<T, FK>
    : never

If the relationship is linked by a NullableForeignKey then it allows the field to be optional, otherwise it ensures that it is not optional

Type Parameters