Skip to content

Instantly share code, notes, and snippets.

@waptik
Created May 9, 2026 22:33
Show Gist options
  • Select an option

  • Save waptik/820b48d924addd9438eccf4e2c035aea to your computer and use it in GitHub Desktop.

Select an option

Save waptik/820b48d924addd9438eccf4e2c035aea to your computer and use it in GitHub Desktop.
utils
// https://github.com/expo/eas-cli/blob/main/packages/steps/src/utils/nullthrows.ts
export function nullthrows<T>(value: T | null | undefined, message?: string): NonNullable<T> {
if (value != null) {
return value;
}
throw new TypeError(message ?? `Expected value not to be null or undefined but got ${value}`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment