-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Description
/* @flow */
type Obj = {
a: number
} & {
b: string
};
function test(left: Obj, right: Obj) {
return Object.keys(left).find(k => {
switch (k) {
case 'b': return left[k] === right[k];
case 'a': return left[k] === right[k];
}
});
}
let left = { a: 1, b: 'x' };
let right = { a: 2, b: 'y' };
test(left, right);12: case 'b': return left[k] === right[k];
^ property `b`. Property not found in
3: type Obj = { ^ object type
12: case 'b': return left[k] === right[k];
^ property `b`. Property not found in
3: type Obj = { ^ object type
It works fine though if we switch case 'a' and case 'b':
...
case 'a': return left[k] === right[k];
case 'b': return left[k] === right[k];
...
Reactions are currently unavailable