|
|
|
|
|
by lhorie
2719 days ago
|
|
My point is mostly that you can get away with explicitly typing less things in flow and still get similar levels of coverage. For example, consider this example: export function formatTime(time: Date) {
return digitize(time.getHours()) + ':' + digitize(time.getMinutes());
}
function digitize(n) {
return ('0' + n.toStirng()).substring(-2);
}
Just a single type declaration is enough to let Flow catch the typo here. In TS, you'd also have to write the argument types for `digitize`. Importantly, if you wanted to explicitly add arg types for `digitize` w/ Flow, your editor can tell you what they are supposed to be. |
|