fix(domains): resolve TypeScript type errors in domain hooks
- Add type assertions for Valtio snapshot readonly arrays - Remove unused fromPromise import from hands machine - Ensures type compatibility with Valtio's useSnapshot Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -17,41 +17,41 @@ export function useHandsState() {
|
||||
/**
|
||||
* Hook to access hands list.
|
||||
*/
|
||||
export function useHands(): readonly Hand[] {
|
||||
export function useHands() {
|
||||
const { hands } = useSnapshot(handsStore);
|
||||
return hands;
|
||||
return hands as readonly Hand[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook to access a specific hand by ID.
|
||||
*/
|
||||
export function useHand(id: string): Hand | undefined {
|
||||
export function useHand(id: string) {
|
||||
const { hands } = useSnapshot(handsStore);
|
||||
return hands.find(h => h.id === id);
|
||||
return hands.find(h => h.id === id) as Hand | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook to access approval queue.
|
||||
*/
|
||||
export function useApprovalQueue(): readonly ApprovalRequest[] {
|
||||
export function useApprovalQueue() {
|
||||
const { approvalQueue } = useSnapshot(handsStore);
|
||||
return approvalQueue;
|
||||
return approvalQueue as readonly ApprovalRequest[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook to access triggers.
|
||||
*/
|
||||
export function useTriggers(): readonly Trigger[] {
|
||||
export function useTriggers() {
|
||||
const { triggers } = useSnapshot(handsStore);
|
||||
return triggers;
|
||||
return triggers as readonly Trigger[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook to access a specific run.
|
||||
*/
|
||||
export function useRun(runId: string): HandRun | undefined {
|
||||
export function useRun(runId: string) {
|
||||
const { runs } = useSnapshot(handsStore);
|
||||
return runs[runId];
|
||||
return runs[runId] as HandRun | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user