export default function assertExists( x: T, msg = "Failed not-null assertion", ): Exclude { if (x === null || x === undefined) { throw new Error(msg); } return x as Exclude; }