Skip to content

Missing doc when returned field is not an object literal #2587

Closed
@xixixao

Description

@xixixao

Search terms

return fields properties

Expected Behavior

Input:

export function foo() {
  const x = {
    /**
     * This one is fine.
     */
    a: 1,
  };
  return {
    /**
     * This one is missing.
     */
    x,
  };
}

Output:

Includes both comments.

Actual Behavior

The This one is missing. comment is not included.

But note that TypeScript has no problem generating a correct declaration file with the comment:

export declare function foo(): {
    /**
     * This one is missing.
     */
    x: {
        /**
         * This one is fine.
         */
        a: number;
    };
};

Steps to reproduce the bug

As shown above.

Environment

  • Typedoc version: 0.25.13
  • TypeScript version: 5.0.4
  • Node.js version: 18.17.0
  • OS: macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions