import { v4 as generateId } from "uuid" ; export function addTodo ( contents = "" ) { return { type : "ADD_TODO" , data : { contents , id : generateId ( ) , completed : false , } , } as const ; } export function removeTodo ( id ) { return { type : "REMOVE_TODO" , data : { id } , } as const ; } export function toggleTodo ( id ) { return { type : "TOGGLE_TODO" , data : { id } , } as const ; } export function updateTodo ( id , contents ) { return { type : "UPDATE_TODO" , data : { id , contents } , } as const ; } export type Action = ReturnType < typeof addTodo > | ReturnType < typeof removeTodo > | ReturnType < typeof toggleTodo > | ReturnType < typeof updateTodo > ;