export default function nullThrows<T>(
  x: T | null | undefined,
  error: string | Error
): T {
  if (typeof x === "undefined" || x === null) {
    throw error instanceof Error ? error : new Error(error);
  }
  return x;
}
