Libraries v5.0.0
    Preparing search index...

    Type Alias EntityResult<TEntity>

    EntityResult: InferType<
        ReadVariantMetadata<EntitySchema<TEntity>> extends {
            discriminator: string;
            variants: Record<string, unknown>;
        }
            ? PolymorphicRowSchema<VariantReadSchemas<EntitySchema<TEntity>>>
            : ObjectReadSchema<
                EntitySchema<TEntity>,
                keyof ReadRelations<EntitySchema<TEntity>>,
            >,
    >

    The natural result row for a freshly initiated query against an entity.

    For ordinary entities this is InferType<EntitySchema<T>>. For polymorphic entities (declared via .withVariants()), this resolves to the discriminated union of all variant rows, so:

    const a = await db.activities.find(1);
    if (a?.type === 'assigned') {
    a.assigneeId; // narrowed
    }

    Type Parameters

    • TEntity extends Entity<any, any, any>