TypeScript Error with migrating Umzug to v3: 'umzug.on' not recognized

63 Views Asked by At

I'm working with the Umzug library for database migration in a TypeScript project and encountering an issue when trying to use the on method with an Umzug instance. Here's the relevant part of my code:

export async function connectUmzug(dbConfig) {
  return new Umzug({...});
}

Usage:

const umzug = await connectUmzug(config);
umzug.on('migrating', logUmzugEvent('migrating'));

I get the following error:

Property 'on' does not exist on type 'Umzug<any>'

In the type definition, it states:

class Umzug<Ctx extends object = object> extends emittery<UmzugEvents<Ctx>> 

Why is the on method not recognized in this context?

0

There are 0 best solutions below