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
Automatic export of dependencies
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 correct import 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.
New handling of generic types
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!
Improved handling for enums
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.
Easier exports
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 the TS_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!
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Bumps ts-rs from 7.1.1 to 8.0.0.
Release notes
Sourced from ts-rs's releases.
... (truncated)
Commits
160b355
Release v8.0.0 (#270)7949a33
Merge pull request #271 from Aleph-Alpha/improve-type-asa1b8389
Merge pull request #269 from WilsonGramer/bound-attribute8da73ff
Fix typo in documentation for '#[ts(bound)]' attribute2453bfc
Add documentation for '#[ts(bound)]' attribute6cdaa0c
Use 'match' instead of 'map_or_else' in 'generate_impl_block_header'11b1824
Merge pull request #1 from Aleph-Alpha/bound-attribute2dad72e
add testf4c6e5e
allow any type, not just path, in#[ts(type_as = "..")]
c6f126e
Remove unnecessaryis_empty
checkDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show