mirror of
https://github.com/xazukx/ts-rs.git
synced 2026-08-23 12:58:33 +00:00
11 KiB
11 KiB
11.1.0
Features
- Add
#[ts(repr(enum))]attribute (#425) - Add support for
#[ts(optional_fields)]in enums and enum variants (#432) - Deprecate
import-esmcargo feature in favour ofRS_RS_IMPORT_EXTENSION(#423)
Fixes
- Fix bindings for
chrono::Duration(#434)
11.0.1
Fixes
- Fix usage of
#[ts(optional)]together with#[ts(type)]. (#416)
11.0.0
Breaking
#[serde(skip_serializing)]and#[serde(skip_serializing_if = ..)]are no longer ignored when used together with#[serde(default)]. (#393)- Changed return type of
TS::output_path()fromOption<&'static Path>toOption<PathBuf>. This will only break your code if you manually implementTSor directly interact with theTStrait. - Replaced
TS::DOCSwithTS::docs(). This will only break your code if you manually implementTSor directly interact with theTStrait. - Added
OptionInnerTypeassociated type to theTStrait. If you manually implementTS, you must set this associated type toSelfin all of your implementations. - Raised MSRV to
1.78.0due to use of#[diagnostic::on_unimplemented]andlet ... else { ... }
Features
- Add support for
#[serde(skip_serializing)]and#[serde(skip_serializing_if = ..)]when used together with#[serde(default)]. Since these fields might be absent(#393) - Add support for arbitrary expressions in doc attributes, e.g
#[doc = concat!("defined in ", file!())]. This would result both in a rustdoc and JSDoc comment. - The
#[ts(rename)]attribute on structs, enums and variants now accepts any expression. This makes it possible to, for example, rename a struct to the name of a module it is contained in using#[ts(rename = module_path!().rsplit_once("::").unwrap().1)] - The
#[ts(export_to)]attribute on structs and enums now accepts any expression. - Added
#[ts(optional_fields)]and#[ts(optional_fields = nullable)]attribute to structs, this attribute is equivalent to using the corresponding#[ts(optional)]or#[ts(optional = nullable)]on every field of the struct. (#366)
Fixes
- Fix
#[ts(optional)]error when using a type alias forOptionor fully qualifying it ascore::option::Option(#366) - Fix missing import statements when using
#[ts(as = "...")]at the top level of a struct/enum (#385) - Fix missing
inline_flattenedimplementation forHashMap
10.1.0
Features
- Add support for synchronization primitives from
tokio(featuretokio-impl)
Fixes
- Fix incorrect behavior of the tag attribute for structs without any fields declared with braces
- Fix representation of
serde_json::Value
10.0.0
Breaking
- Change how
HashMap<K, V>is represented in TypeScript. The resulting bindings ({ [key in K]?: V }instead of{ [key: K]: V }) are more accurate and flexible.
Features
- Allow multile types to have the same
#[ts(export_to = "...")]attribute and be exported to the same file (#316) - The
bson-uuid-implfeature now supportsbson::oid::ObjectIdas well (#340) - Add support for types from
smol_strbehind cargo featuresmol_str-impl(#350) - Support
#[ts(as = "...")]and#[ts(type = "...")]on enum variants (#384)
Fixes
- Properly handle block doc comments (#342)
- Fix error in internally tagged enums with flattened fields (#344)
- Always use forward slash on import paths (#346)
9.0.1
Fixes
- Allow using
#[ts(flatten)]on fields using generic parameters (#336)
9.0.0
Breaking
#[serde(with = "...")]requires the use of#[ts(as = "...")]or#[ts(type = "...")](#280)- Fix incompatibility with serde for
snake_case,kebab-caseandSCREAMING_SNAKE_CASE(#298) #[ts(rename_all = "...")]no longer accepts variations in the string's casing, dashes and underscores to make behavior consistent with serde (#298)- Remove
TypeList, and replaceTS::dependency_types/TS::genericswithTS::visit_dependencies/TS::visit_generics. This finally resolves "overflow evaluating the requirement", "reached the recursion limit" errors. Also, compile times should benefit. This is a technically breaking change for those interacting with theTStrait directly. For those just using#[derive(TS)]and#[ts(...)], nothing changes!
Features
- Add support for
#[ts(type = "..")]directly on structs and enums (#286) - Add support for
#[ts(as = "..")]directly on structs and enums (#288) - Add support for
#[ts(rename_all = "SCREAMING-KEBAB-CASE")](#298) - Support
_in#[ts(type = "..")]to refer to the type of the field (#299)
Fixes
- Fix
#[ts(rename_all_fields = "...")]on enums containing tuple or unit variants (#287) - Fix "overflow evaluating the requirement" and "reached the recursion limit" errors in some cases (#293)
- Fix ambiguity causing "multiple applicable items in scope" errors in some cases (#309)
- Fix issues with absolute
TS_RS_EXPORT_DIRpaths (#323) - Add newlines to the end of exported files (#321)
8.1.0
Breaking
Features
- Add
#[ts(crate = "..")]to allow usage of#[derive(TS)]from other proc-macro crates (#274) - Add support types from
serde_jsonbehind cargo featureserde-json-impl(#276)
Fixes
- Macro expansion for types with generic parameters now works without the
TStrait in scope (#281) - Fix enum flattening a struct that contains a flattened enum (#282)
v8.0.0
Breaking
- Export types as
typeinstead ofìnterface(#203) - Automatically export all dependencies when using
#[ts(export)], addTS::dependency_types()(#221) - Remove support for "skip_serializing", "skip_serializing_if" and "skip_deserializing". (#204)
- Initially supporting these by skipping a field was a mistake. If a user wishes to skip a field, they can still
annotate it with
#[ts(skip)]
- Initially supporting these by skipping a field was a mistake. If a user wishes to skip a field, they can still
annotate it with
- Added
TS::dependency_types()(#221) - Added
TS::generics()(#241) - Added
TS::WithoutGenerics(#241) - Removed
TS::transparent()(#243) - Handling of output paths (#247, #250, #256)
- All paths specified using
#[ts(export_to = "...")]are now relative toTS_RS_EXPORT_DIR, which defaults to./bindings/
- All paths specified using
- Replace
TS::exportwithTS::export,TS::export_allandTS::export_to_all(#263)
Features
- Implement
#[ts(as = "..")](#174) - For small arrays, generate tuples instead of
Array<T>(#209) - Implement
#[ts(optional = nullable)](#213) - Allow inlining of fields with generic types (#212, #215, #216)
- Allow flattening enum fields (#206)
- Add
semver-implcargo feature with support for the semver crate (#176) - Support
HashMapwith custom hashers (#173) - Add
import-esmcargo feature to import files with a.jsextension (#192) - Implement
#[ts(...)]equivalents for#[serde(tag = "...")],#[serde(tag = "...", content = "...")]and#[serde(untagged)](#227) - Support
#[serde(untagged)]on individual enum variants (#226) - Support for
#[serde(rename_all_fields = "...")](#225) - Export Rust doc comments/attributes on structs/enums as TSDoc strings (#187)
Result,Option,HashMapandVechad their implementations ofTSchanged (#241)- Implement
#[ts(...)]equivalent for#[serde(tag = "...")]being used on a struct with named fields (#244) - Implement
#[ts(concrete(..))]to specify a concrete type for a generic parameter (#264)
Fixes
- Fix
#[ts(skip)]and#[serde(skip)]in variants of adjacently or internally tagged enums (#231) rename_allwithcamelCaseproduces wrong names if fields were already in camelCase (#198)- Improve support for references (#199)
- Generic type aliases generate correctly (#233)
- Improve compiler errors (#257)
- Update dependencies (#255)