Skip to content

Anonymous records from variant not respecting @as decorator #6549

Closed
@cwstra

Description

@cwstra

Tried out all these examples in the playground, w/ rc.8:

If we have a variant type with an aliased property:

type union =
  Member({
    @as("annoyinglyLongName") shortName: string
  })

we can successfully generate a binding to this property via a function:

let shortName = (Member({shortName})) => shortName
function shortName(param) {
  return param.annoyinglyLongName;
}

Huzzah!

However, if instead we grab the inner record, and access the property off that, the name mapping fails to kick in.

let shortName' = (Member(r)) => r.shortName
function accessRec$p(r) {
  return r.shortName;
}

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