TypeScript is great, but I often feel like there are fundamental pieces missing. This document is my go-to when I need some re-ocurring feature.
Snippets are in Pulic Domain.
Separate array into two arrays based on filter
function partition<T>(array: T[], predicate: (element: T) => boolean): [T[], T[]] {