rrdelaney / ReasonablyTyped

:diamond_shape_with_a_dot_inside: Converts Flow and TypeScript definitions to Reason interfaces
https://rrdelaney.github.io/ReasonablyTyped/
MIT License
517 stars 24 forks source link

Type parameter bounds #19

Open rrdelaney opened 7 years ago

rrdelaney commented 7 years ago

Flow type definitions can give bounds to type parameters. We'd like to support them because they're giving us about 17 errors when compiling the FlowTyped test suite.

Blog post about type parameter bounds in Flow: https://flow.org/blog/2015/03/12/Bounded-Polymorphism/

bbqbaron commented 7 years ago

Hey, new crop of issues! I'd like to give this a go.

rrdelaney commented 7 years ago

Awesome! You'll probably want to look around here for implementing them 😄

bbqbaron commented 7 years ago

Back after a little research. Just to confirm approach, I'm not sure how to implement some classes of type bounds with current tools; it seems like we'd drop some of them (i.e. just replace the type params with refs to their bounds), or we need some upstream changes.

As it stands, it seems like I might mostly end up mostly declaring class-hierarchy bounds. Does that line up with your plans? Alternately, if #26 seems right, I could implement that (and add support for exact types, if anyone ever uses them :P).

EDIT: It looks like this last bit should wait for #25, since we'll need to know how to encode class inheritance before requiring it! I assume it'll involve open objects, but just in case...