Skip to content

Commit

Permalink
feat(serde-json-impl): handle bool for serde_json::Value (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeDecMeetsMore authored Oct 7, 2024
1 parent a05cd36 commit 51a7a87
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions ts-rs/src/serde_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use super::{impl_primitives, impl_shadow, TS};
pub enum TsJsonValue {
Number(i32),
String(String),
Boolean(bool),
Array(Vec<TsJsonValue>),
Object(HashMap<String, TsJsonValue>),
}
Expand Down
4 changes: 2 additions & 2 deletions ts-rs/tests/integration/serde_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn using_serde_json() {
);
assert_eq!(
serde_json::Value::decl(),
"type JsonValue = number | string | Array<JsonValue> | { [key in string]?: JsonValue };",
"type JsonValue = number | string | boolean | Array<JsonValue> | { [key in string]?: JsonValue };",
);

assert_eq!(
Expand Down Expand Up @@ -53,7 +53,7 @@ fn inlined_value() {
assert_eq!(
InlinedValue::decl(),
"type InlinedValue = { \
any: number | string | Array<JsonValue> | { [key in string]?: JsonValue }, \
any: number | string | boolean | Array<JsonValue> | { [key in string]?: JsonValue }, \
};"
);
}
Expand Down

0 comments on commit 51a7a87

Please sign in to comment.