Commit 7f20340
committed
fix(messaging): remove @ts-nocheck and fully type useMessaging hook (#934)
- Remove the @ts-nocheck suppression from useMessaging.tsx so TypeScript
enforces type safety over the entire real-time messaging hook.
- Drop the unused useWebSocket call: the store (messagingStore.ts) owns the
socket lifecycle via wsManager; there is no need for a second WebSocket
abstraction layer in the hook.
- Replace NodeJS.Timeout with ReturnType<typeof setTimeout> so the file
compiles correctly in both browser and Node runtime contexts.
- Remove isReconnecting / connectionError from the hook's return value;
reconnection state is tracked inside the store (isConnected flag).
- Extend MessagingState interface with all actions that useMessaging was
consuming but that were absent from the interface:
· loadMoreMessages - paginate older messages
· setSearchQuery - filter conversation list
· setSelectedFiles - replace selected-file list
· removeSelectedFile - remove a file by index
· uploadAttachments - upload Files, return Attachment[]
· createConversation - start a new conversation by participantId
· getTotalUnreadCount - aggregate unread badge count
- Provide stub implementations for all new store actions so they satisfy
the interface; real server integration can replace the stubs without
changing any consumer types.
- Verified: npx tsc --noEmit exits 0 with no errors across the project.
Closes #9341 parent c06a4b5 commit 7f20340
2 files changed
Lines changed: 86 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | 1 | | |
4 | 2 | | |
5 | 3 | | |
6 | 4 | | |
7 | 5 | | |
8 | 6 | | |
9 | | - | |
10 | 7 | | |
11 | 8 | | |
12 | 9 | | |
| |||
38 | 35 | | |
39 | 36 | | |
40 | 37 | | |
41 | | - | |
| 38 | + | |
42 | 39 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 40 | + | |
48 | 41 | | |
49 | 42 | | |
50 | 43 | | |
| |||
58 | 51 | | |
59 | 52 | | |
60 | 53 | | |
61 | | - | |
62 | 54 | | |
63 | 55 | | |
64 | 56 | | |
65 | 57 | | |
66 | | - | |
67 | 58 | | |
68 | 59 | | |
69 | 60 | | |
| |||
93 | 84 | | |
94 | 85 | | |
95 | 86 | | |
96 | | - | |
| 87 | + | |
97 | 88 | | |
98 | 89 | | |
99 | 90 | | |
| |||
104 | 95 | | |
105 | 96 | | |
106 | 97 | | |
107 | | - | |
| 98 | + | |
108 | 99 | | |
109 | 100 | | |
110 | 101 | | |
111 | | - | |
| 102 | + | |
112 | 103 | | |
| 104 | + | |
113 | 105 | | |
114 | 106 | | |
115 | 107 | | |
116 | | - | |
| 108 | + | |
117 | 109 | | |
118 | 110 | | |
| 111 | + | |
119 | 112 | | |
120 | 113 | | |
121 | 114 | | |
| |||
131 | 124 | | |
132 | 125 | | |
133 | 126 | | |
134 | | - | |
| 127 | + | |
135 | 128 | | |
136 | 129 | | |
137 | 130 | | |
138 | 131 | | |
139 | | - | |
| 132 | + | |
140 | 133 | | |
141 | 134 | | |
142 | 135 | | |
143 | 136 | | |
144 | | - | |
145 | | - | |
| 137 | + | |
| 138 | + | |
146 | 139 | | |
147 | 140 | | |
148 | 141 | | |
149 | 142 | | |
150 | 143 | | |
151 | | - | |
| 144 | + | |
152 | 145 | | |
153 | 146 | | |
154 | 147 | | |
| |||
162 | 155 | | |
163 | 156 | | |
164 | 157 | | |
165 | | - | |
166 | | - | |
167 | 158 | | |
168 | 159 | | |
169 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
73 | 80 | | |
74 | 81 | | |
75 | 82 | | |
| |||
206 | 213 | | |
207 | 214 | | |
208 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
209 | 282 | | |
0 commit comments