Skip to content

Commit

Permalink
feat: export ResourceTypes map from name to schema
Browse files Browse the repository at this point in the history
  • Loading branch information
invakid404 committed Nov 21, 2024
1 parent dead3df commit dead948
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/generator/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof ${typeSchemaName}>,`,
);
}
write("}");
};

export const resourceReferencesSchemaName = (resourceType: string) =>
Expand Down

0 comments on commit dead948

Please sign in to comment.