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

Include null in serde_json::Value #359

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ts-rs/src/serde_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub enum TsJsonValue {
Boolean(bool),
Array(Vec<TsJsonValue>),
Object(HashMap<String, TsJsonValue>),
Null(()),
}

impl_shadow!(as TsJsonValue: impl TS for serde_json::Value);
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 | boolean | Array<JsonValue> | { [key in string]?: JsonValue };",
"type JsonValue = number | string | boolean | Array<JsonValue> | { [key in string]?: JsonValue } | null;",
);

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