We are using string enums a lot. The following example is what gets pretty close:
/** * Allowed directions. */exportdeclaretypeFlexDirection="row"|"column";exportnamespaceFlexDirection{/** * Align items in a row. */exportconstROW: "row"="row";/** * Align items in a column. */exportconstCOLUMN: "column"="column";}declarefunctiongo(direction: FlexDirection);// Hover "FlexDirection to see docs.go(FlexDirection.ROW);// Hover "ROW" to see docs.go("row");Is there a better way to add documentation to a string literal type? Sometimes the meaning of the values is not all that visible, or requires examples. The only thing I miss in a literal type such as "row" | "column" at the moment is I can not easily associate docs with the 2 values.
Does it sound feasible to add a shorthand syntax for this similar to:
/** * Allowed directions. */exportliteral/* whatever the keywords */enumFlexDirection{/** * Align items in a row. */ROW="row",/** * Align items in a column. */COLUMN="column"}
We are using string enums a lot. The following example is what gets pretty close:
Is there a better way to add documentation to a string literal type? Sometimes the meaning of the values is not all that visible, or requires examples. The only thing I miss in a literal type such as
"row" | "column"at the moment is I can not easily associate docs with the 2 values.Does it sound feasible to add a shorthand syntax for this similar to: