真的厌倦了尝试定义F#和Fable理解然后试图调用它的类型 .
现在我创建了一个名为JSI.js的JavaScript文件:
/**
* JavaScipt Interop to call complex JavaScipt library methods
* where I have no clue how to define the type for in F#/Fable
*/
define(["exports","redux"],function(exports,Redux){
exports.createStore =
(fn)=>
(initialStore)=>{
return Redux.createStore(
(action,state)=>fn(action)(state)
,initialStore
);
}
});
然后在main.fsx中:
[]
module JSI =
let createStore:
(
(AppController.ApplicationModel -> Action -> AppController.ApplicationModel)
-> AppController.ApplicationModel
-> int
) = jsNative
let store =
JSI.createStore
applicationHandler
AppController.defaultModel
这将把F#部分应用的函数包装/解包到具有Redux使用的多个参数的东西 .