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]: bun-sql not inferring schema types correctly #4027

Open
1 task done
lkuoch opened this issue Jan 28, 2025 · 0 comments
Open
1 task done

[BUG]: bun-sql not inferring schema types correctly #4027

lkuoch opened this issue Jan 28, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@lkuoch
Copy link

lkuoch commented Jan 28, 2025

Report hasn't been filed before.

  • I have verified that the bug I'm about to report hasn't been filed before.

What version of drizzle-orm are you using?

0.39.0

What version of drizzle-kit are you using?

0.30.0

Other packages

No response

Describe the Bug

I'm upgrading from the node postgres package to bun's built in postgres sql and my typing is all broken

Before:

import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";

import { schema } from "./schema";

const client = postgres(import.meta.env.DB_URL as string);

export const DB = drizzle(client, {
  schema,
  logger: true,
});

// This typing is being inferred correctly
// eg: { Verification: RelationalQueryBuilder<ExtractTablesWithRelations<{ Verification: PgTableWithColumns<{ name: DBTableNames.Verification; schema: undefined; columns: { identifier: PgColumn<{ name: "identifier"; tableName: DBTableNames.Verification; dataType: "string"; columnType: "PgText"; ... 10 more ...; generated: undefined; }, {}, {}>; ... 4 more ...; id: PgColumn<...>; }; dialect: "pg"; }>; ... 15 more ...; AccessRelations: Relations<...>; }>, { ...; }>; ... 6 more ...; Access: RelationalQueryBuilder<...>; }
type Foo = typeof DB.query;

After:

import { drizzle } from "drizzle-orm/bun-sql";
import { schema } from "./schema";

export const DB = drizzle({
  connection: import.meta.env.DB_URL as string,
  schema,
  logger: true,
});

// This typing is inferred as `{}` which is not correct
type Foo = typeof DB.query
@lkuoch lkuoch added the bug Something isn't working label Jan 28, 2025
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

1 participant