ehn-dcc-development/hcert-kotlin

Remove Inline Javascript

JesusMcCloud opened this issue · 1 comments

On some occasions we are still using inline JS code.
It would be really nice to get rid of

  • inline JS code
  • dynamic/.asDynamic()
  • unsafe casts

This requires some more effort, since there are certain situations where the generated externals effectively force us to do so, since the externals themselves are faulty, for example.
In addition, some JS functions take JS objects for parameters, therefore we need to make absolutely sure that our type-safe code actually compiles to this very specific object structure. This is especially tricky for higher-order functions edge cases like using numbers for keys…

The current state of Kotlin/JS seems to prevent this in certain cases (looking at you, cbor decoder options!).
What we can and should do, however, is to encapsulate such workarounds into externals, such that src/jsMain is free of js() and .asDynamic() calls