Skip to content

__namedParameter Properties are not showing in documentation if exported interfaces are used to describe them #2456

Closed as not planned
@amkuchta

Description

@amkuchta

Search terms

__namedParameters interface typedoc typescript param

Expected Behavior

I have an interface defined ina file that is exported and able to be imported throughout my project:

/**
 * Wrapper for required arguments to parse a JSON `object`
 * into a specified class
 *
 * @typeParam T - The type of the class to be parsed into
 * @param {string} input - The JSON `object` to be parsed
 * @param {ClassConstructor<T>} type - The type of the class
 * to be parsed into
 */
export interface IFromJsonInput<T> {
  input: string;
  type: ClassConstructor<T>;
}

I use this interface to describe an object that is used as the parameter for a function within a class:

/**
 * Provides a common base set of properties and instructions that all inheriting
 * classes can utilize.
 *
 * @remarks
 * Designed to reduce boilerplate code, this class provides common properties and
 * functions that can be utilized by all classes; this includes information on who
 * interacted with the object (to be used for database storage) and methods to
 * allow a developer to convert the object to/from JSON. Routines also exist to
 * clone the object and validate it using
 * {@link https://github.com/typestack/class-validator | class-validator}.
 *
 * @typeParam T - The inheriting object type
 *
 * @example
 * ```ts
 * export class ExampleClass extends BaseClass<ExampleClass> {
 *   ...
 * }
 * ```
 */
export abstract class BaseClass<T> implements ISerializable<T>, IEntityBase {
/**
   * Converts a valid JSON object to an instance of the inheriting class
   *
   * @typeParam T - The type of the inheriting object
   *
   * @param {IFromJsonInput} __namedParameters
   * @param {string} __namedParameters.input - The object to be converted into the
   * inheriting class
   * @param {ClassConstructor<T>} __namedParameters.type - The type of the inheriting class
   *
   * @returns {T} T - An instance of the inheriting class
   *
   * @example
   * ```ts
   * let json: object = {...}
   * let exampleClass: ExampleClass = new ExampleClass().fromJson({
   *                                                                input: json,
   *                                                                type: ExampleClass
   *                                                             })
   * ```
   */
  fromJson({ input, type }: IFromJsonInput<T>): T {
    return plainToInstance(type, input);
  }
}

When I generate the docs using TypeDoc, the __namedParameter is listed, but the two items within it are not:

image

Actual Behavior

I would expect to see the enumerated items in __namedParameters listed out in the documentation for the function, as implemented in the comment.

Steps to reproduce the bug

  1. Create an interface
  2. Create a function within a class
  3. Use the interface to describe the parameter for the function
  4. Add comments
  5. Run the documentation command
    - Mine is npx typedoc --plugin typedoc-theme-hierarchy --theme hierarchy --plugin typedoc-plugin-extras --plugin typedoc-plugin-coverage --plugin typedoc-plugin-remove-references

####Installed Versions:

  • TypeScript: ^5.3.2
  • TypeDoc: ^0.25.4
  • typedoc-plugin-extras: ^3.0.0
  • typedoc-plugin-coverage: `^2.2.0
  • typedoc-plugin-remove-references: ^0.0.6
  • typedoc-theme-hierarchy: ^4.1.2

tsconfig.json

{
  "compilerOptions": {
    "forceConsistentCasingInFileNames": true,
    "target": "ES6",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "Node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "incremental": true,
    "plugins": [
      {
        "name": "next"
      }
    ],
    "baseUrl": "./src",
    "paths": {
      "@/*": ["./*"]
    }
  },
  "include": ["**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
  "exclude": ["node_modules"]
}

typedoc.json

{
  "$schema": "https://typedoc.org/schema.json",
  "entryPoints": ["src"],
  "entryPointStrategy": "expand",
  "out": "public/docs",
  "tsconfig": "./tsconfig.json",
  "name": "React TypeScript TailwindCSS Components",
  "exclude": [
    "node_modules/**/*.*",
    "node_modules",
    "**/node_modules/**",
    "**node_modules/**/*.*"
  ]
}

TypeDoc Command

npx typedoc --plugin typedoc-theme-hierarchy --theme hierarchy --plugin typedoc-plugin-extras --plugin typedoc-plugin-coverage --plugin typedoc-plugin-remove-references

Environment

  • Typedoc version: ^5.3.2
  • TypeScript version: ^0.25.4
  • Node.js version: v20.9.0
  • OS: Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions