我有以下功能
[@bs.obj]
external route:
(
~_method: string,
~path: string,
~action: list(string) => unit,
~options: Js.t({..})=?,
unit
) =>
_ =
"";
由于可以部分应用功能,我希望能够做到这一点:
let get = route(~_method="GET");
但它给了我这个错误:
This expression's type contains type variables that can't be generalized:
(~path: string, ~action: list(string) => unit, ~options: {_.. }=?,
unit) =>
{. "_method": string, "action": list(string) => unit,
"options": Js.undefined({.. }), "path": string}
我在这里做错了什么?