export function deepClone(obj: T) { return JSON.parse(JSON.stringify(obj)); } export function ensure( obj: T, keys: Array<[keyof T][number]>, ) { return keys.every((k) => obj[k] !== undefined && obj[k] !== null); }