refactor: introduce dedicated identifier types for improved clarity and type safety
This commit is contained in:
@@ -7,7 +7,7 @@ interface CorrespondentUsage {
|
||||
}
|
||||
|
||||
export interface CorrespondentEntry {
|
||||
id?: string | number;
|
||||
id?: string;
|
||||
name?: string;
|
||||
usage?: CorrespondentUsage;
|
||||
[key: string]: unknown;
|
||||
@@ -17,8 +17,8 @@ export interface CorrespondentsPanelProps {
|
||||
correspondents?: CorrespondentEntry[];
|
||||
onRefresh?: () => void | Promise<void>;
|
||||
onCreate: (payload: { name: string }) => Promise<CorrespondentEntry | void>;
|
||||
onUpdate: (id: string | number, payload: { name: string }) => Promise<void>;
|
||||
onDelete: (id: string | number) => Promise<void>;
|
||||
onUpdate: (id: string, payload: { name: string }) => Promise<void>;
|
||||
onDelete: (id: string) => Promise<void>;
|
||||
onNotify?: (message: string, variant?: string) => void;
|
||||
}
|
||||
|
||||
@@ -30,12 +30,12 @@ function CorrespondentsPanel({
|
||||
onDelete,
|
||||
onNotify,
|
||||
}: CorrespondentsPanelProps) {
|
||||
const [editingId, setEditingId] = useState<string | number | null>(null);
|
||||
const [editingId, setEditingId] = useState<string | null>(null);
|
||||
const [draftName, setDraftName] = useState('');
|
||||
const [createName, setCreateName] = useState('');
|
||||
const [saving, setSaving] = useState(false);
|
||||
const [creating, setCreating] = useState(false);
|
||||
const [deletingId, setDeletingId] = useState<string | number | null>(null);
|
||||
const [deletingId, setDeletingId] = useState<string | null>(null);
|
||||
|
||||
const startEdit = useCallback((correspondent: CorrespondentEntry) => {
|
||||
setEditingId(correspondent.id);
|
||||
|
||||
Reference in New Issue
Block a user