I use a library which in its declaration file index.d.ts has:
declare namespace browser.runtime
{
...
function sendMessage(message: any, options?: _SendMessageOptions): Promise<any>;
function sendMessage(extensionId: string, message: any, options?: _SendMessageOptions): Promise<any>;
...
}
There is any way to remove those declarations? To be more precisely I want to remove any from it.
I know that I can add overload, but that doesn't satisfy me:
declare namespace browser.runtime
{
function sendMessage(message: any, options?: _SendMessageOptions): Promise<unknown>;
}
You can create your own type declarations.
types.some-library.d.ts. In your case, you can copy the file from@types/some-libraryand make your changes.tsconfig.json. Add the following:@types/some-library.