tsc:allowUnreachableCode, eslint:no-unreachable, assert->assertDev

This commit is contained in:
Jamie Kyle 2022-09-15 12:17:15 -07:00 committed by GitHub
parent f627a05cf8
commit eb10aafd7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
57 changed files with 213 additions and 176 deletions

View file

@ -22,7 +22,10 @@ export function softAssert(condition: unknown, message: string): void {
/**
* In production, logs an error and continues. In all other environments, throws an error.
*/
export function assert(condition: unknown, message: string): asserts condition {
export function assertDev(
condition: unknown,
message: string
): asserts condition {
if (!condition) {
const err = new Error(message);
if (getEnvironment() !== Environment.Production) {