Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/427.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 对于flowtype,是否有函数的类型_Javascript_Flowtype - Fatal编程技术网

Javascript 对于flowtype,是否有函数的类型

Javascript 对于flowtype,是否有函数的类型,javascript,flowtype,Javascript,Flowtype,假设我有一个函数 export const exampleFunc = (x: Object, y: string) : number => x[y] 是否有某种方法可以获取并重用exampleFunction类型。即 const anotherFunc : typeof exampleFunc = (x, y)=>x[y] 是,typeof可以与任何值一起用作状态 您添加的代码段是正确的方法,它写道: /* @flow */ const exampleFunc = (x: Ob

假设我有一个函数

export const exampleFunc = (x: Object, y: string) : number => x[y]
是否有某种方法可以获取并重用exampleFunction类型。即

const anotherFunc : typeof exampleFunc = (x, y)=>x[y]

是,
typeof
可以与任何值一起用作状态

您添加的代码段是正确的方法,它写道:

/* @flow */
const exampleFunc = (x: Object, y: string) : number => x[y] 
const anotherFunc: typeof exampleFunc = (x, y) => x[y]

在中,您将看到它是如何正确检出的(添加非法调用时,您将看到特定类型是如何强制执行的)。

是的,
typeof
可以与任何值一起用作状态

您添加的代码段是正确的方法,它写道:

/* @flow */
const exampleFunc = (x: Object, y: string) : number => x[y] 
const anotherFunc: typeof exampleFunc = (x, y) => x[y]
在中,您将看到它是如何正确检出的(添加非法调用时,您将看到特定类型是如何强制执行的)