import type { AtLeastOne } from "#types/type-helpers"; import { describe, it } from "node:test"; import { expectTypeOf } from "vitest"; type fakeObj = { foo: number; bar: string; baz: number | string; }; type optionalObj = { foo: number; bar: string; baz?: number | string; }; describe("AtLeastOne", () => { it("should accept an object with at least 1 of its defined parameters", () => { expectTypeOf<{ foo: number }>().toExtend>(); expectTypeOf<{ bar: string }>().toExtend>(); expectTypeOf<{ baz: number | string }>().toExtend>(); }); it("should convert to a partial intersection with the union of all individual single properties", () => { expectTypeOf>().branded.toEqualTypeOf< Partial & ({ foo: number } | { bar: string } | { baz: number | string }) >(); }); it("should treat optional properties as required", () => { expectTypeOf>().branded.toEqualTypeOf>(); }); it("should not accept empty objects, even if optional properties are present", () => { expectTypeOf>().not.toExtend>(); expectTypeOf>().not.toExtend>(); }); });