- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 312
 
Open
Labels
Description
Reporting from storybookjs/storybook#24165
Currently TS enums analysis is lossy:
enum ButtonType {
  Button = 'button',
  Reset = 'reset',
  Submit = 'submit',
}
type ButtonTestProps = {
  type?: ButtonType;
};
export const ButtonTest = (props: ButtonTestProps) => {
  return <button {...props}>Test</button>;
};Produces:
          "tsType": {
            "name": "ButtonType"
          },Compare this to a union:
type ButtonType = "button" | "reset" | "submit";Which produces:
          "tsType": {
            "name": "union",
            "raw": "\"button\" | \"reset\" | \"submit\"",
            "elements": [
              {
                "name": "literal",
                "value": "\"button\""
              },
              {
                "name": "literal",
                "value": "\"reset\""
              },
              {
                "name": "literal",
                "value": "\"submit\""
              }
            ]
          },It would be fantastic if react-docgen could produce something similar for enums!
macko911, bmsuseluda, sehnemvinicius, jtiala and williaster