Skip to content

Default type arguments should be omitted from documentation #2820

@hoodmane

Description

@hoodmane

Expected Behavior

If a type has a type argument and we use the default value for it, the type argument should not appear in the documentation.

Actual Behavior

Sometimes the type argument appears, sometimes it doesn't. It seems that Iterator<number> as a return type is rendered as Iterator<number> but as a parameter type is rendered as Iterator<number, any, undefined>.

Steps to reproduce the bug

I use Uint8Array for the repro because it is always present independent of the "lib" compiler option. Uint8Array just gained a type parameter in typescript 5.7 so this particular reproducer doesn't work in prior versions but it will reproduce with Iterator.

npm i [email protected] [email protected]
cat << 'END' > a.ts
export function f(a: Uint8Array): Uint8Array {
    return a;
}
END
npx typedoc a.ts

Output looks like:
image

Environment

  • Typedoc version: 0.27.5
  • TypeScript version: 5.7.1
  • Node.js version: 22.12
  • OS: ubuntu 22.04

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