react-docgen icon indicating copy to clipboard operation
react-docgen copied to clipboard

Crash with Flow component syntax

Open neutraali opened this issue 1 year ago • 4 comments

Docs: https://flow.org/en/docs/react/component-syntax/

Code

component Example( text: string = 'Hello World' ) {
    return <div>{text}</div>;
}

Expected

[
  {
    "description": "",
    "displayName": "Example",
    "methods": [],
    "props": {
      "text": {
        "required": false,
        "flowType": {
          "text": "string"
        },
        "description": "",
        "defaultValue": {
          "value": "'Hello World'",
          "computed": false
        }
      }
    }
  }
]

Actual

SyntaxError: playground.tsx: Missing semicolon. (1:9)

> 1 | component Example(
    |          ^
  2 | 	text: string = 'Hello World'
  3 | ) {
  4 | 	return <div>{text}</div>

neutraali avatar Sep 20 '24 08:09 neutraali

I also need this fixed

mikaeltoivio avatar Oct 03 '24 08:10 mikaeltoivio

Me too

jjylha avatar Oct 03 '24 09:10 jjylha

Babel has deprecated its official support for flowjs. We need to switch to hermes-parser for flow in order to support this. This will be a bigger undertaking and take a while.

danez avatar Oct 19 '24 18:10 danez