Function tsDocStripTypesAndDefaults

  • Strips JSDoc style types and default values from the provided code.

    Parameters

    • code: string

      The TypeScript code string from which types should be stripped.

    Returns string

    The provided code string with all TypeScript types removed.

    Remarks

    This function is useful when you want to remove TypeScript types from a code string.

    Example

    const code = [
    '/**',
    ' * @returns {string} a string',
    ' */',
    //
    ].join('\n')
    const actual = tsDocStripTypesAndDefaults(code)
    const expected = [
    '/**',
    ' * @returns a string',
    ' */',
    //
    ].join('\n')

Generated using TypeDoc