-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: type check
iterate
function (#256)
- Loading branch information
1 parent
d73c418
commit 295a3fc
Showing
1 changed file
with
19 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); | ||
}; |