/// import { recipe, UI, OpaqueRef } from "commontools"; interface Item { id: number; name: string; } interface State { items: any; // Type will be asserted prefix: string; } export default recipe("TypeAssertion", (state) => { // Type assertion to OpaqueRef const typedItems = state.items as OpaqueRef; return { [UI]: (
{/* Map on type-asserted reactive array */} {typedItems.map((item) => (
{state.prefix}: {item.name}
))}
), }; });