(val: Value | null | undefined)
| 46 | } |
| 47 | |
| 48 | export function assertFunction(val: Value | null | undefined): asserts val is VFn { |
| 49 | if (val == null) { |
| 50 | throw new AiScriptRuntimeError('Expect function, but got nothing.'); |
| 51 | } |
| 52 | if (!isFunction(val)) { |
| 53 | throw new AiScriptRuntimeError(`Expect function, but got ${val.type}.`); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | export function assertString(val: Value | null | undefined): asserts val is VStr { |
| 58 | if (val == null) { |
no test coverage detected