sequelize / umzug

Framework agnostic migration tool for Node.js
MIT License
1.98k stars 158 forks source link

Type 'ErrorWithCause' is not generic #674

Closed GarrettEHill closed 1 month ago

GarrettEHill commented 1 month ago

Bug Description

When upgrading Node.js from version 18.19.1 to 20.12.2, a TypeScript error is thrown when attempting to compile a project that uses umzug. The TypeScript error relates to the ErrorWithCause type in the umzug.d.ts file not being generic, which causes a build failure.

Steps to Reproduce

  1. Upgrade Node.js from version 18.19.1 to 20.12.2.
  2. Use umzug in a TypeScript project with the following relevant package versions:
    • typescript: version used (e.g., 4.5.4)
    • umzug: 3.8.0
  3. Run the TypeScript compiler (tsc).

Expected Behavior

The project should compile without TypeScript errors.

Actual Behavior

The TypeScript compiler throws the following error:

node_modules/umzug/lib/umzug.d.ts:9:45 - error TS2315: Type 'ErrorWithCause' is not generic.

9 export declare class MigrationError extends errorCause.ErrorWithCause<unknown> {
                                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Possible Solution

This issue might be related to specific TypeScript version compatibilities or changes in Node.js that affect how TypeScript handles types. A temporary workaround is to set "skipLibCheck": true in the tsconfig.json to ignore the library check.

Additional Information

Here are the relevant versions from the yarn list output:

yarn list v1.22.19
warning Resolution field "axe-core@4.6.3" is incompatible with requested version "axe-core@~4.9.0"
warning Resolution field "axe-core@4.6.3" is incompatible with requested version "axe-core@=4.7.0"
warning Filtering by arguments is deprecated. Please use the pattern option instead.
├─ sequelize-cli@6.6.2
│ └─ umzug@2.3.0
└─ umzug@3.8.0
Done in 1.22s.

Request

It would be helpful to have guidance on compatibility issues or any available fixes to address this type error with newer Node.js versions.

Thank you for looking into this.

GarrettEHill commented 1 month ago

I just needed to update typescript, not an issue