Converting Option<T[]> to T[] in Typescript
Quite often I have an
Option<T[]> that I want to convert to T[] (with an empty array in the None case). Using getOrElse(() => []) or a similar process with match means Typescript infers the type as T[] | never[], which causes issues down the line. Does anyone have any suggestions, other than manually specifying the types in getOrElse?