mirror of
https://github.com/expo/eas-cli.git
synced 2026-11-15 17:31:46 -10:00
* upgrade typescript to 4.7.4 * [scripts] add extensions to imports * [scripts] configure as ESM * [scripts] fix after converting to ESM * [scripts] fix lint * [scripts] require node >= 14.16 * [scripts] add node: protocol * add scripts/build to .gitignore * [scripts] add typecheck script * add workflow for testing scripts * address PR feedback
10 lines
329 B
TypeScript
10 lines
329 B
TypeScript
export function nullthrows<T>(value: T | null | undefined, message?: string): T {
|
|
if (value !== null && value !== undefined) {
|
|
return value;
|
|
}
|
|
|
|
const error = new Error(message !== undefined ? message : `Got unexpected ${value}`);
|
|
(error as any).framesToPop = 1; // Skip nullthrows's own stack frame.
|
|
throw error;
|
|
}
|