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

Typing issue with typescript version 4.8.2 #3435

Closed
lewispham opened this issue Aug 31, 2022 · 1 comment
Closed

Typing issue with typescript version 4.8.2 #3435

lewispham opened this issue Aug 31, 2022 · 1 comment

Comments

@lewispham
Copy link

Describe the bug
This issue is happening quite often when I tried to upgrade typescript. This time, it's upgrading typescript from version 4.7.4 to 4.8.2

Stack trace

src/Orm.ts(14,27): error TS2344: Type 'MariaDbDriver' does not satisfy the constraint 'IDatabaseDriver<Connection>'.
  The types returned by 'connect()' are incompatible between these types.
    Type 'Promise<MariaDbConnection>' is not assignable to type 'Promise<Connection>'.
      Type 'MariaDbConnection' is not assignable to type 'Connection'.
        The types of 'platform.getSchemaGenerator' are incompatible between these types.
          Type '(driver: IDatabaseDriver<Connection>, em?: SqlEntityManager<AbstractSqlDriver<AbstractSqlConnection>> | undefined) => SchemaGenerator' is not assignable to type '(driver: IDatabaseDriver<Connection>, em?: EntityManager<IDatabaseDriver<Connection>> | undefined) => ISchemaGenerator'.
            Types of parameters 'em' and 'em' are incompatible.
              Type 'EntityManager<IDatabaseDriver<Connection>> | undefined' is not assignable to type 'SqlEntityManager<AbstractSqlDriver<AbstractSqlConnection>> | undefined'.
                Type 'EntityManager<IDatabaseDriver<Connection>>' is missing the following properties from type 'SqlEntityManager<AbstractSqlDriver<AbstractSqlConnection>>': createQueryBuilder, qb, raw, getKnex, execute
src/components/libraries/orm/Orm.ts(15,42): error TS2344: Type 'MariaDbDriver' does not satisfy the constraint 'IDatabaseDriver<Connection>'.
src/components/libraries/orm/Orm.ts(28,40): error TS2344: Type 'MariaDbDriver' does not satisfy the constraint 'IDatabaseDriver<Connection>'.
  Types of property 'connect' are incompatible.
    Type '() => Promise<MariaDbConnection>' is not assignable to type '() => Promise<Connection>'.
src/components/libraries/orm/Orm.ts(36,29): error TS2344: Type 'MariaDbDriver' does not satisfy the constraint 'IDatabaseDriver<Connection>'.

To Reproduce
Steps to reproduce the behavior:

  1. Install @mikro-orm/core @mikro-orm/migrations @mikro-orm/mariadb
  2. Install typescript
  3. Initialize the database connection

Expected behavior
No error occurs

Additional context
This error is gone when I downgrade typescript to version 4.7.4

Versions

Dependency Version
node 18.8.0
typescript 4.8.2
mikro-orm 5.3.1
your-driver mariadb
@B4nan
Copy link
Member

B4nan commented Aug 31, 2022

Already reported (#3417) and already fixed (#3389), we need to wait for knex to release new version as that it broken as well.

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

2 participants