2
流量与确切类型工作正常的情况下以下不相容:对象字面值。不精确类型与确切类型(没有对象扩散)
type Something={|a: string|};
const x1: Something = {a: '42'}; // Flow is happy
const x2: Something = {}; // Flow correctly detects problem
const x3: Something = {a: '42', b: 42}; // --------||---------
…但是流量也抱怨在以下几点:
type SomethingEmpty={||};
const x: SomethingEmpty = {};
消息是:
object literal. Inexact type is incompatible with exact type
,因为没有传播使用这是不一样的情况下this one。
经测试最新的0.57.3
。