Type Alias BelongsToField<T, K, FK>

BelongsToField: FK extends keyof T
    ? T[FK] extends NullableForeignKey ? Optional<K> : K
    : never

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

Type Parameters