Closed aumetra closed 8 months ago
This PR is missing like 90% of all renames. So far from complete.
Will complete and clean it up once it is clear whether this would be accepted.
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.
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.
Great! Then I will check on how to sync the same crate name across all the different code paths
A few days ago I added a commit to add ::
before the ts_rs
path. Check out the changes in #267 to see all the places that will need updating
I'm open to adding this as well. 👍
Interestingly, this would come in handy in #276, allowing to #[derive(TS)]
within ts-rs
by using #[ts(crate = "")]
Oh, you got there before I did. Cool!
For a test, do you think introducing a separate test crate, such as ts-test-rename
would be sensible and then importing it as a dependency via
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
Oh, you got there before I did. Cool! For a test, do you think introducing a separate test crate, such as
ts-test-rename
would be sensible and then importing it as a dependency viats-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 e2e
directory. Checkout e2e/workspace
and e2e/dependencies
for examples of how to set this up
Great work guys, awesome!
I've taken the liberty to make crate_rename
private and replace its use with a getter, crate_rename() -> Path
. I didn't love that we had these unwrap()
s everywhere.
Interestingly, this would come in handy in https://github.com/Aleph-Alpha/ts-rs/pull/276, allowing to #[derive(TS)] within ts-rs by using #[ts(crate = "")]
While this doesn't allow #[ts(crate = "")]
, #[ts(crate = "crate")]
works perfectly fine.
Great work guys, awesome! I've taken the liberty to make
crate_rename
private and replace its use with a getter,crate_rename() -> Path
. I didn't love that we had theseunwrap()
s everywhere.
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)