Transfer from geelen/use-mcp

This commit is contained in:
Glen Maddern 2025-06-18 21:46:43 +10:00
commit de192f4de0

11
src/utils/assert.ts Normal file
View 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)
}
}