Types from `*.d.ts` files are not parsed in node_modules
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- documentation, tooling
Research direction
Start in makeFsImporter.ts and trace how unresolved files under node_modules are read and parsed. Check the existing handling around resolvedSource and parseCache, then verify that installed packages exposing .d.ts files produce the expected interface information in component props.
Written by the indexing model from the issue text.
Description
If an installed package would deliver type informations with d.ts files, it won't parse these files and interface informations are missing in the props.
It could be fixed in the makeFsImporter.ts file with a simple addition:
if (!nextFile) {
// Customization: try to read from a "d.ts" file instead, if it exists
if (resolvedSource.includes("node_modules")) {
const dtsPath = resolvedSource.replace(".js", ".d.ts");
if (fs.existsSync(dtsPath)) {
resolvedSource = dtsPath;
}
}
// Customization: end
// Read and parse the code
const src = fs.readFileSync(resolvedSource, "utf8");
nextFile = file.parse(src, resolvedSource);
parseCache.set(resolvedSource, nextFile);
}
But i didn't want to make another pull request because i'm not sure if this is a nice way to solve it.
- Dominant language
- TypeScript
- Stars
- 3.8k
- Forks
- 316
- Avg merge
- 3h 28m
- Merged PRs (30d)
- 6
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from reactjs/react-docgen
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
reactjs/react-docgen#1102 ·
-
Typescript Status Open
Difficulty 5/5 Over a week Newbie friendliness 20/100
reactjs/react-docgen#1005 · 4 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
reactjs/react-docgen#997 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
reactjs/react-docgen#994 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
reactjs/react-docgen#982 · 2 comments ·
All issues in reactjs/react-docgen
Similar issues
-
blocklist removal
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
MetaMask/eth-phishing-detect#296544 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
pastelsky/bundlephobia#1122 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
category/development priority/P2 scope/file-operations scope/testing type/enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100