You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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"}
The text was updated successfully, but these errors were encountered:
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:
The text was updated successfully, but these errors were encountered: