Skip to content
This repository has been archived by the owner on Jun 19, 2022. It is now read-only.

Commit

Permalink
Modify assertAndReturn to please TS v4.4.0 (unreleased)
Browse files Browse the repository at this point in the history
Dtslint doesn't support not running against "next" [1], which means that
I can either temporarily remove type testing before publishing or fix
the method. The former would mean that the published version wouldn't
correspond to the tagged source code, which I don't enjoy.

[1] microsoft/dtslint#288
  • Loading branch information
badeball committed Jun 3, 2021
1 parent 5b8f9a0 commit fe6ab08
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/assertions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ export function assert(value: any, message?: string): asserts value {
}

export function assertAndReturn<T>(
value: T | false | null | undefined,
value: T,
message?: string
): T {
): Exclude<T, false | null | undefined> {
assert(value, message);
return value;
return value as Exclude<T, false | null | undefined>;
}

export function assertIsString(
Expand Down

0 comments on commit fe6ab08

Please sign in to comment.