Is it certain that `JsResult.severity` will always have only 'info', 'error' and (presumably) 'error'? I'd use a `switch` here with an `assert` in the `default` case.