import { typedRows } from '@datamoc/mwg/mwl';
import type { MwlTableColumn } from '@datamoc/mwg/mwl';
const columns = [
{ name: 'kind', type: 'string' },
{ name: 'cost', type: 'number' },
] as const satisfies readonly MwlTableColumn[];
const rows = typedRows({ columns, rows: [{ kind: 'torch', cost: 3 }] });
console.log(rows[0]?.cost); // 3
A table's rows with each declared column's name and coerced value type.
Every field is optional because an absent cell omits the key:
MWL_TABLEvalidation reports the missing column, butcontentCatalogstill returns the row without it, so readers must not assume presence. Deriving from the declaration (rather than casting each access) is what turns a renamed column type or a removed column into a compile error at every use.