'InversifyJS TypeScript + NodeJS Interfaces Provider issue

In our project we are upgrading inversify npm modules 2.0.0.rc.1 into the latest version (6.0.1)

I'm facing below issue after upgrading to latest version 6.0.1.

error TS2339: Property 'then' does exist on type Promise<Monog.Db> | ((..args: any[]) => Promise<Mongo.Db>)

I noticed in new version of Inversify Provider type declared like

export type Provider<T> = (...args: any[]) => (((...args: any[]) => Promise<T>) | Promise<T>);

https://github.com/inversify/InversifyJS/blob/master/src/interfaces/interfaces.ts#L93

but in old version type declared following way

export interface Provider<T> extends Function {
    (): Promise<T>;
}

https://github.com/inversify/InversifyJS/blob/2.0.0-rc.1/src/interfaces/interfaces.ts#L33

Can someone explain what's the issue here also explain (...args: any[]) => (((...args: any[]) => Promise<T>) | Promise<T>) this too

Node Version: 16

Typescript version: 4.4.4

Thanks in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source