Why does wasm-bindgen allows invalid arguments to rust function from js

If I create a rust wasm_bindgen function that accepts an HtmlCanvasElement, why does it NOT fail when I pass a string instead?

Javascript:

(async () => {
    const demo = await import('./pkg/demo').catch(console.error);
    demo.setCanvas('Hello Element!');  
})();

Rust:

use wasm_bindgen::prelude::*;
use web_sys::{console, HtmlCanvasElement};

#[wasm_bindgen]
pub fn setCanvas(canvas: &HtmlCanvasElement) {
  //  Why does this even get here? I didn't pass in an HtmlCanvasElement
  console::log_1(&canvas);
}
1 Like

Not an official answer but likely along the line of being slow.
Bit of digging and you could at the start of the function call is_instance_of.
This my give insight; only glanced but contains "right enough" and bits on unsafe.