Dictionary with arbitrary value types? #306
Replies: 2 comments
-
To try and avoid an XY problem: I'm trying to create a type that can hold an arbitrary number of key-value pairs. The types need to be arbitrary. They're allowed to be so because JS (and the DOM) is untyped, you can set any time to any DOM property. I currently have a struct
I'm wondering how I can type/implement |
Beta Was this translation helpful? Give feedback.
-
So I don't know how to solve the specific problem of an untyped value but modelling the problem in a different way helps here. I can model every element type as a big enum, will report back when I have something working. |
Beta Was this translation helpful? Give feedback.
-
I'm playing around with implementing a React-like UI library in Koka targeting the browser. To do this I need a way to create and update a dictionary with string keys and values of any type for the DOM element props.
Any ideas how I can do this?
Right now I have an extern JS file like this:
And then:
But it gives me codegen errors, I assume because there is no C external defined?
Is there a better way to do this?
Beta Was this translation helpful? Give feedback.
All reactions