我试图在我的寓言代码中导入节点模块。作为寓言新手,我确实期待这样的问题,理解进口流程似乎就是其中之一。我有以下代码编译正常,但在Cannot read property 'request' of undefined
语句的行上printfn
的运行时间失败
module Session =
let inline f (f: 'a->'b->'c->'d) = Func<_,_,_,_> f
[<Import("default","request")>]
type Http =
abstract request : string -> System.Func<obj,obj,obj,unit> -> unit
let http : Http = failwith "js only"
let start () =
http.request "http://dr.dk" (ff (fun error response body ->
printfn "%A" body
))
do
start()