I'm having difficulty referencing functions without parameters in Fable.
In this example:
let f1 () = 1 let someRefTof1 = f1
I expect the generated js to look something like this:
function f1() { return 1; } var someRefTof1 = f1;
but I really get:
function f1() { return 1; } var someRefTof1 = exports.someRefTof1 = function someRefTof1(arg00_) { return f1(arg00_); };
I do not understand the purpose of arg00_ or how to avoid it?
(Like a bit of background, I struggle to call a function in an external js library that expects the function to be passed as a parameter)
Edit:
Background
The above is what I consider to be a minimal, verifiable reproduction of my question, but after the comments, I thought it might be useful to provide more context on why this is causing the problems. What I'm actually trying to do is use angularjs from Fable.
So my example looks something like this:
let app = AngularFable.NgFable.angular.``module``("app",[||]) type TestCtrl() = member this.Val1() = "boom"; app?controller("test", TestCtrl)
which compiled for:
var app = exports.app = angular.module("app", []); var TestCtrl = exports.TestCtrl = function () { function TestCtrl() { _classCallCheck(this, TestCtrl); } TestCtrl.prototype.Val1 = function Val1() { return "boom"; }; return TestCtrl; }(); _fableCore.Util.setInterfaces(TestCtrl.prototype, [], "App.TestCtrl"); app.controller("test", function (unitVar) { return new TestCtrl(); });
with unitVar is the problematic parameter introduced in this example. When I use this in my html with something like:
<div ng-app="app"> <div ng-controller="test as vm"> {{vm.Val1()}} </div> </div>
I came across an unknown provider , whereas if I just changed the compiled javascript to remove the unitVar parameter from the last line like this
app.controller("test", function () { return new TestCtrl(); });
then my example works as expected.
I would really like to know if there is a way to avoid compiling Fable with this parameter. I am 99% sure that this comes down to the same problem as in my original question, but I included this additional context to better explain why this is a problem.