You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In ReScript it's convention to have a core generic type with a module of polymorphic functions to interop with that type. And this is nice to use with a pipe operator chaining. But if I want to allow people to chain functions in ts/js I need to model it with dot notation, so modelling types can be better done at the record level than the module level.
The text was updated successfully, but these errors were encountered:
TIL: I never noticed that I can use GADT signature like that
I plan to completely rewrite genType as a major milestone in v12, aiming for full compatibility with the JS output (#6196)
GADT is not fully supported in the current version and improving it is definitely one of our goals :)
GADTs are awesome but this use case is a little simpler. I'm not sure I would want to use a GADT as typescript user where the language doesn't have it as a feature or how one would model a GADT in TS. Scoped polymorphic types already have a one to one in typescript and it would be nice to leverage that.
Awesome stuff @cometkim I'm also very happy to contribute to the genType overhaul. I've read some of the issues related to it and think declaration files are a great idea 💡
I would love to be able to build apis in rescript for users in typescript and one thing that would help is supporting scoped polymorphic types.
For example:
is generated in the typescript as:
where the scoped polymorphic types are simply "unknown".
It would be better if it could generate:
Why would I use something like this?
In ReScript it's convention to have a core generic type with a module of polymorphic functions to interop with that type. And this is nice to use with a pipe operator chaining. But if I want to allow people to chain functions in ts/js I need to model it with dot notation, so modelling types can be better done at the record level than the module level.
The text was updated successfully, but these errors were encountered: