Skip to content

[JS] Fable 4 -> Fable 5 unnecessary parentheses in ternary expressions #4295

@Lanayx

Description

@Lanayx

I'm starting converting Oxpecker.Solid plugin to Fable 5 and I've found some inconsistencies.

Oxpecker.Solid:

if x = 1 then h1() else h2()

Fable4 jsx:

{ (x  === 1) ? <h1></h1> : <h2></h2> }

Fable5 jsx:

{ (x === 1) ? (<h1 />) : (<h2 />) }

Full Repro (command is dotnet fable --noCache --exclude Oxpecker.Solid.FablePlugin --extension .jsx)

While I remember that self-closing tag was added by @shayanhabibi in #4037 , were extra parentheses for ternary operator added intentionally?

UPDATE: Interestingly in some cases paretheses are not added

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions