Cannot find name 'browser' - Typescript error

I’m writing an extension with typescript. When I need to reference browser I get the error Cannot find name 'browser', which is understandable, since I’ve never declared it.
Is there a way to get rid of the error?

Are you getting this error when running it in Firefox or inside your editor/IDE?

I’m getting the error during typescript compilation, so the extension actually works, but I was wondering if there was a better way to solve it than slapping a // @ts-ignore above it

I’m not very familiar with Typescript myself but could this project be useful: https://www.npmjs.com/package/@types/firefox-webext-browser?

YES! How did I not find it sooner? Thank you so much!

1 Like

So happy to hear! All the best with your extension project.

1 Like