Skip to content

Weird nested rendering of conditional return type that's a type parameter #3071

@pjeby

Description

@pjeby

Search terms

Generics, inferred types, conditional types, return types

Expected Behavior

The return type for the following function should be rendered as Content extends object ? Content : Other (i.e. as shown in the declaration)

export declare interface Other {}
export declare function m<Content>(content: Content): Content extends object ? Content : Other

(m() here is a simplified-for-repro function that gives you back the original parameter if it is of a qualifying type, and otherwise returns an adapter/wrapper of a specific type.)

Actual Behavior

The actual rendering is Content extends object ? Content<Content> : Other, with the input type parameter doubled on itself as though it had a type parameter.

Steps to reproduce the bug

Use the sample code as given.

Environment

  • TypeDoc version: 0.28.16
  • TypeScript version: 5.4.5
  • Node.js version: 20.17.0
  • OS: WIndows 10

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