diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index c21f7fdc..5d7a0d38 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -3203,6 +3203,14 @@ extern "C" { #[wasm_bindgen(method, js_name = toString)] pub fn to_string(this: &Symbol) -> JsString; + /// The Symbol.unscopables well-known symbol is used to specify an object + /// value of whose own and inherited property names are excluded from the + /// with environment bindings of the associated object. + /// + /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/unscopables + #[wasm_bindgen(static_method_of = Symbol, getter, structural)] + pub fn unscopables() -> Symbol; + /// The valueOf() method returns the primitive value of a Symbol object. /// /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/valueOf diff --git a/crates/js-sys/tests/wasm/Symbol.rs b/crates/js-sys/tests/wasm/Symbol.rs index a34a1ca2..876e1d88 100644 --- a/crates/js-sys/tests/wasm/Symbol.rs +++ b/crates/js-sys/tests/wasm/Symbol.rs @@ -99,6 +99,11 @@ fn to_string() { assert_eq!(gensym("desc".into()).to_string(), "Symbol(desc)"); } +#[wasm_bindgen_test] +fn unscopables() { + assert_eq!(Symbol::unscopables().to_string(), "Symbol(Symbol.unscopables)"); +} + #[wasm_bindgen_test] fn value_of() { let a = Symbol::for_("foo");