trashposs/src/prelude/ensure.ts

8 lines
117 B
TypeScript
Raw Normal View History

export function ensure<T>(x: T): NonNullable<T> {
if (x == null) {
throw 'ぬるぽ';
} else {
return x!;
}
}