Daily Shaarli

All links of one day in a single page.

December 1, 2022

Filtering undefined elements from an array in TypeScript | Ben Ilegbodu
const productIds = [123, 456, undefined, 789]
const products = productIds
  .map(getProduct)
  .filter((item): item is Product => item !== undefined)