Skip to content

Commit

Permalink
fix assertIsDefined
Browse files Browse the repository at this point in the history
  • Loading branch information
mdornseif committed Dec 26, 2021
1 parent 869d0b8 commit 8d4073e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,16 +362,17 @@ export function assertIsNotUndefined(
* @param additionalMessage further information on failure
* @throws {Error}
*/
export function assertIsDefined(
value: unknown,
export function assertIsDefined<T>(
value: T,
variableName?: string,
additionalMessage?: string
): asserts value is NonNullable<any> {
): asserts value is NonNullable<T> {
assert(
isDefined(value),
AssertionMessage(value, "defined", variableName, additionalMessage)
);
}

/**
* General assertion helper. Asserts the provided `condition` is met, if it is
* not, throws an Error with the provided `message`
Expand Down

0 comments on commit 8d4073e

Please sign in to comment.