From dead9481842b9224c3378d74d457545057d17f86 Mon Sep 17 00:00:00 2001 From: invakid404 Date: Thu, 21 Nov 2024 13:54:10 +0200 Subject: [PATCH] feat: export `ResourceTypes` map from name to schema --- src/generator/resources.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/generator/resources.ts b/src/generator/resources.ts index 53c2af6..cc25d7f 100644 --- a/src/generator/resources.ts +++ b/src/generator/resources.ts @@ -65,6 +65,15 @@ export const generateResources = async () => { } } write(`} as const));`); + + write("export type ResourceTypes = {"); + for (const resourceTypeName of [...resourcesByType.keys()].toSorted()) { + const typeSchemaName = resourceTypeSchemaName(resourceTypeName); + write( + `${JSON.stringify(resourceTypeName)}: z.infer,`, + ); + } + write("}"); }; export const resourceReferencesSchemaName = (resourceType: string) =>