Skip to main content

EntityRelationPaths

EntityRelationPaths

This type allows type-safe access to entity relations using strings with dot notation. It works to 2 levels deep.

Example

type T1 = EntityRelationPaths<Product>;

In the above example, the type T1 will be a string union of all relations of the Product entity:

  • 'featuredAsset'
  • 'variants'
  • 'variants.options'
  • 'variants.featuredAsset'
  • etc.
Signature
type EntityRelationPaths<T extends VendureEntity> = | `customFields.${string}`
| PathsToStringProps1<T>
| Join<PathsToStringProps2<T>, '.'>
| TripleDotPath