import { pattern, Writable, UI } from "commonfabric"; interface State { items: Array<{ name: string }>; } // FIXTURE: map-capture-writable-of // Verifies: new Writable() variable closed over in .map() is captured with asCell annotation // .map(fn) → .mapWithPattern(pattern(...), { selected: selected }) // new Writable(null) → params.selected with { anyOf: [string, null], asCell: true } export default pattern((state) => { const selected = new Writable(null); return { [UI]: (
{state.items.map((item) => ( {item.name} {selected} ))}
), }; });