Currently in JS2 it's possible to do new Struct(..fields) (this will change slightly in https://github.com/rust-diplomat/diplomat/issues/719), and new Enum("variantName"). We should also support using {...} in place of structs and "variantName" in place of enums in parameters and struct fields, so the following should just work:
let result = Foo.takesNestedStruct({ a: 1, innerStruct: { b: 3, c: 4 }, enumValue: "foo" })
Probably this can be done with a .fromSuppliedValue() method (or a [diplomatRuntime.fromSuppliedValue] Symbol?) on every enum/struct that gets unconditionally called when attempting to treat a value as that type in params or struct field construction.
Currently in JS2 it's possible to do
new Struct(..fields)
(this will change slightly in https://github.com/rust-diplomat/diplomat/issues/719), andnew Enum("variantName")
. We should also support using{...}
in place of structs and"variantName"
in place of enums in parameters and struct fields, so the following should just work:Probably this can be done with a
.fromSuppliedValue()
method (or a[diplomatRuntime.fromSuppliedValue]
Symbol?) on every enum/struct that gets unconditionally called when attempting to treat a value as that type in params or struct field construction.