Skip to content

Module docs incorrectly report source code locations #2207

@jmartinezmaes

Description

@jmartinezmaes

Search terms

module, defined, in, source

Expected Behavior

Module documentation (indicated by the @module tag) should accurately associate a location in the source code.

Actual Behavior

Module documentation will associate the location of the first documented symbol in the source code.

Steps to reproduce the bug

This code:

/**
 * Module doc for the `foo` module.
 *
 * @module
 */

/**
 * Doc for the `foo` function.
 */
export function foo(): string {
    return "foo";
}

Currently produces this output:

image

The module docs say "defined in foo.ts:10", however, that is actually the location of the foo function.

It may make more sense to link to just the file, i.e. "foo.ts", or maybe the first line number of the module doc comment if that's something that can be reasonably extracted.

Environment

  • Typedoc version: 0.23.29
  • TypeScript version: 4.9.5
  • Node.js version: 19.2.0
  • OS: Ubuntu 20.04 on WSL2 on Windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedContributions are especially encouraged

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions