2020-03-29 13:43:52 +00:00
|
|
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
|
|
|
|
|
|
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [mustExist](./js-utils.mustexist.md)
|
|
|
|
|
|
|
|
## mustExist() function
|
|
|
|
|
2021-07-10 21:54:41 +00:00
|
|
|
Assert that a variable is not `None` and return the value. Throw if it is `None`<!-- -->.
|
2020-03-29 13:43:52 +00:00
|
|
|
|
|
|
|
<b>Signature:</b>
|
|
|
|
|
|
|
|
```typescript
|
2021-07-10 21:54:41 +00:00
|
|
|
export declare function mustExist<T>(val: Maybe<T>, err?: string): T;
|
2020-03-29 13:43:52 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Parameters
|
|
|
|
|
|
|
|
| Parameter | Type | Description |
|
|
|
|
| --- | --- | --- |
|
2021-07-10 21:54:41 +00:00
|
|
|
| val | [Maybe](./js-utils.maybe.md)<!-- --><T> | |
|
|
|
|
| err | string | |
|
2020-03-29 13:43:52 +00:00
|
|
|
|
|
|
|
<b>Returns:</b>
|
|
|
|
|
2020-06-29 23:23:16 +00:00
|
|
|
T
|
2020-03-29 13:43:52 +00:00
|
|
|
|
|
|
|
val
|
|
|
|
|
|
|
|
## Exceptions
|
|
|
|
|
|
|
|
NotFoundError
|
|
|
|
|