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
When manually hand-rolling an enum, it is possible to annotate each enum value with a jsdoc. This way, your IDE can show you documentation during autocomplete and during hover:
Is it possible to achieve this also with typescript-string-enums?
The text was updated successfully, but these errors were encountered:
Hi benny, first of all, sorry for the slow response.
Unfortunately I do not know of a way to make this work. I would be surprised if this is possible, as the jsdoc would need to understand to make the jump from a function argument to the key of a computed type. If documenting individual values is important to you, you may be stuck with the repetitive definition.
Fixed in 0.2.0 with the new object syntax. The following now works:
exportconstStatus=Enum({/** * Everything is fine. * * Hovering over Status.RUNNING in an IDE will show this comment. */RUNNING: "running",/** * All is lost. */STOPPED: "stopped",});exporttypeStatus=Enum<typeofStatus>;console.log(Status.RUNNING);// -> "running"
This is a cool little library.
When manually hand-rolling an enum, it is possible to annotate each enum value with a jsdoc. This way, your IDE can show you documentation during autocomplete and during hover:
Is it possible to achieve this also with
typescript-string-enums
?The text was updated successfully, but these errors were encountered: