Skip to content

Commit 3697ddf

Browse files
authored
Merge pull request #723 from mstallmo/add-extends-to-js-sys
Add extends attributes for js_sys:Generator
2 parents a12fc46 + c543b5d commit 3697ddf

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

crates/js-sys/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,7 @@ impl Function {
885885
// Generator
886886
#[wasm_bindgen]
887887
extern {
888+
#[wasm_bindgen(extends = Object)]
888889
#[derive(Clone, Debug)]
889890
pub type Generator;
890891

crates/js-sys/tests/wasm/Generator.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use wasm_bindgen::prelude::*;
22
use wasm_bindgen_test::*;
3+
use wasm_bindgen::JsCast;
34
use js_sys::*;
45

56
#[wasm_bindgen(module = "tests/wasm/Generator.js")]
@@ -56,3 +57,10 @@ fn throw() {
5657
assert!(next.value().is_undefined());
5758
assert!(next.done());
5859
}
60+
61+
#[wasm_bindgen_test]
62+
fn generator_inheritance() {
63+
let gen = dummy_generator();
64+
65+
assert!(gen.is_instance_of::<Object>());
66+
}

0 commit comments

Comments
 (0)