How do you get type hinting for webext APIs in VSCode without using bundlers?

AFAIK, you can get type hinting for
WebExtension APIs by installing webextension-polyfill and @types/webextension-polyfill with npm and
import browser from "webextension-polyfill"; in js files.

Since you imported from a node module, you will also need to use a bundler to make the extension work in a browser environment.

Is there any other way to get type hinting, though? I don’t want to use a bundler just for type hinting. I don’t even need the polyfill for my homemade Firefox-only extension.

This is how it’s done in WebStorm (I’ve been using this long ago when I was still using JavaScript without bundler).
Maybe it will help you google it out for VSCode.

1 Like

Try @types/firefox-webext-browser

I don’t think you can do that in VSCode, but thank you anyway.

It worked! Thanks a lot.