Reputation: 392
I want to get into the habit of properly flow typing everything. I have a few functions that I've typed such as below:
handleStartDateClick = (event: SyntheticEvent<HTMLElement>) => {
event.stopPropagation();
this.setState({ selectDate: SELECT_DATE.START });
};
handleEndDateClick = (event: SyntheticEvent<HTMLElement>) => {
event.stopPropagation();
this.setState({ selectDate: SELECT_DATE.END });
};
I'm a bit unsure what type for this function:
handleClearDates = (startDate, endDate) => (event) => {
event.stopPropagation();
if (startDate || endDate) {
this.props.client.writeData({
data: {
selectedDates: [],
},
});
this.setState(() => ({
selectDate: SELECT_DATE.START,
}));
} else {
this.handleDayPickerClose();
}
};
Any help/suggestions would be great!
Upvotes: 0
Views: 47
Reputation: 453
Consider asking in Flow's discord https://discord.gg/8ezwRUK
handleClearDates = (startDate: Date, endDate: Date) => (event: SyntheticEvent<>) => {
event.stopPropagation();
if (startDate || endDate) {
this.props.client.writeData({
data: {
selectedDates: [],
},
});
this.setState(() => ({
selectDate: SELECT_DATE.START,
}));
} else {
this.handleDayPickerClose();
}
};
Upvotes: 1