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

Setting strict true in tsconfig.json results in TS error #66

Closed
nooblyf opened this issue Feb 29, 2024 · 8 comments
Closed

Setting strict true in tsconfig.json results in TS error #66

nooblyf opened this issue Feb 29, 2024 · 8 comments

Comments

@nooblyf
Copy link

nooblyf commented Feb 29, 2024

Steps to reproduce

Set strict in tsconfig to true

Connect

import { neon } from "@neondatabase/serverless";
import { drizzle } from "drizzle-orm/neon-http";

import { DATABASE_URL } from "$env/static/private";

const sql = neon(DATABASE_URL);
export const DB = drizzle(sql);

Expected result

No TS error

Actual result

TS error:
Screenshot 2024-03-01 at 00 39 39

Environment

typescript v5.3.3
@sveltejs/kit v2.5.2
node v20.10.0
pnpm 8.11.0

Logs, links

Argument of type 'NeonQueryFunction<false, false>' is not assignable to parameter of type 'NeonQueryFunction<boolean, boolean>'.
  Types of property 'transaction' are incompatible.
    Type '<ArrayModeOverride extends boolean = false, FullResultsOverride extends boolean = false>(queriesOrFn: NeonQueryPromise<false, false, any>[] | ((sql: NeonQueryFunctionInTransaction<ArrayModeOverride, FullResultsOverride>) => NeonQueryInTransaction[]), opts?: HTTPTransactionOptions<...> | undefined) => Promise<...>' is not assignable to type '<ArrayModeOverride extends boolean = boolean, FullResultsOverride extends boolean = boolean>(queriesOrFn: NeonQueryPromise<boolean, boolean, any>[] | ((sql: NeonQueryFunctionInTransaction<ArrayModeOverride, FullResultsOverride>) => NeonQueryInTransaction[]), opts?: HTTPTransactionOptions<...> | undefined) => Promise...'.
      Types of parameters 'queriesOrFn' and 'queriesOrFn' are incompatible.
        Type '((sql: NeonQueryFunctionInTransaction<any, any>) => NeonQueryInTransaction[]) | NeonQueryPromise<boolean, boolean, any>[]' is not assignable to type '((sql: NeonQueryFunctionInTransaction<any, any>) => NeonQueryInTransaction[]) | NeonQueryPromise<false, false, any>[]'.
          Type 'NeonQueryPromise<boolean, boolean, any>[]' is not assignable to type '((sql: NeonQueryFunctionInTransaction<any, any>) => NeonQueryInTransaction[]) | NeonQueryPromise<false, false, any>[]'.
            Type 'NeonQueryPromise<boolean, boolean, any>[]' is not assignable to type 'NeonQueryPromise<false, false, any>[]'.
              Type 'NeonQueryPromise<boolean, boolean, any>' is not assignable to type 'NeonQueryPromise<false, false, any>'.
                Type 'boolean' is not assignable to type 'false'.ts(2345)
@jawj
Copy link
Collaborator

jawj commented Mar 1, 2024

Thanks for letting us know. We (and drizzle) are investigating.

@ricaringa
Copy link

@jawj any news on this? I just got started with drizzle and got stuck with this.

@araf821
Copy link

araf821 commented Mar 8, 2024

Downgrading to "drizzle-orm": "^0.28.6" solved the issue for me.

@jawj
Copy link
Collaborator

jawj commented Mar 8, 2024

Sorry for the delay. The drizzle guys say they hope to fix it this weekend.

@bricesuazo
Copy link

Adding NeonQueryFunction<boolean, boolean> to sql seems to fix the typescript error.

import { neon } from "@neondatabase/serverless";
import type { NeonQueryFunction } from "@neondatabase/serverless";
import { drizzle } from "drizzle-orm/neon-http";

const sql: NeonQueryFunction<boolean, boolean> = neon(DATABASE_URL);

export const DB = drizzle(sql);

@jawj
Copy link
Collaborator

jawj commented Mar 19, 2024

I'm told that drizzle 0.30.3 fixes this problem. I'll close this issue if someone can confirm.

Sorry again that this has taken a while.

@bricesuazo
Copy link

I can confirm this is fixed in "drizzle-orm": "0.30.3"

@jawj
Copy link
Collaborator

jawj commented Mar 19, 2024

Many thanks.

@jawj jawj closed this as completed Mar 19, 2024
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

5 participants