js-on-sx: Boolean.prototype.toString/valueOf throw TypeError on non-Boolean
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 21s

This commit is contained in:
2026-05-09 19:41:24 +00:00
parent d4be87166b
commit f256132eb3
2 changed files with 14 additions and 9 deletions

View File

@@ -4562,12 +4562,13 @@
(&rest args)
(let
((this-val (js-this)))
(if
(and
(= (type-of this-val) "dict")
(contains? (keys this-val) "__js_boolean_value__"))
(get this-val "__js_boolean_value__")
this-val))))
(cond
((= (type-of this-val) "boolean") this-val)
((and
(= (type-of this-val) "dict")
(contains? (keys this-val) "__js_boolean_value__"))
(get this-val "__js_boolean_value__"))
(else (raise (js-new-call TypeError (js-args "Boolean.prototype.valueOf requires a Boolean"))))))))
(dict-set!
(get Boolean "prototype")
@@ -4576,9 +4577,11 @@
(&rest args)
(let
((this-val (js-this)))
(let
((b (if (and (= (type-of this-val) "dict") (contains? (keys this-val) "__js_boolean_value__")) (get this-val "__js_boolean_value__") this-val)))
(if b "true" "false")))))
(cond
((= (type-of this-val) "boolean") (if this-val "true" "false"))
((and (= (type-of this-val) "dict") (contains? (keys this-val) "__js_boolean_value__"))
(if (get this-val "__js_boolean_value__") "true" "false"))
(else (raise (js-new-call TypeError (js-args "Boolean.prototype.toString requires a Boolean"))))))))
(define
parseInt