ReasonablyTyped icon indicating copy to clipboard operation
ReasonablyTyped copied to clipboard

Intersection types

Open rrdelaney opened this issue 8 years ago • 2 comments

The type A & B will combine record types in Flow, we should also support it

rrdelaney avatar Jul 10 '17 16:07 rrdelaney

I'd like to start on this. Not knowing as much as I should about Ocaml, though, can I ask for a high-level approach description? I don't see a way for Ocaml to declare an intersection record type using something like &. I could certainly hand-construct an intersection of any two given types, but not declare the type relationship between some 'a and 'b in, say:

external mergeThings: 'a => 'b => ??? = "" [@@bs.module "stuff"];

How would this be accomplished?

bbqbaron avatar Jul 11 '17 01:07 bbqbaron

I don't really know either 😕 Maybe something like a type spread?

If you're looking for something pretty do-able #15 might be a good option 🙂

rrdelaney avatar Jul 12 '17 01:07 rrdelaney