-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
Description
Motivation
From #1403 which added Object::constructor
property:
but the problem is that you can't do comparisons like
any_value.constructor() == Array::constructor_as_a_function_or_something_like_that()
because there is no method to get a constructor of a statically defined type.
These comparisons could be useful when one wants to check if particular value has particular type's constructor.
Proposed Solution
Add something like wasm_bindgen::get_constructor<T>() -> JsValue
that could be used on any imported type to get it as an actual value (the constructor itself).
Alternatives
Statically generate some method on each imported type?
Pauan