2017-06-03 29 views
0

我试图定义一个函数签名flow。我期望以下代码抛出一个错误但我没有得到任何错误呢?流程和函数定义

// function that applied a function to an array - just for numbers 
const arrayMath = (func:() => number, arr: Array<number>):Array<Number> => arr.map(func); 

// would expect this function to work OK with arrayMath 
const square = (num: number): number => num * num; 

// would expect this function to fail with arrayMath 
const concatX = (str: string): string => `${str}X`; 

// flow is not giving me an error here.. 
arrayMath(concatX, [1, 2, 3]); 
+4

试着在这里执行代码https://flow.org/try/ – Kasiriveni

回答