import { ExtractActionTypes , ExtractActions } from '../common/actions' ; import { INote } from './types' ; export const NoteActions = { updateName : ( id , name ) => ( { type : 'note.update.name' as const , name , id } ) , updateContent : ( id , content , richContent ? ) => ( { type : 'note.update.content' as const , id , content , richContent } ) , move : ( id , newNotebookId ) => ( { type : 'note.move' as const , id , newNotebookId } ) , addNote : ( id , note ) => { return { type : 'note.create' as const , id , note } ; } , deleteNote : ( id ) => ( { type : 'note.delete' as const , id } ) , reorderNote : ( id , to ) => ( { type : 'note.reorder' as const , id , to } ) , } ; export type NoteActions = ExtractActions < typeof NoteActions > ; export type NoteActionT < T extends NoteActionTypes > = NoteActions & { type : T ; } ; export type NoteActionTypes = ExtractActionTypes < typeof NoteActions > ; export const NoteActionTypes = ExtractActionTypes ( NoteActions ) ;