-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
Description
Example:
/* @flow */
type Props = {
title: string;
age: number;
};
type WrapProps = $Diff<Props, {
age: number;
}>;
const Person = (props: Props) => {};
const YoungPerson = (props: WrapProps) => {
return Person({age: 21, ...props});
};
14: return Person({age: 21, ...props});
^ object literal. Expected object instead of
14: return Person({age: 21, ...props});
^ Props
However if i declare WrapProps
sub type manually, it works:
/* @flow */
type Props = {
title: string;
age: number;
};
/*type WrapProps = $Diff<Props, {
age: number;
}>;
*/
type WrapProps = {
title: string;
};
const Person = (props: Props) => {};
const YoungPerson = (props: WrapProps) => {
return Person({age: 21, ...props});
};
Seems like $Diff is not working correctly.