From c29ca56658579d7dd3f9d40a281a51ae1e8d2c1f Mon Sep 17 00:00:00 2001 From: David Lechner Date: Wed, 6 Apr 2022 18:16:21 -0500 Subject: [PATCH] utils: fix defined() NonNullable means both not undefined and not null. --- src/utils/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/index.ts b/src/utils/index.ts index 23c8297b..c1d8094e 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -20,6 +20,7 @@ export function assert(condition: boolean, message: string): asserts condition { */ export function defined(obj: T): asserts obj is NonNullable { assert(obj !== undefined, 'undefined object'); + assert(obj !== null, 'null object'); } export type Maybe = [T?, Error?];