Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(impls): add rust_decimal::Decimal impl #273

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. <br/> 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* |
Expand Down
4 changes: 4 additions & 0 deletions ts-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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 }
Expand Down
3 changes: 3 additions & 0 deletions ts-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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" }

Expand Down