Created
October 25, 2018 20:24
-
-
Save Nate-Wilkins/43a3bd7e93e54a8595d3140c282749bc to your computer and use it in GitHub Desktop.
FlowJS hackery to filter down arrays to specific types.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type A = { | |
a: number | |
}; | |
const myA: A = { a: 1 }; | |
const ac = [undefined, myA]; | |
const ba: $ReadOnlyArray<A> = ac.filter(Boolean); | |
const c = (justAs: $ReadOnlyArray<A>) => console.log(justAs); | |
c(ba); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment