Skip to content

[BUG]: drizzle() cannot import relations #5693

@YanAnghelp

Description

@YanAnghelp

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?

1.0.0-beta.22

What version of drizzle-kit are you using?

1.0.0-beta.22

Other packages

No response

Describe the Bug

My code:

const client = postgres(process.env.DATABASE_URL);
const db = globalForDB.db ?? drizzle(client, { relations });

TS2345: Argument of type

[Sql<{}>, {
  relations: ExtractTablesWithRelations<{
    sers: {
      authTokens: any;
      contentsAuthor: Many<"contents">;
    };
    userAuthTokens: {
      belongUser: any;
    };
    contents: {
      belongAuthor: any;
    };
  }, ExtractTablesFromSchema<{
    userStatus: PgEnum<...>;
    ... 7 more ...;
    contents: PgTableWithColumns<...>;
  }>>;
}]

is not assignable to parameter of type

[string] | [string, DrizzleConfig<Record<string, never>, TablesRelationalConfig>] | [DrizzleConfig<Record<string, never>, TablesRelationalConfig> & ({ ...; } | { ...; })]

I try:

drizzle({ client, relations })

It's still the same error.

According to the prompt from the IDE, the type of relations is TRelationConfigs. But the type of defineRelations() is ExtractTablesWithRelations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions