import { IdentityContext } from './identity'; export function ensureIdentity( identity: IdentityContext['identity'] ): asserts identity is NonNullable { if (identity == null) throw new Error('Unauthorized.'); }