Aleph-Alpha / ts-rs

Generate TypeScript bindings from Rust types
MIT License
989 stars 99 forks source link

Coerce passed type to TS before invoking ::name() #318

Closed paultag closed 1 month ago

paultag commented 1 month ago

If we're running the macro on a type which has an in-scope trait containing a ::name member, the compiler will not know which to invoke.

This clarifies that in the macro's context, we want to invoke the TS::name trait method by first casting the argument to the TS trait.

This pattern is in some other parts of the macro, I think this one wasn't triggered previously.

Goal

What is this PR attempting to achieve? Is it a bug fix? Is it related to an issue? Closes #

Changes

How did you go about solving the problem?

Checklist

NyxCode commented 1 month ago

Thanks, appreciate it!

paultag commented 1 month ago

@NyxCode Thank you! What a fast review and merge; and thank you very much for further fixing the general case! I really appreciate your work deeply!