Skip to content

The "defined in" points to node_modules type rather than to actual code #2307

Closed
@allista

Description

@allista

Search terms

defined in
node_modules
react
functional component
FC

Expected Behavior

The Defined in field in generated docs should refer to the actual file where the documented function is defined, rather than the library code where its type is defined.

Actual Behavior

The doc entry for a react functional component declared in my-package/src/MyComponent.tsx as follows:

/**
* Description
* 
* @constructor
*/
export const MyComponent: FC = () => (<div>A test</div>);

Contains this Defined in section:

Defined in

node_modules/.pnpm/@[[email protected]](mailto:[email protected])/node_modules/@types/react/index.d.ts:519

It is the same for any component defined in any module this way.

Steps to reproduce the bug

The typedoc config in tsconfig.json:

  "typedocOptions": {
    "entryPoints": ["src/index.ts"],
    "out": "docs",
    "entryDocument": "index.md"
  }

Run as typedoc --plugin typedoc-plugin-markdown

Environment

  • Typedoc version: 0.24.8
  • TypeScript version: 4.6.4
  • Node.js version: 16
  • OS: Ubuntu
  • typedoc-plugin-markdown: 3.15.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedContributions are especially encouraged

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions