anchor.diff:                                          Client-side JSON serialization does not support custom DateTime formatting. \
                                           This field will be serialized using ISO format."
                                           tt.FullName caseName argName)
  +                                let argT, optionKind =
  +                                    if argT.IsGenericType && argT.GetGenericTypeDefinition() = typedefof<option<_>> then
  +                                        argT.GetGenericArguments().[0], cInt (int OptionalFieldKind.NormalOption)
  +                                    else argT, cInt (int OptionalFieldKind.NotOption)
                                   j + 1, fun es ->
                                       encode (T.FromType argT) >>= fun e ->
  -                                    k (J.NewArray [cString ("$" + string j); cString argName; e] :: es))
  +                                    k (J.NewArray [cString ("$" + string j); cString argName; e; optionKind] :: es))
                               |> snd
                               <| []
                           | JI.InlineRecord(name, record) ->
  
positive.code:                     | _ -> failwith "Invalid field option kind")
                  o))
  
      let Union _ (discr: string) (cases: (string * (string * string * (unit -> obj -> obj))[])[]) =
          box (fun () ->
              box (fun (x: obj) ->
                  if JS.TypeOf x ===. JS.Object then
  
negative.code:         box (fun () ->
              box (fun (x: obj) ->
                  let o = if t ===. JS.Undefined then New [] else JS.New t
                  fields |> Array.iter (fun (name, dec, kind) ->
                      match kind with
                      | OptionalFieldKind.NotOption ->
                          o?(name) <- dec () x?(name)
                      | OptionalFieldKind.NormalOption ->
                          o?(name) <-
                              if JS.HasOwnProperty x name
                              then Some (dec () x?(name))
                              else None
                      | OptionalFieldKind.MarkedOption ->
                          if JS.HasOwnProperty x name then
                              o?(name) <- (dec () x?(name))
                      | _ -> failwith "Invalid field option kind")
                  o))
  
      let Union (t: obj) (discr: string) (cases: (string * (string * string * (unit -> obj -> obj) * OptionalFieldKind)[])[]) =
          box (fun () ->
              box (fun (x: obj) ->
                  if JS.TypeOf x ===. JS.Object then
  