Can't add type signature to Labelled argument with default value

The following code currently compiles in rescript 9 but fails in 10 with error:

[E] Line 1, column -1:
   The value name can't be found

The code:

module AliasedWithDefault = {
  @react.component
  let make = (~name as theName: string="") => {
    theName->React.string
  }
}

See the full playground example.

Is there some documented change in behavior for v10?

1 Like

The syntax should look like this instead:

let make = (~name as theName="": string) => {

Though it apparently doesn’t work in the playground…it does work locally with rescript 10.1.4, rescript-react 0.11.0, and "jsx": { "version": 4, "mode": "classic" } in the bsconfig.

1 Like

Thanks Ryan.

I think I preferred the v9 syntax though. Seems more consistent with regular let binding comparing
let theName: string = "value"
and
as theName: string = "value"
vs
as theName="value": string

1 Like