Skip to content

Commit 5692bfc

Browse files
committed
fix: resolve TypeScript errors in useIncomingStreams and tsconfig
1 parent c08f2aa commit 5692bfc

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

frontend/src/hooks/useIncomingStreams.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ export function useWithdrawIncomingStream(
4848
});
4949
},
5050
onMutate: async (stream) => {
51-
if (!publicKey) return;
51+
if (!publicKey) {
52+
return {};
53+
}
5254

5355
// Cancel any outgoing refetches (so they don't overwrite our optimistic update)
5456
await queryClient.cancelQueries({
@@ -94,7 +96,11 @@ export function useWithdrawIncomingStream(
9496
},
9597
onSuccess: async (result, stream, _variables, context) => {
9698
if (publicKey) {
97-
const targetWithdrawn = context?.expectedWithdrawn ?? stream.withdrawn;
99+
const ctx = context as {
100+
previousStreams?: IncomingStreamRecord[];
101+
expectedWithdrawn?: number;
102+
};
103+
const targetWithdrawn = ctx.expectedWithdrawn ?? stream.withdrawn;
98104
// Start polling in the background without blocking the mutation
99105
pollIndexerForWithdraw(
100106
publicKey,
@@ -108,10 +114,14 @@ export function useWithdrawIncomingStream(
108114
await options?.onSuccess?.(result, stream);
109115
},
110116
onError: (error, stream, context) => {
111-
if (publicKey && context?.previousStreams) {
117+
const ctx = context as {
118+
previousStreams?: IncomingStreamRecord[];
119+
expectedWithdrawn?: number;
120+
};
121+
if (publicKey && ctx?.previousStreams) {
112122
queryClient.setQueryData(
113123
incomingStreamsQueryKey(publicKey),
114-
context.previousStreams,
124+
ctx.previousStreams,
115125
);
116126
}
117127
options?.onError?.(error, stream);

frontend/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@
3434
".next/dev/types/**/*.ts",
3535
"**/*.mts"
3636
],
37-
"exclude": ["node_modules", "vitest.config.ts"]
37+
"exclude": ["node_modules", "vitest.config.ts", "vitest.config.mts"]
3838
}

0 commit comments

Comments
 (0)