[英]Flow [signature-verification-failure] for curried async function
我收到以下錯誤:
type Submit = {
form: any,
handleSubmit: FunctionType<any, any>,
...
}
Flow-IDE
Submit: type Submit = {
form: any,
handleSubmit: FunctionType < any,
any > ,
...
}
Cannot build a typed interface for this module. You should annotate the exports of this module with types. Missing type annotation at function return:Flow(signature-verification-failure)
Cannot build a typed interface for this module. You should annotate the exports of this module with types. Missing type annotation at function return: [signature-verification-failure] (index.js:31:11)flow
我有這個功能
type Submit = {
form: Object,
handleSubmit: FunctionType<Object, any> // this is our custom type, works fine
};
export const onClickSubmit = ({
form,
handleSubmit
}: Submit) => async (input: Object): Promise<any> => {
await handleSubmit(input);
form.reset();
};
突出顯示的區域是}: Submit)
the )
。
我不知道它要我做什么,在):
之后添加任何類型定義根本沒有幫助。
類型優先流程文檔中的示例提供的示例沒有幫助。 我不能像在他們的 module.exports 示例中那樣export functionName
具有特殊定義的 functionName。
你可以試試:
const onClickSubmit = ({
form,
handleSubmit
}: Submit) => async (input: Object): Promise<any> => {
await handleSubmit(input);
form.reset();
};
export onClickSubmit;
比我想象的要簡單,發布后馬上就明白了
type Submit = {
form: Object,
handleSubmit: FunctionType<Object, any>
};
const onClickSubmit = ({
form,
handleSubmit
}: Submit): FunctionType<Object, any> => async (input: Object): Promise<any> => {
await handleSubmit(input);
form.reset();
};
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.