Transfer from geelen/use-mcp
This commit is contained in:
parent
d1d7803d9a
commit
de192f4de0
1 changed files with 9512 additions and 136 deletions
11
src/utils/assert.ts
Normal file
11
src/utils/assert.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* Asserts that a condition is true, throwing an error if not.
|
||||
* Useful for type narrowing.
|
||||
* @param condition The condition to check.
|
||||
* @param message The error message to throw if the condition is false.
|
||||
*/
|
||||
export function assert(condition: unknown, message: string): asserts condition {
|
||||
if (!condition) {
|
||||
throw new Error(message)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue