A function is translate to IIFE and cause f is not function error
import { createAtom } from "fable-core/Util";
import { getValue, defaultArg } from "fable-core/Option";
import { printf } from "fable-core/String";
export let lastModel = createAtom(null);
export const hasUpdate = defaultArg(defaultArg(lastModel(), null, function (a) {
return !(1 === a);
})/* function */, true);
replLog(printf("%A"))(hasUpdate);
let setInternalState = createAtom(null);
export function withReact() {
let lastModel_1 = null;
const setState_1 = function () {
if (setInternalState() == null) {
throw new Error("withReact init failed.");
} else {
const setState = getValue(setInternalState());
const hasUpdate_1 = defaultArg(defaultArg(lastModel_1, null, function (a) {
return !(1 === a);
}())/* IIFE */, true);
replLog(printf("%A"))(hasUpdate_1);
}
};
setState_1();
}
Function should alway be a function. :)
dotnet fable --version):1.3.0The linked code is working with latest REPL (based on Fable 1.3), can you please check again if it works with CLI version? Thanks!
@alfonsogarciacaro The linked code is not working, the generated code might not easy to read... I can confirm it's the same in dotnet-fable 1.3 with fable-splitter.

Here is the example that would cause f is not a function error: repl link
Ah, thanks! I got indeed confused by the code 😅 Interestingly the problem here was the inline local function. If you remove inline from notEqual it will work. In any case hopefully the problem should have been fixed with the commit linked above ☝️
@alfonsogarciacaro Thanks for your quick fix! Sorry that I should describe it more clear at first time, this problem makes me a little confused at that time. 🤦♂️
No worries, I know sometimes it's difficult to isolate the problem, but it does help a lot to have code without dependencies to reproduce the issue, thank you! 👍
Most helpful comment
Ah, thanks! I got indeed confused by the code 😅 Interestingly the problem here was the inline local function. If you remove
inlinefromnotEqualit will work. In any case hopefully the problem should have been fixed with the commit linked above ☝️