From a9564800aa90efa911a8d5da50a61a7f5f67fff6 Mon Sep 17 00:00:00 2001 From: Moritz Bischof Date: Mon, 7 Oct 2024 14:47:15 +0200 Subject: [PATCH] include `null` in `serde_json::Value` --- ts-rs/src/serde_json.rs | 1 + ts-rs/tests/integration/serde_json.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) 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, \ };" ); }