-
Notifications
You must be signed in to change notification settings - Fork 34.3k
Closed
Labels
*duplicateIssue identified as a duplicate of another issue(s)Issue identified as a duplicate of another issue(s)
Description
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.74.1
- OS Version: Ubuntu 22.04.1 LTS x86_64
Steps to Reproduce:
- Just write a generator function like this one:
As you can see, the bottom variable f
doesn't get type hints for string.
This annotation is following JSDoc @generator.
At this point, if we look at the hint of parseFiles
, we can see that yields
doesn't seem to be interpreted correctly, and the function doesn't seem to be a generator function. (no asterisks, nor any text description for generator function)
- Current temporary solution
Replace the @yields {string}
to @returns {AsyncGenerator<string>}
.
Then the variable f
below can correctly get the string type hint.
- Finally, this is example code:
More details:
- Node.js v16.18.1
- Already installed dependence
@types/node
.
(But whether it is installed or not does not affect the reproduction of this problem.)
- Already installed dependence
import { resolve } from "path";
import * as fs from "fs";
async function* parseFiles(dir) {
const dirEntires = await fs.promises.readdir(dir, { withFileTypes: true });
for (const dirent of dirEntires) {
const res = resolve(dir, dirent.name);
if (dirent.isDirectory()) {
yield* parseFiles(res);
} else {
yield res;
}
}
}
(async () => {
for await (const f of parseFiles('./public')) {
}
})();
Metadata
Metadata
Assignees
Labels
*duplicateIssue identified as a duplicate of another issue(s)Issue identified as a duplicate of another issue(s)