/// import { Cell, handler } from "commontools"; interface Item { text: string; } interface ListState { items: Cell; } const removeItem = handler( (_, { items, index }) => { const next = items.get().slice(); if (index >= 0 && index < next.length) next.splice(index, 1); items.set(next); }, ); // alias-based intersection variant type ListStateWithIndex = ListState & { index: number }; const removeItemAlias = handler( (_, { items, index }) => { const next = items.get().slice(); if (index >= 0 && index < next.length) next.splice(index, 1); items.set(next); }, ); export { removeItem, removeItemAlias };