Saturday, 24 April 2021

TSDocs on TypeScript String Literal Types

I'm trying to figure out a way to have TSDocs work with a string literal type declaration in TypeScript.

For example:


type InputType = 
/** the TSDoc doesn't works for num1, but i'd like it to */
'num1' |
/** the TSDoc doesn't work for num2, but i'd also like it to */
'num2'

export const test = (...input: InputType[]) => {
    return input
}

tac('num1')

I'd like 'num1' & 'num2 to show the TSDoc in VSCode or other tools with the comment, but the tools do not currently show the comment when typing in 'ma1'.

Is there any way to do this?



from TSDocs on TypeScript String Literal Types

No comments:

Post a Comment