arktypea
arktype12mo ago
Alan

Filtering Array<unknown> to a type?

Is this the best way to filter an Array of
unknown
to an ark type?:

type transaction = type(...);
const items: unknown[] = ...;
const transactions = items
  .filter(transaction.allows)
  .map(transaction);

I don't need to throw when something in items doesn't match. I just want to filter.
Was this page helpful?