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

[BUG]:After upgrading to 0.28.0 from 0.27.2, it is unable to infer the array type #992

Closed
yaziciahmet opened this issue Aug 7, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@yaziciahmet
Copy link

yaziciahmet commented Aug 7, 2023

What version of drizzle-orm are you using?

0.28.0

What version of drizzle-kit are you using?

0.19.12

Describe the Bug

Here is my schema definition:

const badgeTable = pgTable(
  "badge",
  {
    id: text("id").primaryKey(),
    issuerAddress: text("issuer_address").notNull(),
    title: text("title").notNull(),
    skills: text("skills").array().notNull(),
  },
);

And when I run the following query:

const rows = await this.db.select().from(badgeTable).where(eq(badgeTable.id, id));

The inferred type of rows is this:

const rows: {
    id: string;
    issuerAddress: string;
    title: string;
    skills: {
        name: never;
        enumValues: {
            0: never;
            concat: {};
            indexOf: {};
            lastIndexOf: {};
            slice: {};
            length: never;
            includes: {};
            at: {};
            toString: {};
            toLocaleString: {};
            ... 23 more ...;
            flat: {};
        };
        ... 14 more ...;
        getSQL: {};
    };
}[]

And the weird thing is, when I use InferModel as following:

type Badge = InferModel<typeof badgeTable, "select">;

The inferred Badge type actually has skills: string[]

Expected behavior

I expect skills column to be inferred as string[]

Environment & setup

Operating System: Ubuntu 22.04
Turborepo: 1.10.12
Node: 19.8.1
Package Manager: pnpm 8.5.1

@yaziciahmet yaziciahmet added the bug Something isn't working label Aug 7, 2023
@AndriiSherman
Copy link
Member

May be related to #983

cc @dankochetov

dankochetov added a commit that referenced this issue Aug 7, 2023
minjie0501 pushed a commit to minjie0501/drizzle-orm that referenced this issue Aug 26, 2023
prometixX pushed a commit to prometixX/drizzle-orm-mssql that referenced this issue Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants