Animesh Sahu
03/28/2021, 12:35 PMankushg
03/28/2021, 2:47 PMturansky
03/28/2021, 2:49 PMturansky
03/28/2021, 2:52 PMankushg
03/28/2021, 8:47 PMturansky
03/28/2021, 9:45 PMankushg
03/29/2021, 10:37 AMenum class ZeroOrTen(val value: Int) { ZERO(0), TEN(10)}
Ideally we would like this to be interoperable with TS in a way that lets clients use 0 and 10 in place of an instance of the class. We currently use Serialization and custom serializers for this but it’s very heavy for client-side JS.
If that’s not possible, maybe
• expose named constants that point to the enum class instances
• use the value field to automatically define a TS enum or union type that we can pass into a function to get an instance of the actual enum class by the value
Currently we can’t even export a function that takes an int and returns an enum because the enum return type can’t be exported.Anders
03/29/2021, 1:21 PMexternal interface
, and turn classes into plain JS objects at the API boundary. Useful for React & Web Worker interop.
• Likewise, can rewrite enum classes into e.g. a sealed class hierarchy, or String
+ generated constants indeed.
• Rewrite suspend methods into Promise<T>
returning.
• Rewrite List<T>
to Array<T>
, etc
Still using manually written wrapper code though. Waiting for the web folks' feedback and decision.ankushg
03/29/2021, 3:20 PMturansky
04/02/2021, 1:27 PMturansky
04/02/2021, 2:23 PMturansky
04/26/2021, 6:49 AM