externref
externref copied to clipboard
Type aliases are not getting transformed
Bug report
When creating type alias from resource, eg:
pub struct Bar(Resource<...>);
And using that type in function, eg:
#[externref]
extern "C" {
fn imported_function() -> Bar;
}
After transformed, the imported function return type is not changed to externref, but is i32.
There is a good reason to use type alias for Resource type. Many times it is needed to implement custom drop trait for externref, to free resources which javascript object is holding (in my project is is to call "destroy()" on webgpu buffers). Custom drop trait is not possible to add to the type that crate does not own. Being able to create type alias, allows the drop being implemented for resource.
If there is some other way to add drop trait for a Resource, then this bug does not need be solved.