diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index c637eb41..30ec0855 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -2102,6 +2102,7 @@ extern "C" { // RegExp #[wasm_bindgen] extern { + #[wasm_bindgen(extends = Object)] #[derive(Clone, Debug)] pub type RegExp; diff --git a/crates/js-sys/tests/wasm/RegExp.rs b/crates/js-sys/tests/wasm/RegExp.rs index 842a0049..edaf5c92 100644 --- a/crates/js-sys/tests/wasm/RegExp.rs +++ b/crates/js-sys/tests/wasm/RegExp.rs @@ -1,6 +1,14 @@ use wasm_bindgen_test::*; +use wasm_bindgen::JsCast; use js_sys::*; +#[wasm_bindgen_test] +fn regexp_inheritance() { + let re = RegExp::new(".", ""); + assert!(re.is_instance_of::()); + assert!(re.is_instance_of::()); +} + #[wasm_bindgen_test] fn exec() { let re = RegExp::new("quick\\s(brown).+?(jumps)", "ig");