title: How do I cast a JavaScript object to a Kotlin object?
body: <p>I have received a JavaScript object in response to a remote HTTP request.  I have a kotlin model (trait) that defines the various fields I expect on the object (the nullable ones are optional).</p>
  
  <p>First, I want to do an <code>is</code> check to make sure my object is in fact of the expected type.  I initially tried <code>payload is MyModel</code> but that doesn't work due to the way the <code>is</code> operator is written in kotlin.js.</p>
  
  <p>Second, I want to cast to <code>MyModel</code> so I can get auto-complete, etc. on the object while I work with it.  Normally, the <code>is</code> alone would be enough but since that doesn't work I need something for this problem as well.</p>
  
  <p>I would like to avoid manually populating my object from a <code>dynamic</code>.  I wouldn't mind doing this so much if I could use <code>by Delegates.mapVal(...)</code> but that requires a <code>Map&lt;String, Any?&gt;</code> and I don't know how to get my <code>dynamic</code>/<code>Any?</code> payload into a <code>Map&lt;String, Any?&gt;</code>.</p>