Happy to hear someone’s trying it out!
Since we’re using nominal types, things can get a little messy with fragments. Because they can be combined with individual fields or other fragments, the current code cuts them all up into the individual field selections (recursively), and recombines them; do let me know if you find a bug in that process, by the way!
I could (and probably should) special-case this particular instance (a fragment spread on its lonesome), since it’s the one time where I can just use fragments out of the box, but until I do that, there’s another option: if all’s well, the type coming out of document should be compatible with the fragment’s type, which means we can use the type coercion operator :>
to cast it, e.g.
let dummyToSuitFragment = (t: Dummy.t) => (t.getSuit :> Dummy.SuitFragment.t)
This might start to break down if you have union spreads getting into the mix, but hey! Baby steps.