From d30e85155fa302ad7a2cd575abe4542d240c22ef Mon Sep 17 00:00:00 2001 From: Ben Irvin Date: Fri, 17 Nov 2023 10:55:57 +0100 Subject: [PATCH] fix: Attribute.JSON type matches RFC 4627 (#18683) --- packages/core/types/src/types/core/attributes/json.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/core/types/src/types/core/attributes/json.ts b/packages/core/types/src/types/core/attributes/json.ts index e704de752a..e129ca02a0 100644 --- a/packages/core/types/src/types/core/attributes/json.ts +++ b/packages/core/types/src/types/core/attributes/json.ts @@ -9,6 +9,14 @@ export type JSON = Attribute.OfType<'json'> & Attribute.VisibleOption & Attribute.DefaultOption; -export type JsonValue = T; +type JSONValue = string | number | boolean | null | JSONObject | JSONArray; + +type JSONArray = Array; + +interface JSONObject { + [key: string]: JSONValue; +} + +export type JsonValue = T; export type GetJsonValue = T extends JSON ? JsonValue : never;