In a symbol table implementation I have this method:
public getAllSymbols(type?: typeof Symbol, localOnly = false): Promise<Set<Symbol>> {
const promise = super.getAllSymbols(type ?? Symbol, localOnly);
return new Promise(async (resolve, reject) => {
try {
let result = await promise;
if (!localOnly) {
this.dependencies.forEach(async (dependency) => {
result = new Set([...result, ...await dependency.getAllSymbols(type, localOnly)]);
});
}
resolve(result);
} catch (reason) {
reject(reason);
}
});
}
which works fine, however ESLint reports 2 promise misuses:
Promise returned in function argument where a void return was expected.
no-misused-promises
What's wrong with this code and how would I have to write it to get rid of the linter error?