Reputation: 3592
import type {crusherDowntimeRecord} from "./downtime/types";
type Props = {
data: Array<crusherDowntimeRecord>,
};
type State = {
rows: Props.data,
};
On Props.data
Flow throws:
Error:(30, 15) Cannot get Props.data because property data is missing in Props [1].
What's wrong?
Upvotes: 1
Views: 74
Reputation: 2394
You can't access data
through Props
because it's type
, not javascript object
.
For solution use flow $PropertyType
:
import type {CrusherDowntimeRecord} from "./downtime/types";
type Props = {
data: Array<CrusherDowntimeRecord>,
};
type State = {
rows: $PropertyType<Props, 'data'>,
};
Upvotes: 1