mozilla / webextension-polyfill

A lightweight polyfill library for Promise-based WebExtension APIs in Chrome
Mozilla Public License 2.0
2.75k stars 214 forks source link

Wrong Types: sendResponse #627

Closed ArthurLobopro closed 6 months ago

ArthurLobopro commented 6 months ago

I am migrating a chrome extension to webextension but this snippet of my code gives me a error saying 0 arguments are expected.

image

And the typing of sendResponse shows:

image

Please, can someone correct this type?

Rob--W commented 6 months ago

We (the maintainers of webextension-polyfill) are not responsible for this type definition. You should contact the source of your type and request a fix there.

ArthurLobopro commented 6 months ago

Ok

ba32107 commented 4 months ago

I have the same issue. I managed to track this down. It's already fixed in the source repo: https://github.com/Lusito/webextension-polyfill-ts/blob/2687ea2b007c7a99e0eb19f3790c688ed845f8c3/out/namespaces/runtime.d.ts#L586

However it's still the old version in the repo where the definitions are packaged: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/webextension-polyfill/namespaces/runtime.d.ts#L452

There is a PR open to merge the fix: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/69704

So we gotta wait for this to be merged. I tried augmenting the type locally but wasn't able to make it work, so just added // @ts-ignore for now