The following (simplified) code
type Category = {
id: string,
name: string,
};
type Option = {
id: string,
name: string,
isSelected: boolean,
};
const options = categories.map((c: Category): Option => ({
isSelected: true,
...c,
}));
produces the error:
Flow: Cannot spread object literal because Flow cannot determine a type for object literal [1].
Category
[2] is inexact, so it may containisSelected
with a type that conflicts withisSelected
's definition in object literal [1]. Try makingCategory
[2] exact.
What am I missing?