diff --git a/sdks/ts/src/utils/invariant.ts b/sdks/ts/src/utils/invariant.ts index a884df72f..eeeea7d9d 100644 --- a/sdks/ts/src/utils/invariant.ts +++ b/sdks/ts/src/utils/invariant.ts @@ -1,7 +1,13 @@ +/** + * Ensures that a condition is met, throwing a custom error message if not. + * @param condition The condition to test. If falsy, an error is thrown. + * @param message Optional. The error message to throw if the condition is not met. Defaults to "Invariant Violation". + */ export function invariant( condition: any, message: string = "Invariant Violation", ): void { + // Throw an error with the provided message if the condition is falsy if (!condition) { throw new Error(message); }