-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to rename source of TS
trait
#274
Conversation
This PR is missing like 90% of all renames. So far from complete. |
Hey, thanks for the PR! I've left a couple of changes I'd like to see here, apart from those, I don't see an issue with adding this feature. |
Great! Then I will check on how to sync the same crate name across all the different code paths and will take care of your requested changes. |
A few days ago I added a commit to add |
I'm open to adding this as well. 👍 |
Interestingly, this would come in handy in #276, allowing to |
Oh, you got there before I did. Cool! ts-rename = { package = "ts-rs", path = "../ts-rs" } That way you can be 100% sure the rename code works. The test I made is a bit.. lackluster |
This is a very good idea! You can do that inside the |
Great work guys, awesome! |
While this doesn't allow |
Nice! I didn't like having so many unwraps either, glad to see them gone! |
Goal
The goal of this PR is to provide an option which allows for re-exports of the
ts_rs::TS
trait.Similar to serde's
#[serde(crate = "other_serde")]
attribute.Motivation is us evaluating
ts-rs
for generating TypeScript types directly without an intermediate JSON Schema step. We generate the derive annotations via an own procedural macro, which is why we need to re-export the crate.Changes
This PR introduces the new
crate_rename
attribute to the derive macro.The invocation looks similar to this:
Checklist
(Will add the documentation if this is actually a feature that would be accepted)