I know this question is asked before but solutions doesn't fix my problem.
That's why I wanted to ask again. Because I have tried with ES5, ES6, ES2018, ES2015, ES2015.promise etc..
Background.js
async function run() {
setInterval(()=>{
console.log("Hello world");
},3000);
}
async function getTab() {
const tabs = await chrome.tabs.query({});
return tabs[0];
}
setInterval(async function(){
const tab = await getTab();
console.log(tab);
chrome.scripting.executeScript(
{
target: {tabId: tab.id, allFrames: true},
func: run,
},
(injectionResults) => {
console.log("what is happening here",injectionResults);
});
},5000);
tsconfig.json
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"sourceMap": true,
"outDir": "out",
"lib": [ "es2018", "dom" ]
}
}
tsc Background.ts
getting this error
error TS2468: Cannot find global value 'Promise'.
Background.ts:7:16 - error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option.
7 async function run() {
~~~
Background.ts:20:13 - error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option.
20 setInterval(async function(){