I am receiving the following error when using the Binding.subModelSelectedItem():
FS0001: Type mismatch. Expecting a 'string -> Binding<(Model * 'a), b>'
but given a
'string -> Binding<Model,Msg>'.
The type 'Model * 'a' does not match the type 'Model'
From the following F# code:
type Msg =
| SetAppointmentKey of int option
Then, in the bindings:
"SelectedAppointmentKey" |> Binding.subModelSelectedItem("AppointmentKeys", (fun m -> m.SelectedAppointmentKey), SetAppointmentKey)
I do not understand the error message. What does the error message mean? "Expecting" from who? "Given" from what?
Sorry for my ignorance here, but nothing this newbie has tried has fixed this.
Thank you for any help.
TIA
I'm not sure where the specific error is in your code, but I can try to help you understand what the error message says. A simple example to illustrate the same error:
This does not work, because
foo
expects a functionint -> int
, butbar
returns astring
. You get:The error message tells you that the function you're using as an argument has a wrong type. It tells you the two types and also a part of it where it goes wrong (here, the return types do not match).
Looking at your error message:
It seems that you are creating a function somewhere that takes a string and returns a
Binding
. This function is expected to return aBinding
withModel
as the first type parameter, but your code returns a tuple formed byModel
and some other thing.Something like this can easily happen if you have
fun x -> ..., something
in your code, perhaps in a place where you wanted(fun x -> ...), something
. You would get a similar error if you wrote, e.g.: