Skip to content

Commit 781a169

Browse files
docs: added typescript generics change to upgrade helper part
1 parent 1cb8965 commit 781a169

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

docusaurus/docs/reactnative/basics/upgrade_helper.mdx

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,31 @@ yarn remove react-native-blur
212212
npx pod-install
213213
```
214214

215+
## Refactor Typescript Generics
216+
217+
Until now StreamChat client and Chat components accepted 7 different generics as provided in following example:
218+
219+
```tsx
220+
const client = StreamChat.getInstance<
221+
ChatAttachment,
222+
ChatChannel,
223+
CustomCommands,
224+
ChatEvent,
225+
UserMessage,
226+
CustomReaction,
227+
ChatUser
228+
>('YOUR_API_KEY', 'API_KEY_SECRET');
229+
```
230+
231+
These 7 generics have been replaced now with 1 single generics for the sake of simplicity.
232+
233+
```tsx
234+
const client = StreamChat.getInstance<StreamChatGenerics>('YOUR_API_KEY');
235+
```
236+
237+
Please refer to our typescript guide for details of [Generics](../customization/typescript.mdx#generics).
238+
239+
215240
## Whats new in v4?
216241

217242
### Optimized Image Attachments
@@ -288,7 +313,7 @@ user won't be able to see a cropped image on UI. In this version, we render imag
288313

289314
### Refactor Generics to a Single Generic
290315

291-
The Typescript generics can be simplified using a single Generic which can be passed to the component.
316+
The Typescript generics have been simplified to a single generic instead of 7 different generics (as in previous versions of SDK) which should be passed to the component or StreamChat client.
292317

293318
```tsx
294319
const client = StreamChat.getInstance<StreamChatGenerics>('YOUR_API_KEY');

0 commit comments

Comments
 (0)