const recordsById: {
      [id: string]: Record<T>;
    } = records
      .filter((record): record is Record<T> => !!record)
      .map(record => ({