wasm-bindgen: wasm-bindgen-webidl doesn't seem to support typedefs

It appears that wasm_bindgen_webidl::compile_ast removes all typedefs via remove_undefined_imports, which prevents typedef bindings from being emitted. This occurs even when working with typedefs that directly reference defined types, such as:

typedef long MyInt;

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (17 by maintainers)

Most upvoted comments

Actually, I just noticed the following line:

This new name is not exposed by language bindings; it is purely used as a shorthand for referencing the type in the IDL.

So we should probably not be including these typedefs at all, but replacing all their appearances with their underlying type.

Actually, on a second review, it looks like the WebIDL spec doesn’t permit typedefs to reference each other, so we may be safe there. But TypeAlias::src is a syn::Type, not an Ident, so it looks like some interface refactoring may be necessary.