How to type check a Date object in flow?
11,441
Thanks loganfsmyth and Nikita for the comments. It works as expected.
function diffDate (start: Date, end: Date) {
// ...
}
Related videos on Youtube
Author by
Aakash Sigdel
Mobile and Frontend developer with love for React and React-Native
Updated on June 04, 2022Comments
-
Aakash Sigdel almost 2 years
I have a function that takes a Date object as its paramater. I am not able to figure out how to annotate this.
function diffDate (start: any, end:any) { //.... }
start
andend
as Date objects?-
loganfsmyth over 7 yearsDoes
: Date
not work? -
Nikita over 7 yearsIt should because Flow comes with built-in definitions for Date class: github.com/facebook/flow/blob/master/lib/core.js#L364
-