Syntax confusion in Fable with EventTarget

311 views Asked by At

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?

1

There are 1 answers

0
nilekirk On BEST ANSWER

You need to

open Fable.Core.JsInterop

to see the operator ?