Commit b6a6d27
committed
Fix non-Promise values in Promise.all in extension.ts
This commit fixes incorrect usage of Promise.all() where non-Promise
values were being passed, causing ESLint errors.
Problem:
The restartQueryServer command was passing an array to Promise.all()
containing:
1. A Promise (queryRunner.restartQueryServer)
2. Either a Promise or an empty object {} (conditional expression)
3. An async function (not invoked, so not a Promise)
ESLint rule '@typescript-eslint/await-thenable' detected this error:
src/extension.ts:200:11
Unexpected iterable of non-Promise (non-"Thenable") values passed
to promise aggregator
The issues were:
- Line 199: Using `{}` as a fallback instead of a resolved Promise
- Line 200: Declaring an async function but not invoking it (missing
the `()` to actually call the function and get its Promise)
Solution:
1. Replace `{}` with `Promise.resolve()` to maintain type consistency
2. Wrap the async function in an IIFE (Immediately Invoked Function
Expression) by adding `()` at the end: `(async () => { ... })()`
This ensures Promise.all() receives an array of actual Promise objects,
allowing it to properly await all operations in parallel.
File modified:
- extensions/ql-vscode/src/extension.ts1 parent 911f880 commit b6a6d27
1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
200 | | - | |
| 199 | + | |
| 200 | + | |
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
206 | | - | |
| 206 | + | |
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
| |||
0 commit comments