TypeError with Chrome API

129 Views Asked by At

I've got a react project going that injects itself into a chrome extension through the content script. I've installed the @types/chrome and in my app.tsx I've included

/// <reference types="chrome"> 

and tried /* global chrome */ as well. However, I continue to get TypeError: Cannot read property 'query' of undefined.

In my app.tsx, i've got a call to the api :

chrome.tabs.query({ active:true,  currentWindow:true}, (tabs:chrome chrome.tabs.Tab[]) => { ....

Judging from this tutorial: https://blog.usejournal.com/making-an-interactive-chrome-extension-with-react-524483d7aa5d
I think i'm on the right track. Any suggestions? Thanks!

0

There are 0 best solutions below