(val: Value | null | undefined)
| 37 | } |
| 38 | |
| 39 | export function assertBoolean(val: Value | null | undefined): asserts val is VBool { |
| 40 | if (val == null) { |
| 41 | throw new AiScriptRuntimeError('Expect boolean, but got nothing.'); |
| 42 | } |
| 43 | if (!isBoolean(val)) { |
| 44 | throw new AiScriptRuntimeError(`Expect boolean, but got ${val.type}.`); |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | export function assertFunction(val: Value | null | undefined): asserts val is VFn { |
| 49 | if (val == null) { |
no test coverage detected