IsRelationship type
Detects if a type is a relationship (object with a primary key that's not a primitive wrapper).
type IsRelationship<T> = T extends Date | readonly unknown[]
? false
: [RelationshipKeyField<T>] extends [never]
? false
: true
Remarks
A relationship is detected as an object type that has an id or Id property,
but is not a Date or Array (which are object types but not relationships).