diff --git a/README.md b/README.md index 38cef8cc..e0198b96 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,7 @@ When running `cargo test`, the TypeScript bindings will be exported to the file | import-esm | When enabled,`import` statements in the generated file will have the `.js` extension in the end of the path to conform to the ES Modules spec.
Example: `import { MyStruct } from "./my_struct.js"` | | chrono-impl | Implement `TS` for types from *chrono* | | bigdecimal-impl | Implement `TS` for types from *bigdecimal* | +| rustdecimal-impl | Implement `TS` for types from *rust_decimal* | | url-impl | Implement `TS` for types from *url* | | uuid-impl | Implement `TS` for types from *uuid* | | bson-uuid-impl | Implement `TS` for types from *bson* | diff --git a/ts-rs/Cargo.toml b/ts-rs/Cargo.toml index 30352ee4..ca0cca9a 100644 --- a/ts-rs/Cargo.toml +++ b/ts-rs/Cargo.toml @@ -19,6 +19,7 @@ readme = "../README.md" [features] chrono-impl = ["chrono"] bigdecimal-impl = ["bigdecimal"] +rustdecimal-impl = ["rust_decimal"] uuid-impl = ["uuid"] bson-uuid-impl = ["bson"] bytes-impl = ["bytes"] @@ -45,6 +46,9 @@ chrono = { version = "0.4", optional = true } bigdecimal = { version = ">= 0.0.13, < 0.5", features = [ "serde", ], optional = true } +rust_decimal = { version = "1", features = [ + "serde-with-str", +], optional = true } uuid = { version = "1", optional = true } bson = { version = "2", optional = true } bytes = { version = "1", optional = true } diff --git a/ts-rs/src/lib.rs b/ts-rs/src/lib.rs index 69d6ed63..08b44563 100644 --- a/ts-rs/src/lib.rs +++ b/ts-rs/src/lib.rs @@ -960,6 +960,9 @@ impl_tuples!(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10); #[cfg(feature = "bigdecimal-impl")] impl_primitives! { bigdecimal::BigDecimal => "string" } +#[cfg(feature = "rustdecimal-impl")] +impl_primitives! { rust_decimal::Decimal => "string" } + #[cfg(feature = "uuid-impl")] impl_primitives! { uuid::Uuid => "string" }