Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
7.1.1
->8.0.0
Release Notes
Aleph-Alpha/ts-rs (ts-rs)
v8.0.0
Compare Source
v8.0.0
After a lot of work and quite some time, we're happy to announce v8.0.0 of ts-rs. 🥳
Migration from
7.x.x
While this is a major release, we do expect that it's drop-in upgrade for most usecases.
However, if your setup is more involved (e.g interacting with the
TS
trait directly, doing post-processing on the output, etc.), some changes might be necessary.If you're having any trouble migrating, please feel free to open a discussion or issue, we're happy to help.
Highlights
If a struct or enum is annotated with
#[ts(export)]
, all of its dependencies will be exported automatically, even if they are not annotated with#[ts(export)]
. This behaviour is more convenient and always results in correctimport
statements.More importantly, this enables the use of ts-rs within libraries. Consumers of such a library will automatically get a copy of the types their types depend on.
Handling of generic types has been massively improved in this release. Not only is it way more robust than before, but we're also able to support all the edge-cases we couldn't before. For example, structs with trait bounds, generic type aliases and structs containing associated types are all supported now!
Support for enums and their different representations (internally tagged, externally tagged, untagged) has been massively improved in this release, thanks to @escritorio-gustavo!
In all these cases, ts-rs's behaviour matches more or less exactly with that of serde.
Exporting types is now much easier than before. For one, running
cargo test
now exports all dependencies of types annotated with#[ts(export)]
. The output directory can now be customized by setting theTS_RS_EXPORT_DIR
environment variable.For more complicated setups, where
#[ts(export)]
is not sufficient, we've reworked the API for exporting types from code.Acknowledgements
We've had a lot of new contributors since the last release!
I'm also excited to welcome @escritorio-gustavo as a new maintainer, who has been instrumental in making
8.0.0
happen!Breaking changes
type
instead ofìnterface
(#203)#[ts(export)]
, addTS::dependency_types()
(#221)annotate it with
#[ts(skip)]
TS::dependency_types()
(#221)TS::generics()
(#241)TS::WithoutGenerics
(#241)TS::transparent()
(#243)#[ts(export_to = "...")]
are now relative toTS_RS_EXPORT_DIR
, which defaults to./bindings/
TS::export
withTS::export
,TS::export_all
andTS::export_to_all
(#263)Features
#[ts(as = "..")]
(#174)Array<T>
(#209)#[ts(optional = nullable)]
(#213)semver-impl
cargo feature with support for the semver crate (#176)HashMap
with custom hashers (#173)import-esm
cargo feature to import files with a.js
extension (#192)#[ts(...)]
equivalents for#[serde(tag = "...")]
,#[serde(tag = "...", content = "...")]
and#[serde(untagged)]
(#227)#[serde(untagged)]
on individual enum variants (#226)#[serde(rename_all_fields = "...")]
(#225)Result
,Option
,HashMap
andVec
had their implementations ofTS
changed (#241)#[ts(...)]
equivalent for#[serde(tag = "...")]
being used on a struct with named fields (#244)#[ts(concrete(..))]
to specify a concrete type for a generic parameter (#264)#[ts(bound = "...")]
to manually override the generatedwhere
clause (#269)Fixes
#[ts(skip)]
and#[serde(skip)]
in variants of adjacently or internally tagged enums (#231)rename_all
withcamelCase
produces wrong names if fields were already in camelCase (#198)Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.