Currently, I am attempting to include a constructor in an imported declaration. As per the information provided in the documentation, this should be feasible. (Refer to Chapter Adding using an interface
)
Below is the code snippet that I have used:
import { ObjectID } from 'mongodb';
interface ObjectID {
new(b: Buffer): ObjectID;
}
An error message that reads as follows is displayed:
The import declaration conflicts with the local declaration of 'ObjectID' at line 2 col 10.
To address this issue temporarily, I decided to change the name of the interface and utilized type assertion to any before finally switching to my desired interface. This solution suffices for now since it is only required in one specific location, but I am still curious as to why the initial method did not work as expected.