I am writing code that will be evaluated inside asynchronous function. This code is not wrapped in a function in this file, so all "await"s are underlined as inspection errors.
Is there a way to tell IDE that it is asynchronous context and all "await"s are ok?
UPD 1:
Code evaluation:
const m = {};
const AF = Object.getPrototypeOf(async function(){}).constructor;
async function evl(n){
if(typeof m[n] === t.U) await (new AF('imp', 'exp', await get('http://localhost/mdl/' + n + '.js')))(imp, o=>{m[n]=o});
return m[n];
}
Code source:
const message = await imp('message'); // await gives inspection error.
exp((name)=>console.log(message + ', ' + name + '!'));
Since 2020.2, the JavaScript and TypeScript | Async code and promises | Top-level 'await' expression inspection is turned off by default; if it's enabled for you, try disabling it in Settings | Editor | Inspections