/** * FUTURE REPRO: patternized map callbacks should follow array-destructured aliases * * Destructuring a reactive array-valued field into a local alias should still * let later computations lower through that alias. */ import { Default, pattern, UI, VNode, Writable, } from "commonfabric"; interface FileEntry { name: string; tags: ["file" | "folder", string]; } interface Input { files: Writable>; } interface Output { [UI]: VNode; } export default pattern(({ files }) => { return { [UI]: (
{files.map((file) => { const [kind] = file.tags; const isFolder = kind === "folder"; return {isFolder ? file.name : "locked"}; })}
), }; });