Skip to content

Expand type parameters when expandParameters is true (or add new option) #875

Description

@Jym77

What package is the feature request related to?

typedoc-plugin-markdown

Background

With expandParameters, we can have the (regular) parameters expanded, e.g. going from:

static of<I, T, Q, S>(
   input, 
   rules, 
oracle?): Audit<I, T, Q, S>;

to

static of<I, T, Q, S>(
   input: I, 
   rules: Iterable<Rule<I, T, Q, S>>, 
oracle?: Oracle<I, T, Q, S>): Audit<I, T, Q, S>;

(the poor indentation of the last line is exactly my second concern in #874 😅)

However, as shown in the example above, the type parameters are left untouched instead of having their own extends or default value added (it is still present in the parameters list/table afterwards). I think it would be good to expand them too:

static of<I, T extends Hashable, Q extends Metadata = {}, S = T>(
   input: I, 
   rules: Iterable<Rule<I, T, Q, S>>, 
   oracle?: Oracle<I, T, Q, S>): Audit<I, T, Q, S>;

Either through the same expandParameter options, or with a new expandTypeParameter one (reusing the same makes sense since the parametersFormat option is already shared between regular and type parameters).
As far as I've tried, this more or less requires copying the type parameter construction from typeParametersList and injecting it in the type parameter mapping in signatureTitle.

Of course, this is theme-able through partials.signatureTitle, but that partial does so much more that it feels like it's going to be duplicating a lot of code for just this. Alternatively, a new partial for this could work but sounds maybe too precise.

Proposed solution

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions