3

I'm new to Fable/Elmish/React, and I'm trying to understand the syntax to cast an EventTarget so I can get to the .value

The examples I can find all use the

input [ Value model.Value
          OnChange (fun ev -> ev.target?value |> string
         ]

However I get

None of the types 'EventTarget, string' support the operator '?'

Instead I have to use the following syntax

input [ Value model.Value
          OnChange (fun ev -> (ev.target:?> HTMLInputElement ).value
         ]

So what gives? Am I referencing different assemblies?

Paul Lawrence
  • 197
  • 3
  • 14

1 Answers1

5

You need to

open Fable.Core.JsInterop

to see the operator ?

nilekirk
  • 2,353
  • 1
  • 8
  • 9