reinforced / Reinforced.Typings

Converts C# classes to TypeScript interfaces (and many more) within project build. 0-dependency, minimal, gluten-free
MIT License
507 stars 82 forks source link

Improved compilation of JSDOC #272

Open MagMar94 opened 1 year ago

MagMar94 commented 1 year ago

I really like the JSDOC support, but it's compilation is not optimal when XML tags are used in the C# documentation.

An example with referencing documentation:

public class Menu
{
    /// <summary>
    /// The dessert recommendations grouped by <see cref="Coffee"/>.
    /// </summary>
    public IDictionary<Coffee, string> DessertRecommendations { get; }
}

public enum Coffee
{
    Black = 1,
    Americano = 2
}

This is currently serialized to this:

export interface IMenu {
    /** The dessert recommendations grouped by <see cref="T:Coffee" />. */
    dessertRecommendations: { [key in Coffee]: string  }
}

export enum Coffee {
    ...
}

A better serialization would be something like this:

export interface IMenu {
    /** The dessert recommendations grouped by {@link Coffee}. */
    dessertRecommendations: { [key in Coffee]: string  }
}

export enum Coffee {
    ...
}

If JSDoc annotations is unwanted, a simpler but more readable version would be to just remove the XML tags:

export interface IMenu {
    /** The dessert recommendations grouped by Coffee. */
    dessertRecommendations: { [key in Coffee]: string  }
}