From 900aefc65dae264d5d27b50a83eeb0e26341fc91 Mon Sep 17 00:00:00 2001 From: darthmaim Date: Mon, 22 Jul 2024 22:52:15 +0200 Subject: [PATCH] Fix type resolution for undefined schema --- .changeset/red-hornets-help.md | 5 +++++ packages/types/data/account.ts | 1 + packages/types/data/item.ts | 1 + packages/types/data/tokeninfo.ts | 1 + 4 files changed, 8 insertions(+) create mode 100644 .changeset/red-hornets-help.md diff --git a/.changeset/red-hornets-help.md b/.changeset/red-hornets-help.md new file mode 100644 index 0000000..6ed7456 --- /dev/null +++ b/.changeset/red-hornets-help.md @@ -0,0 +1,5 @@ +--- +"@gw2api/types": patch +--- + +Fix type resolution for undefined schema diff --git a/packages/types/data/account.ts b/packages/types/data/account.ts index cd99522..d2e86ce 100644 --- a/packages/types/data/account.ts +++ b/packages/types/data/account.ts @@ -1,6 +1,7 @@ import type { SchemaAfter, SchemaVersion } from "../schema"; export type Account = + Schema extends undefined ? AccountBase : Schema extends SchemaAfter<'2019-12-19T00:00:00.000Z'> | 'latest' ? Account_2019_12_19 : Schema extends SchemaAfter<'2019-02-21T00:00:00.000Z'> ? Account_2019_02_21 : AccountBase; diff --git a/packages/types/data/item.ts b/packages/types/data/item.ts index f025740..0a0482b 100644 --- a/packages/types/data/item.ts +++ b/packages/types/data/item.ts @@ -1,6 +1,7 @@ import type { SchemaAfter, SchemaVersion } from "../schema"; export type Item = + Schema extends undefined ? ItemBase : Schema extends SchemaAfter<'2020-11-17T00:30:00.000Z'> | 'latest' ? Item_2020_11_17 : ItemBase; diff --git a/packages/types/data/tokeninfo.ts b/packages/types/data/tokeninfo.ts index 5064162..144fe7b 100644 --- a/packages/types/data/tokeninfo.ts +++ b/packages/types/data/tokeninfo.ts @@ -1,6 +1,7 @@ import type { SchemaAfter, SchemaVersion } from "../schema"; export type Tokeninfo = + Schema extends undefined ? TokeninfoBase : Schema extends SchemaAfter<'2019-05-22T00:00:00.000Z'> | 'latest' ? Tokeninfo_2019_05_22 : TokeninfoBase;