( actual: T, msg?: string, )
| 19 | * @param msg The optional message to include in the error if the assertion fails. |
| 20 | */ |
| 21 | export function assertExists<T>( |
| 22 | actual: T, |
| 23 | msg?: string, |
| 24 | ): asserts actual is NonNullable<T> { |
| 25 | if (actual === undefined || actual === null) { |
| 26 | const msgSuffix = msg ? `: ${msg}` : "."; |
| 27 | msg = |
| 28 | `Expected actual: "${actual}" to not be null or undefined${msgSuffix}`; |
| 29 | throw new AssertionError(msg); |
| 30 | } |
| 31 | } |
no outgoing calls
no test coverage detected