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