Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

304 B
Raw Blame
/* Copyright 2026 Marimo. All rights reserved. */
export function assertExists<T>(
  x: T | null | undefined,
  message?: string,
): asserts x is T {
  if (x === undefined || x === null) {
    if (message) {
      throw new Error(message);
    }
    throw new Error(`Expected value but got ${x}`);
  }
}