Converts this object to a typed object of class clazz.
Conforms to the semantics of the following manual conversion:
class Person { name: String; age: Int }
dynamic = new Dynamic { name = "Pigeon"; age = 42 }
function toTyped(dynamic: Dynamic): Person = new {
name = dynamic.getPropertyOrNull("name") ?? super.name
age = dynamic.getPropertyOrNull("age") ?? super.age
}
Notable behavior:
Elements and entries of this are ignored.
Properties of this that have no corresponding property in clazz are ignored.
clazz properties that have no corresponding property in this have their defaults preserved.
clazz properties that have neither a default nor a corresponding property in this
throw an "undefined property" error (only) when accessed.
Throws if clazz is abstract or not a subclass of Typed.
An object that can contain arbitrary properties, elements, and entries.