-
Notifications
You must be signed in to change notification settings - Fork 463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
genType cannot "unwrap" some types with -open ReactV3 #5990
Comments
Would you qualify under what conditions this happens? |
OK looks like it's the path to type A simpler test is: open ReactV3
@genType
type ttt = React.callback<int, string> This is pretty easy to patch, but it would be good to know what are all the types one needs to worry about. React.callback
React.componentLike
React.component
React.Context.t
React.Ref.t
React.ref
React.element |
Yeah, it appears to be the |
@illusionalsagacity can you try with #5991, once CI is finished producing the package. |
I am not sure that I did this right, but it didn't appear to change the output:
$ ./node_modules/rescript/rescript build -with-deps -verbose
BSB check build spec : ..rescript-10.1-gentype-bug/rescript-master/src
Package @rescript/react -> ..rescript-10.1-gentype-bug/rescript-master/node_modules/@rescript/react
Package stack: rescript-master
Package stack: rescript-master @rescript/react
Dependency on @rescript/react
BSB check build spec : ..rescript-10.1-gentype-bug/rescript-master/node_modules/@rescript/react/src
Entering ..rescript-10.1-gentype-bug/rescript-master/node_modules/@rescript/react/lib/bs
Cmd: ..rescript-10.1-gentype-bug/rescript-master/node_modules/rescript/darwin/ninja.exe
Installation started
Entering ..rescript-10.1-gentype-bug/rescript-master/node_modules/@rescript/react/lib/ocaml
Cmd: ..rescript-10.1-gentype-bug/rescript-master/node_modules/rescript/darwin/ninja.exe -f ../bs/install.ninja
Installation finished
Dependency Finished
ninja.exe -C lib/bs |
You need to download |
Btw I tested your repo https://github.com/illusionalsagacity/rescript-10.1-gentype-bug and it's working. |
Working for me too, thanks! |
Thank you for filing! Check list:
I'm not really sure where this issue belongs
Given this ReScript code:
JSXv3 gentype Code reproduction repository
no longer "wraps" the callback to convert the type representation from the TypeScript one to ReScript's version.
@rescript/react@~0.10.0
andrescript@10.0.1
produce this:I think this related is a fairly long-standing issue with gentype where the types don't "recurse" into third-party modules to resolve / unwrap. i.e.
React_callback
is just a type, it can't be resolved to a function that needs to have it's arguments wrapped.rescript-association/genType#458
I can try to see if adding gentype annotations to a locally linked
@rescript/react
will help, but do not have time to do this immediately--Having trouble getting the compiler going on the m1 at the moment, I can try to reproduce on an intel mac later.I fully realize this could (and probably should) be considered better output code, but it breaks
gentype
usage from typescript, which is IMO fairly disruptiveThe text was updated successfully, but these errors were encountered: