Skip to content

Commit

Permalink
test: type check iterate function (#256)
Browse files Browse the repository at this point in the history
  • Loading branch information
ignatiusmb authored Aug 6, 2024
1 parent d73c418 commit 295a3fc
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions workspace/mauss/src/std/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
import { augment } from './index.js';
import { augment, iterate } from './index.js';

augment<{}>({});
declare function expect<T>(v: T): void;

// ---- errors ----
(/* augment */) => {
augment<{}>({});

// @ts-expect-error - error on empty argument
augment();
// @ts-expect-error - error on non-object type
augment(null);
// ---- errors ----

// @ts-expect-error - error on empty argument
augment();
// @ts-expect-error - error on non-object type
augment(null);
};

(/* iterate */) => {
iterate({ a: 1, b: 2 }, ([k, v], i) => {
expect<'a' | 'b'>(k);
expect<number>(v);
expect<number>(i);
});
};

0 comments on commit 295a3fc

Please sign in to comment.