Function tsDocStripAllButMostImportantTags

  • This function takes a source string, extracts all TSDoc comments from it, and then strips all TSDoc tags from these comments except for the 'throws' and 'param' tags. The function then returns the modified source string.

    Parameters

    • source: string

      The source string from which TSDoc comments are to be extracted and modified.

    Returns string

    The modified source string with all TSDoc tags stripped except for the 'throws' and 'param' tags.

    Remarks

    This function is useful when you want to simplify your TSDoc comments by removing all tags except for the 'throws' and 'param' tags.

    Throws

    If the source string is not a valid TSDoc comment.

    Example

    const source = `
    /**
    * Adds two numbers.
    * @param a - The first number.
    * @param b - The second number.
    * @returns The sum of a and b.
    * @throws If a or b is not a number.
    */
    `;
    tsDocStripAllTagsExcepThrowsParamDescription(source);
    //=> removes the returns-tag.

Generated using TypeDoc