Huginn/src/document.ts

13 lines
426 B
TypeScript
Raw Normal View History

2026-05-06 03:11:02 +01:00
import type { ZodType } from "zod";
import type { CultCacheDocumentDefinition } from "./types";
export function defineDocumentType<TSchema extends ZodType>(
definition: CultCacheDocumentDefinition<TSchema>,
): CultCacheDocumentDefinition<TSchema> {
if (!definition.type || definition.type.trim().length === 0) {
throw new Error("CultCache document types must declare a non-empty type.");
}
return definition;
}