I've done them in C# with slightly less safety.
https://higherlogics.blogspot.com/search/label/tagless%20int...
The style of the construction is what matters most. If you're using JS then you're already giving up types, but the higher order abstract syntax is what lets you embed and play with language semantics.