Tagged “indexeddb”
-
Binding to a JavaScript Function that Returns a Variant in ReScript
javascript indexeddb rescript variantNote from the future: In the current year, none of this article is relevant anymore. Use Rescript's
@unboxed
attribute instead. It solves the whole problem I was trying to solve with this article, but much more cleanly. I will leave this article here as a historical record. ReScript provides easy ways to bind to most JavaScript functions in a way that feels both native and safe. Conveniently, it even provides an@unwrap
decorator for parametric polymorphism. However, there are a few places where we still have to fill in the gaps. This article documents how to bind to a JavaScript function that can return any one of several different types using ReScript variants.
See all tags.