1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-12-17 08:09:21 +09:00
misskey/src/prelude/ensure.ts

11 lines
265 B
TypeScript
Raw Normal View History

2019-04-13 14:45:51 +09:00
/**
* null undefined
*/
export function ensure<T>(x: T): NonNullable<T> {
if (x == null) {
2019-04-14 04:17:24 +09:00
throw new Error('ぬるぽ');
} else {
return x!;
}
}