fix: types

This commit is contained in:
Shusui MOYATANI
2023-11-29 01:01:58 +09:00
parent 4e7ce8a613
commit 658363bf5a
5 changed files with 25 additions and 18 deletions

View File

@@ -3,7 +3,7 @@ import { createMemo } from 'solid-js';
import { createQuery, type CreateQueryResult } from '@tanstack/solid-query';
import { Event as NostrEvent } from 'nostr-tools';
import { registerTask, BatchedEventsTask } from '@/nostr/useBatchedEvents';
import { registerTask, BatchedEventsTask, EventTask } from '@/nostr/useBatchedEvents';
import timeout from '@/utils/timeout';
export type UseEventProps = {
@@ -24,7 +24,7 @@ const useEvent = (propsProvider: () => UseEventProps | null): UseEvent => {
const [, currentProps] = queryKey;
if (currentProps == null) return null;
const { eventId } = currentProps;
const task = new BatchedEventsTask({ type: 'Event', eventId });
const task = new BatchedEventsTask<EventTask>({ type: 'Event', eventId });
const promise = task.firstEventPromise().catch(() => {
throw new Error(`event not found: ${eventId}`);
});