Closed
Description
Experimenting with Playground. The following compiles with an error:
type t = {
optValue?: int,
}
let x = Some(3)
let s1 = {optValue: ?(x->Belt.Option.map(a => a+1))} // <-- Type error
let s2 = {optValue: ?(Belt.Option.map(x, a => a+1))}
Type Errors
[E] Line 6, column 22:
This has type: option<int>
Somewhere wanted: int
Screenshot:
So, the pipe expression highlighted has indeed type option<int>
but the compiler wants a plain int
for some reason.
Interesting, the same expression without the pipe compiles just fine.