Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use boolean and number types if it has Generated<Boolean> #224

Open
noudadrichem opened this issue Dec 13, 2024 · 0 comments
Open

Comments

@noudadrichem
Copy link

noudadrichem commented Dec 13, 2024

Tbh; I'm not sure if this is a bug or not. But I'm seeing these errors through my codebase. The type is correct as its a boolean or number in the DB and the Generated<> is correct as well.

image image

But when passing a Boolean or Number it keeps erroring out.

How do I properly use these types?

For context. I'm calling .find() like so:

async function find(criteria: Partial<ActionDeployment>) {
    let query = this.db.selectFrom(this.tableName);

    if (criteria.id) {
        query = query.where("id", "=", Number(criteria.id));
    }
}

with the generated types:

export type Generated<T> = T extends ColumnType<infer S, infer I, infer U>
  ? ColumnType<S, I | undefined, U>
  : ColumnType<T, T | undefined, T>;

export type Json = JsonValue;

export type JsonArray = JsonValue[];

export type JsonObject = {
  [x: string]: JsonValue | undefined;
};

export type JsonPrimitive = boolean | number | string | null;

export type JsonValue = JsonArray | JsonObject | JsonPrimitive;

export type Numeric = ColumnType<string, number | string, number | string>;

export type Timestamp = ColumnType<Date, Date | string, Date | string>;

export interface ActionDeployment {
  id: Generated<number>;
  isPublic: Generated<boolean>;
}

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant