Skip to content

Drizzle queries fail typecheck #918

Closed
@jansedlon

Description

@jansedlon

I'm using Drizzle ORM in my project and when i enabled the experimental Typescript Native VSCode extension (and also before that when i built the extension from main), i have many places where the typechecker fails.

Do you need a repro or do you know about these issues?

Examples:

Image

Image

Activity

jakebailey

jakebailey commented on May 23, 2025

@jakebailey
Member

A repro would be helpful.

jansedlon

jansedlon commented on May 23, 2025

@jansedlon
Author

@jakebailey Here's the repro. I'm seeing more issues for example in Prisma but i'll wait when this gets fixed and see if it still occurs

aadito123

aadito123 commented on May 27, 2025

@aadito123

I get the same error. Seems to be because user code import the type from .d.ts but drizzle is internally importing the types from d.cts. This is the error it spits out.

Type 'import("/home/a/Documents/tsgo-repro/node_modules/drizzle-orm/sql/sql").SQL<unknown>' is not assignable to type 'import("/home/a/Documents/tsgo-repro/node_modules/drizzle-orm/sql/sql").SQL<unknown>'. Two different types with this name exist, but they are unrelated.
          Types have separate declarations of a private property 'shouldInlineParams'.

Deleting the .d.cts removes this error but then the type checking fails because it cannot find the getSQL() defnintion.

Removing the where from the repro @jansedlon gave, removes all errors, even with the d.cts files there.

jansedlon

jansedlon commented on May 27, 2025

@jansedlon
Author

@aadito123 Can confirm. But in the db.insert example there's no where and it still fails. Might be the same issue, just different source

aadito123

aadito123 commented on May 27, 2025

@aadito123

@jansedlon ya I was just giving context to the error. I'm getting errors on just about every drizzle operation in my codebase

aadito123

aadito123 commented on Jun 4, 2025

@aadito123

seems to be fixed in the recent release

jansedlon

jansedlon commented on Jun 4, 2025

@jansedlon
Author

Yep, seems like it, closing, thank you TS team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jakebailey@jansedlon@aadito123

        Issue actions

          Drizzle queries fail typecheck · Issue #918 · microsoft/typescript-go