/** * FUTURE REPRO: patternized map callbacks should lower helper calls over aliases * * A direct alias may stay structural, but an ordinary helper call that consumes * that alias should still lower at its own seam. */ import { Default, pattern, UI, VNode, Writable, } from "commonfabric"; interface FileEntry { name: string; type: "file" | "folder"; } interface Input { files: Writable>; } interface Output { [UI]: VNode; } const describeKind = (kind: "file" | "folder"): string => kind === "folder" ? "dir" : "doc"; export default pattern(({ files }) => { return { [UI]: (
{files.map((file) => { const kind = file.type; const label = describeKind(kind); return {label}; })}
), }; });