( value: unknown, struct: Struct<T, S>, message?: string )
| 121 | */ |
| 122 | |
| 123 | export function assert<T, S>( |
| 124 | value: unknown, |
| 125 | struct: Struct<T, S>, |
| 126 | message?: string |
| 127 | ): asserts value is T { |
| 128 | const result = validate(value, struct, { message }) |
| 129 | |
| 130 | if (result[0]) { |
| 131 | throw result[0] |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | /** |
| 136 | * Create a value with the coercion logic of struct and validate it. |
no test coverage detected