diff --git a/src/compareEachWith.ts b/src/compareEachWith.ts index bb71370..959ed1c 100644 --- a/src/compareEachWith.ts +++ b/src/compareEachWith.ts @@ -7,7 +7,7 @@ import type { MergeComparatorInputs } from "./private/types"; * Creates a comparator that compares iterables (e.g. arrays) in lexicographic * order. * - * You must provide a comparator (such as `naturalOrder`) for comparing + * You must provide a comparator (such as {@link naturalOrder}) for comparing * corresponding pairs of elements. You can provide multiple comparator * arguments, which are combined similarly to {@link compareWith}. * diff --git a/src/minmax.test.ts b/src/minmax.test.ts index e9a6ec5..597e543 100644 --- a/src/minmax.test.ts +++ b/src/minmax.test.ts @@ -11,7 +11,7 @@ describe("max", () => { expect(max(2, 3, 1)).toBe(3); }); - it("does not type-check with zero arguments", () => { + it("throws TypeError with zero arguments", () => { // @ts-expect-error expect(() => max()).toThrow(TypeError); }); @@ -26,7 +26,7 @@ describe("min", () => { expect(min(2, 1, 3)).toBe(1); }); - it("does not type-check with zero arguments", () => { + it("throws TypeError with zero arguments", () => { // @ts-expect-error expect(() => min()).toThrow(TypeError); }); diff --git a/src/minmax.ts b/src/minmax.ts index 4c12697..dae934e 100644 --- a/src/minmax.ts +++ b/src/minmax.ts @@ -11,6 +11,7 @@ import { naturalOrder } from "./comparators"; * * @param values values to compare * @returns the smallest value + * @throws {TypeError} thrown if `values` is empty */ export function min(values: T[]): T; @@ -44,6 +45,7 @@ export function min(...args: T[] | [T[]]): T { * * @param values values to compare * @returns the largest value + * @throws {TypeError} thrown if `values` is empty */ export function max(values: T[]): T; @@ -73,6 +75,7 @@ export function max(...args: T[] | [T[]]): T { * @param values the list of values to compare * @param comparator compares the values * @returns the smallest value + * @throws {TypeError} thrown if `values` is empty */ export function minWith(values: T[], comparator: Comparator): T { return values.reduce(minReducer(comparator)); @@ -84,6 +87,7 @@ export function minWith(values: T[], comparator: Comparator): T { * @param values the list of values to compare * @param comparator compares the values * @returns the largest value + * @throws {TypeError} thrown if `values` is empty */ export function maxWith(values: T[], comparator: Comparator): T { return values.reduce(maxReducer(comparator));