Skip to content

Commit

Permalink
fix: adjust meaning of asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
JanMalch committed Oct 30, 2020
1 parent cc16ac3 commit 32e4c67
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
/**
Expand All @@ -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;
```

Expand Down
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export function ensuresNonNullish<T>(
*/
export function asserts(
condition: boolean,
message = 'Failed Assertion'
message?: string
): asserts condition {
if (!condition) {
throw new AssertionError(message);
Expand Down

0 comments on commit 32e4c67

Please sign in to comment.