FlowJS - 数字......与字符串不兼容

FlowJS - number ... is incompatible with string

有人可以解释为什么我使用此代码会出现以下 FlowJS 错误吗?

number 1 is incompatible with string [2]

(the white box around number indicates the flow error)

如果我删除最后一个 map(),流程错误就会消失:

function splitKey(key: string | Array<string | number>): Array<any> {
  const arr = typeof key === 'string' ? key.split('.') : key;
  return arr.length === 1 && arr[0] === '' ? [] : arr;
}

更奇怪的是,如果我将值映射到自身 (map(k => k)),它会触发错误。在这种情况下混淆 Flow 的映射值是什么?

function splitKey(key: string | Array<string | number>): Array<any> {
  const arr = typeof key === 'string' ? key.split('.') : key;
  return arr.length === 1 && arr[0] === '' ? [] : arr.map(k => k);
}

感谢 flow's playground 我们可以看到此错误出现在 0.83.0 中,但在 0.84.0 中消失了

不幸的是,我在 release notes 中没有看到与此问题相关的任何内容,因此根本原因仍然未知。