import { compile, contentCatalog, emitTableTypes } from '@datamoc/mwg/mwl';
const catalog = contentCatalog(
compile(
"[{ tag: 'table', id: 'roster', columns: 'kind:string', children: [{ tag: 'row', kind: 'goblin' }] }]",
),
);
console.log(emitTableTypes(catalog.tables).includes('export interface RosterRow')); // true
Emits a TypeScript module with one named row interface and one typed row accessor per table, for a game's own build script to write and import. The declarations describe the same values
contentCatalogreturns - column type for column type, every field optional for the absent-cell rule above - so regenerating after an MWL edit turns a changed column type or a removed column into a compile error wherever the old shape was used.