type RequireAtLeastOne = Pick> & { [K in Keys]-?: Required> & Partial>>; }[Keys]; interface UserSearchCriteria { id?: string; email?: string; username?: string; isActive?: boolean; role?: 'admin' | 'user'; } // Example Usage: // Requires at least one of 'id', 'email', or 'username' type ValidUserSearch = RequireAtLeastOne; const searchById: ValidUserSearch = { id: '123' }; const searchByEmail: ValidUserSearch = { email: 'test@example.com', isActive: true }; const searchByUsernameAndId: ValidUserSearch = { username: 'john_doe', id: '456' }; const searchAll: ValidUserSearch = { id: '789', email: 'all@example.com', username: 'allusers', isActive: false, role: 'user' }; // Invalid: must have at least one of 'id', 'email', or 'username' // const invalidSearch: ValidUserSearch = { isActive: true, role: 'admin' }; // Error // Property 'id' is missing in type '{ isActive: boolean; role: "admin"; }' but required in type '{ id: string; } & Partial>'... // You can also omit the second generic argument to require at least one of *any* key type AtLeastOneOfAny = RequireAtLeastOne; const anotherValidSearch: AtLeastOneOfAny = { isActive: true }; // const anotherInvalidSearch: AtLeastOneOfAny = {}; // Error: Type '{}' is not assignable to type 'RequireAtLeastOne'