Skip to content

Crash with Flow component syntax #944

Open
@neutraali

Description

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>

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions