export function assertNotNull(value: T | null): T { if (value === null) { throw new Error('Expected non-null value'); } return value; } export function assertNotUndefined(value: T | undefined): T { // eslint-disable-next-line no-undefined if (value === undefined) { throw new Error('Expected non-undefined value'); } return value; } /* eslint-disable @typescript-eslint/no-explicit-any */ type Constructor = { new (...args: any[]): T }; export function assertType(value: any, c: Constructor): T { if (value instanceof c) { return value; } throw new Error('Expected value of type'); } /* eslint-enable @typescript-eslint/no-explicit-any */