mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-05-18 13:49:39 +01:00
23 lines
464 B
JavaScript
23 lines
464 B
JavaScript
// Copyright 2025 Signal Messenger, LLC
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
// @ts-check
|
|
|
|
/**
|
|
* @param {boolean} condition
|
|
* @param {string} message
|
|
* @returns {asserts condition}
|
|
*/
|
|
export function assert(condition, message) {
|
|
if (!condition) {
|
|
throw new TypeError(message);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @param {never} value
|
|
* @returns {never}
|
|
*/
|
|
export function unreachable(value) {
|
|
throw new TypeError(`Expected case to be unreachable, found ${value}`);
|
|
}
|