Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.

Commit f2d92aa

Browse files
committed
show the generated JS for instanceof checks
1 parent 6c9b1cf commit f2d92aa

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

text/000-wasm-bindgen-inheritance-casting.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,15 @@ impl InstanceOf for Whatever {
175175
}
176176
```
177177

178+
`wasm-bindgen` will emit this JavaScript definition of
179+
`__wbindgen_instanceof_Whatever` that simply wraps the JS `instanceof` operator:
180+
181+
```js
182+
const __wbindgen_instanceof_Whatever = function (idx) {
183+
return getObject(idx) instanceof Whatever;
184+
};
185+
```
186+
178187
## Upcasting Implementation
179188

180189
For every `extends = MyBase` on a type imported with `extern type MyDerived`,

0 commit comments

Comments
 (0)