/// /** * Test case for unless() with a reactive array map as the fallback. * * unless(condition, fallback) returns condition if truthy, else fallback. * When fallback is items.map(...), the map gets transformed to mapWithPattern. * Schema injection needs to know the type of the mapWithPattern result. */ import { Cell, Default, pattern, UI } from "commontools"; interface Item { label: string; } interface PatternInput { customContent: Cell; items: Cell>; } export default pattern(({ customContent, items }) => { return { [UI]: (
{/* unless(condition, fallback) where fallback is a reactive map */} {customContent || items.map((item) =>
  • {item.label}
  • )}
    ), }; });