Example:
In @material-ui/core/createMuiTheme.d.ts
there are a few interfaces defined, e.g. ThemeOptions and Theme
It's possible to generate koltin bindings using ts2kt
and it allows using createMuiTheme
function to create Theme
from ThemeOptions
, but what is a correct [aka type safe] way of instantiating ThemeOptions
which is an external interface and it doesn't have a constructor.
I created a data class that implements the interface and instantiate it. Sometimes I need to use the instance as dynamic as it allows 3rd party js code to modify it.
Is this approach any good assuming I don't want to lose type safety and use JsObject/json()/js()?