const normalizeError = <E extends any>(error: E): E | null =>
  hasValue(error || null) ? error : null;