Skip to content

Can't use #[boa(from_js_with = "...")] or #[boa(into_js_with = "...")] when deriving both TryFromJs and TryIntoJs #5361

@mccolljr

Description

@mccolljr

Describe the bug

If I am deriving both TryFromJs and TryIntoJs, I can't use #[boa(from_js_with = "...")] or #[boa(into_js_with = "...")] as each macro complains about the other's annotation.

To Reproduce

This example code:

#[derive(TryFromJs, TryIntoJs)]
struct Blah {
    #[boa(into_js_with = "my_custom_converter_to_js")]
    #[boa(from_js_with = "my_custom_converter_from_js")]
    x: i32,
}

Results in two error messages:

invalid syntax in the #[boa()] attribute. Note that this attribute only accepts the following syntax: #[boa(from_js_with = "fully::qualified::path")]
invalid syntax in the #[boa()] attribute. Note that this attribute only accepts the following syntax:
#[boa(into_js_with = "fully::qualified::path")]
#[boa(rename = "jsPropertyName")]
#[boa(skip)] 

Expected behavior
I expected to be able to specify one or more custom conversion functions when deriving both TryIntoJs and TryFromJs on the same type.

Build environment:

  • OS: MacOS
  • Version: 15.7.3
  • Target triple: aarch64-apple-darwin
  • Rustc version: rustc 1.92.0 (ded5c06cf 2025-12-08)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions