Is it necessary to use external enum class types for some of the enum classes in the Mui wrappers, e.g. mui.material.AlertColor?
It makes (as far as I can tell) code like the following that looks OK, compiles OK, but breaks when running in the browser:
Copy code
AlertColor.values().forEach { color -> ...
Under both the IR and Legacy compiler it says there is no such thing as AlertColor.values()...
(Uncaught ReferenceError: values is not defined at eval (Alert.kt?905c:18:24))
I believe if the types where enum classes rather than external enum classes, the above would work, and it is still compatible with React.
t
turansky
03/03/2022, 6:45 AM
external enum
- just string union emulation.
Do you suggest to use ordinary enum classes?
c
cfnz
03/03/2022, 7:54 AM
Yes, then then things like AlertColor.values and other Enum related things should work like you expect it to since it compiles OK.