1
0
Fork 0
js-utils/docs/api/js-utils.mustexist.md

32 lines
669 B
Markdown
Raw Normal View History

2020-03-29 13:43:52 +00:00
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [@apextoaster/js-utils](./js-utils.md) &gt; [mustExist](./js-utils.mustexist.md)
## mustExist() function
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
export declare function mustExist<T>(val: Maybe<T>, err?: string): T;
2020-03-29 13:43:52 +00:00
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| val | [Maybe](./js-utils.maybe.md)<!-- -->&lt;T&gt; | |
2022-10-08 19:52:35 +00:00
| err | string | <i>(Optional)</i> |
2020-03-29 13:43:52 +00:00
<b>Returns:</b>
T
2020-03-29 13:43:52 +00:00
val
## Exceptions
NotFoundError