an atproto based link aggregator
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix type assertions for optimistic UI helpers

Add helper functions to properly type form action results for
pending posts/comments. This avoids Prettier stripping generic
type parameters when they appear in Svelte templates.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

+13 -3
+7 -2
src/routes/post/[rkey]/+page.svelte
··· 20 20 let replyText = $state(''); 21 21 let collapsed = new SvelteSet<string>(); 22 22 23 + // Helper to type the action result (avoids Prettier mangling generic syntax) 24 + function asPendingComment(data: unknown): Omit<PendingComment, 'submittedAt'> { 25 + return data as Omit<PendingComment, 'submittedAt'>; 26 + } 27 + 23 28 // Get pending comments for this post using $ auto-subscription 24 29 const pendingStore = pendingComments.forPost(data.post.uri); 25 30 let pending = $derived($pendingStore); ··· 240 245 return async ({ update, result }) => { 241 246 if (result.type === 'success' && result.data?.success && result.data?.comment) { 242 247 // Add to pending store for optimistic UI 243 - pendingComments.add(result.data.comment as Omit<PendingComment, 'submittedAt'>); 248 + pendingComments.add(asPendingComment(result.data.comment)); 244 249 commentText = ''; 245 250 } else { 246 251 await update(); ··· 392 397 return async ({ update, result }) => { 393 398 if (result.type === 'success' && result.data?.success && result.data?.comment) { 394 399 // Add to pending store for optimistic UI 395 - pendingComments.add(result.data.comment as Omit<PendingComment, 'submittedAt'>); 400 + pendingComments.add(asPendingComment(result.data.comment)); 396 401 cancelReply(); 397 402 } else { 398 403 await update();
+6 -1
src/routes/submit/+page.svelte
··· 5 5 6 6 let { form } = $props(); 7 7 let submitting = $state(false); 8 + 9 + // Helper to type the action result (avoids Prettier mangling generic syntax) 10 + function asPendingPost(data: unknown): Omit<PendingPost, 'submittedAt'> { 11 + return data as Omit<PendingPost, 'submittedAt'>; 12 + } 8 13 </script> 9 14 10 15 <svelte:head> ··· 29 34 return async ({ result, update }) => { 30 35 if (result.type === 'success' && result.data?.success && result.data?.post) { 31 36 // Add to pending store for optimistic UI 32 - pendingPosts.add(result.data.post as Omit<PendingPost, 'submittedAt'>); 37 + pendingPosts.add(asPendingPost(result.data.post)); 33 38 // Navigate to home 34 39 await goto('/'); 35 40 } else {