Collection
A namespace of files, read as entries: see collection.
import type { Entry } from "#codebase/tcmts/content"; export interface Collection<T, C = undefined> { /** every entry, in the collection's order; throws, naming each entry that doesn't fit its schema, if any doesn't */ all(): Entry<T, C>[]; /** the entry named `name`, or undefined if there's none; throws if it doesn't fit the schema */ get(name: string): Entry<T, C> | undefined; /** what's wrong with `text` as the entry named `name` (nothing: it fits), with a schema that checks at once */ check(name: string, text: string): string[]; /** * check every entry, waiting for a schema that checks asynchronously: once it's done, `all` and `get` read them (with * such a schema, they can't before) */ load(): Promise<void>; }