typescript's type system is not flexible enough for me. Flow has gotten so good recently it's basically no contest anymore.
in this case, typeof Boolean is ~ (T) => T ? Where's the null coming from? Is T nullable?
-
-
JS: declare var arr: Array<?string> var arr2: Array<string> = arr.filter(Boolean)
-
You way of using generics would work fine if we were defining a filter function free-form. (think we’re getting too in the weeds)
-
I'm fine! So you have an Array<Option<T> | T> and you want to produce Array<T>?
-
yup. Easy with free form function. Harder with the .filter on the array prototype.
End of conversation
New conversation -
-
-
typeof Boolean means the function is literally the Boolean from js. and T could or could not be Nullable.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.