diff --git a/ts-rs/src/serde_json.rs b/ts-rs/src/serde_json.rs index a1367bcc..0f9df431 100644 --- a/ts-rs/src/serde_json.rs +++ b/ts-rs/src/serde_json.rs @@ -15,6 +15,7 @@ pub enum TsJsonValue { Boolean(bool), Array(Vec), Object(HashMap), + Null(()), } impl_shadow!(as TsJsonValue: impl TS for serde_json::Value); diff --git a/ts-rs/tests/integration/serde_json.rs b/ts-rs/tests/integration/serde_json.rs index 7b130d42..6c68b8ae 100644 --- a/ts-rs/tests/integration/serde_json.rs +++ b/ts-rs/tests/integration/serde_json.rs @@ -24,7 +24,7 @@ fn using_serde_json() { ); assert_eq!( serde_json::Value::decl(), - "type JsonValue = number | string | boolean | Array | { [key in string]?: JsonValue };", + "type JsonValue = number | string | boolean | Array | { [key in string]?: JsonValue } | null;", ); assert_eq!( @@ -53,7 +53,7 @@ fn inlined_value() { assert_eq!( InlinedValue::decl(), "type InlinedValue = { \ - any: number | string | boolean | Array | { [key in string]?: JsonValue }, \ + any: number | string | boolean | Array | { [key in string]?: JsonValue } | null, \ };" ); }