Skip to content

Bring back [<POJO>]?Β #2421

@absolutejam

Description

@absolutejam

Description

In numerous occasions, I find myself having to use anonymous records for a POJO and this discards a whole bunch of type-safety and conciseness (destructuring & reusability) when I'm able to re-use a defined type. I noticed in older examples there's a [<POJO>] attribute which is exactly what I'm in need of, and I've also seen a couple of other people mention this in the Slack too.

This would obviously open up destructuring, but also allow a record as React component props (I think?). Additionally, it makes interop a lot easier as it doesn't mean dropping down to potentially unsafe anonymous records.

Repro code

[<POJO>]
type Foo =
    {
        A: string
        B: int
    }

would become something like

{ A: "whatever", B: 10 }

Was this removed for a technical reason or was it just to remove the amount of options?

Would you be open to this returning?

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