From 32e4c6787d3c63f3d77c9cdf17445bcdbf270d72 Mon Sep 17 00:00:00 2001 From: JanMalch <25508038+JanMalch@users.noreply.github.com> Date: Fri, 30 Oct 2020 11:14:59 +0100 Subject: [PATCH] fix: adjust meaning of asserts --- README.md | 4 ++-- index.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6b4f0a7..9eb225d 100644 --- a/README.md +++ b/README.md @@ -200,7 +200,7 @@ export function unreachable(_value: never): never; ### `asserts` -Use it for any other assertions, that don't quite fit the other contexts. +Use it to clarify, that something happened that you thought was impossible to happen. ```ts /** @@ -211,7 +211,7 @@ Use it for any other assertions, that don't quite fit the other contexts. */ export function asserts( condition: boolean, - message: string = 'Failed Assertion' + message?: string ): asserts condition; ``` diff --git a/index.ts b/index.ts index d280578..4d3b396 100644 --- a/index.ts +++ b/index.ts @@ -177,7 +177,7 @@ export function ensuresNonNullish( */ export function asserts( condition: boolean, - message = 'Failed Assertion' + message?: string ): asserts condition { if (!condition) { throw new AssertionError(message);