Initial CultCacheTS port
This commit is contained in:
commit
0c430c3c0e
10 changed files with 544 additions and 0 deletions
13
src/document.ts
Normal file
13
src/document.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
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;
|
||||
}
|
||||
Loading…
Reference in a new issue