Skip to content

Commit 973ac74

Browse files
feat(base): assertion function type guard (#2)
1 parent a83ef8d commit 973ac74

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/base.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
export const assert = (condition: boolean, ...infos: any[]) => { if (!condition) throw new Error(...infos) }
1+
export const assert = (condition: boolean, message: string): asserts condition => {
2+
if (!condition) throw new Error(message)
3+
}
24
export const toString = Object.prototype.toString
35
export const noop = () => {}

0 commit comments

Comments
 (0)