Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Types from `*.d.ts` files are not parsed in node_modules

Open
#929 1 comment 2 reactions 0 assignees View on GitHub

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

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

typescript

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from reactjs/react-docgen

All issues in reactjs/react-docgen

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.