type EmptyValue = | undefined | null | '' | 0 | false | never[] | Record; // checks if value is Falsy, // including empty arrays or objects const isEmpty = (value: T): value is Extract => { if (Array.isArray(value)) return !value.length; if (typeof value === 'object') return !value || !Object.keys(value).length; return !value; }; export default isEmpty;