import type {HasRequiredKeys} from './has-required-keys'; import type {RequireAtLeastOne} from './require-at-least-one'; /** Represents an object with at least 1 non-optional key. This is useful when you need an object where all keys are optional, but there must be at least 1 key. @example ``` import type {NonEmptyObject} from 'type-fest'; type User = { name: string; surname: string; id: number; }; type UpdateRequest = NonEmptyObject>; const update1: UpdateRequest = { name: 'Alice', surname: 'Acme', }; // At least 1 key is required, therefore this will report a 2322 error: // Type '{}' is not assignable to type 'UpdateRequest' const update2: UpdateRequest = {}; ``` @see Use `IsEmptyObject` to check whether an object is empty. @category Object */ export type NonEmptyObject = HasRequiredKeys extends true ? T : RequireAtLeastOne;