Right, I missed the fact that you need only the keys for the input, but in the result you need the values.
So it’s
type parameterTypeKeys =
| @as("string") String
| @as("number") Number
| @as("boolean") Boolean
@unboxed
type parameterType =
| String(string)
| Number(float)
| Boolean(bool)
Modeled the keys as a separate type now as there is no keyOf in ReScript.
And the parameterType is indeed as you suggested in the last example. We can ensure the wrapper is optimized away in the resulting JS code with @unboxed.
Updated example: ReScript Playground