Skip to content
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

v4.0.2+ error: The requested module '/fable_modules/fable-library.4.0.2/Util.js' does not provide an export named 'curry1' #3440

Closed
ArtemyB opened this issue May 4, 2023 · 2 comments · Fixed by #3455

Comments

@ArtemyB
Copy link

ArtemyB commented May 4, 2023

Description

Before v4.0.2 (e.g.. v4.0.1) my code was working fine, however in v4.0.2 there were added some changes into fable-library/Utils.ts (related to currying helpers) that causes the error.

Repro code

https://github.com/ArtemyB/Feliz.ReactHookForm/tree/b61d0a1e87859a19b586e33de8d277e45ec98a34

To run the app:

  1. pnpm install
  2. pnpm start

Expected and actual results

Expected result: app loads without any problems.

Actual result:: Uncaught SyntaxError: The requested module '/fable_modules/fable-library.4.0.2/Util.js' does not provide an export named 'curry1' is thrown on the app load, not allowing it to run.

Related information

  • Fable version: >= 4.0.2 & <= 4.1.3
  • Operating system: Windows 10 22H2
@alfonsogarciacaro
Copy link
Member

Thanks for the report. I think we can add a workaround for your case, although one "problem" is you're passing a function of arity-2 to an argument with arity-1 forcing it with a dynamic cast !! (ref). A better solution would be to wrap the function: onChange = fun v -> field.onChange null v. This way you don't get only the code to compile but you have better control of the actual behavior (not sure how that code was working so far).

It's true Fable should respect the type cast and don't try to curry/uncurry, but historically many Fable apps with dynamic bindings rely on Fable trying to make a guess on how function arguments must be uncurried so we are ignoring the type cast in these cases.

@ArtemyB
Copy link
Author

ArtemyB commented May 17, 2023

Ah, ok, makes sense. This is actually the code taken from the other repo and I haven't payed enough attention to it - just have noticed that it works on one Fable version and does not on the other. Thank you very much for the clarification of this detail of the !! operator, pretty sure this can be very helpful somewhere in the future, especially when writing bindings to 3rd-party libraries (like in the example provided above) 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants