Skip to content

bug: ts(optional_fields) does not compile with generic parameters #476

@goldrushx21

Description

@goldrushx21

Describe the bug

error[E0277]: the trait bound `<T as TS>::OptionInnerType: TS` is not satisfied
  --> src/mypackage/src/lib.rs:1:10
   |
11 | #[derive(ts_rs::TS)]
   |          ^^^^^^^^^ the trait `TS` is not implemented for `<T as TS>::OptionInnerType`
   |
   = note: this error originates in the derive macro `ts_rs::TS` (in Nightly builds, run with -Z macro-backtrace for more info)

To Reproduce

#[derive(ts_rs::TS)]
#[ts(optional_fields)]
pub enum MyEnum<T> {
    MyVariant { my_field: T },
}

Expected behavior
No compiler errors

Screenshots

Version
v12.0.0

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions