Skip to content

pg-typed and & or TypeScript error if WhereConditions have different shapes #326

@spiffytech

Description

@spiffytech

When using and and or, I get a TypeScript error if I supply different columns to the different WhereConditions.

      const link = await tables.links(db).findOne(
        or(
          { user_id: user.user_id, original_url: query.originalUrl },
          { user_id: user.user_id, url: query.url },
        ),
      );
Object literal may only specify known properties, and 'url' does not exist in type 
'WhereCondition<{ user_id: string & { readonly __brand?: "users_user_id" | undefined; }; original_url: string; }>'.ts(2353)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions