You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
trying to figure the right way to get flow to recognise this code where I can pass in a Date or a moment
I cant use native js typeofs as far as I can tell.
Know I could just do moment(date).format(...) but while moment is pretty efficient here, feels like there should be a better way to tell flow that isMoment is (basically) a type checking function?
if(moment.isMoment(date)){
return date.format(this.props.displayFormat);
// call of method format Property not found in [LIB] core.js:166:1,214:1: Date
}else{
return moment(date, this.props.inputFormat).format(this.props.displayFormat);
}
The text was updated successfully, but these errors were encountered:
Yeah, this is on our minds too. We'd love a way to declare the refinements that a user space function might make to a type. Ideally you'd be able to declare something like
isMoment(x: any): xismoment{ ... }
which would tell Flow that if isMoment is true then the argument is a moment.
trying to figure the right way to get flow to recognise this code where I can pass in a Date or a moment
I cant use native js typeofs as far as I can tell.
Know I could just do moment(date).format(...) but while moment is pretty efficient here, feels like there should be a better way to tell flow that isMoment is (basically) a type checking function?
The text was updated successfully, but these errors were encountered: