From 66f12ffa740dc085d5c52dd030d3627d43a884b4 Mon Sep 17 00:00:00 2001 From: Lucy Cifferello <12953208+elvece@users.noreply.github.com> Date: Mon, 30 Jan 2023 15:57:05 -0700 Subject: [PATCH] add wrapper type for optional description for unions --- types.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/types.ts b/types.ts index 0677ac7..65479eb 100644 --- a/types.ts +++ b/types.ts @@ -190,6 +190,14 @@ export type WithDescription = T & { warning?: string; }; +export type WithOptionalDescription = T & { + /** @deprecated - optional only for backwards compatibility */ + description?: string; + /** @deprecated - optional only for backwards compatibility */ + name?: string; + warning?: string; +}; + export type ListSpec = { spec: T; range: string; @@ -275,7 +283,7 @@ export type ValueSpecAny = > | Tag<"list", ValueSpecList> | Tag<"object", WithDescription>> - | Tag<"union", WithDescription>> + | Tag<"union", WithOptionalDescription>> | Tag< "pointer", WithDescription< @@ -318,9 +326,7 @@ export type ValueSpecUnion = { /** What tag for the specification, for tag unions */ tag: { id: string; - /** @deprecated - optional only for backwards compatibility */ - name?: string; - /** @deprecated - optional only for backwards compatibility */ + name: string; description?: string; "variant-names": { [key: string]: string;