(val: Value | null | undefined)
| 55 | } |
| 56 | |
| 57 | export function assertString(val: Value | null | undefined): asserts val is VStr { |
| 58 | if (val == null) { |
| 59 | throw new AiScriptRuntimeError('Expect string, but got nothing.'); |
| 60 | } |
| 61 | if (!isString(val)) { |
| 62 | throw new AiScriptRuntimeError(`Expect string, but got ${val.type}.`); |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | export function assertNumber(val: Value | null | undefined): asserts val is VNum { |
| 67 | if (val == null) { |
no test coverage detected