Cloesce - v0.0.5-unstable.27
    Preparing search index...

    Type Alias IncludeTree<T>

    IncludeTree: (
        T extends Primitive
            ? never
            : {
                [K in keyof T]?: T[K] extends (infer U)[]
                    ? IncludeTree<NonNullable<U>>
                    : IncludeTree<NonNullable<T[K]>>
            }
    ) & { __brand?: "IncludeTree" }

    A recursive type describing which related models to include when querying a @D1 model.

    Type Parameters

    • T

      The model type for which to define the include tree.

      An IncludeTree<T> mirrors the shape of the model class, where each navigation property can be replaced with another IncludeTree describing nested joins.

      • Scalar properties (string, number, etc.) are included automatically.
      • Navigation properties (e.g. dogs: Dog[], owner: Person) may appear as keys with empty objects {} or nested trees.

      Example:

      D1
      export class Person {
      PrimaryKey id: number;
      OneToMany("personId") dogs: Dog[];

      DataSource
      static readonly default: IncludeTree<Person> = {
      dogs: {}, // join Dog table when querying Person
      };
      }