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

Fable generates javascript that throws an exception in the browser #4041

Open
klofberg opened this issue Feb 10, 2025 · 0 comments · May be fixed by #4044
Open

Fable generates javascript that throws an exception in the browser #4041

klofberg opened this issue Feb 10, 2025 · 0 comments · May be fixed by #4044

Comments

@klofberg
Copy link

Having a file named main.fsx with the following code and running dotnet fable:

type Model = unit

let update (model: Model) =
    model, ()

update ()

the fable compiler generates the following javascript:

export function update() {
    return [model, undefined];
}

update();

Running this code in the browser will throw an exception ReferenceError: model is not defined.

This is a problem for me in Elmish Land (https://elmish.land/docs/core-concepts/pages) where I scaffold elmish pages. The reason for the type alias for the Model is because I want to make it is easy for the user to extend the page.

I'm using fable compiler version 4.24.0 and dotnet version 9.0.101 on macos 15.0.

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.

1 participant