kysely-org / kysely

A type-safe typescript SQL query builder
https://kysely.dev
MIT License
10.46k stars 268 forks source link

Tedious v18 includes different TypeScript annotations #971

Closed Eldjotnar closed 3 months ago

Eldjotnar commented 5 months ago

Installing the latest version of tedious (18.2.0) will result in a typescript error when creating a new MssqlDialect.

Type 'Connection' is not assignable to type 'TediousConnection | Promise<TediousConnection>'.
  Type 'Connection' is not assignable to type 'TediousConnection'.
    Types of property 'beginTransaction' are incompatible.
      Type '(callback: BeginTransactionCallback, name?: string | undefined, isolationLevel?: number | undefined) => void' is not assignable to type '(callback: (error?: Error | undefined) => void, transactionId?: string | undefined, isolationLevel?: number | undefined) => void'.
        Types of parameters 'callback' and 'callback' are incompatible.
          Types of parameters 'error' and 'err' are incompatible.
            Type 'Error | null | undefined' is not assignable to type 'Error | undefined'.
              Type 'null' is not assignable to type 'Error | undefined'.

If the proposed solution is just to add | null to the definition in mssql-dialect-config.d.ts, I'm happy to open a PR.

igalklebanov commented 5 months ago

Hey 👋

PRs welcome. You'd also need to bump tedious dev dependency to latest.

mjbergman92 commented 4 months ago

I ran into this while trying to get started

Necrelox commented 4 months ago

@mjbergman92 same 😭 in the meantime I have to downgrade to tedious 16.4.0.

mjbergman92 commented 4 months ago

@Necrelox I reverted back to tedious@17 and I've had no issues so far.

Necrelox commented 4 months ago

@mjbergman92 I apologize for the late response. Thank you for your feedback!

zivni commented 3 months ago

Also getting the following when using the example in the getting started guide:

Types of property 'ISOLATION_LEVEL' are incompatible.
    Type '{ [key: string]: number; }' is missing the following properties from type 'TediousIsolationLevel': NO_CHANGE, READ_UNCOMMITTED, READ_COMMITTED, REPEATABLE_READ, and 2 more.