stream-chat-js
stream-chat-js copied to clipboard
feat!: separate local events and server events
CLA
- [x] I have signed the Stream CLA (required).
- [x] Code changes are tested
Description of the changes, What, Why, and How?
When supplying event callbacks, this PR helps with stricter typing.
For example,
client.on('connection.changed', (event) => console.log(event.online));
// only `online` will be shown by the IDE for code-completion
Breaking change
Clients of the SDK cannot use the fields directly in if statements, For example,
function func(event: Event<StreamChatGenerics>) {
// this would error out, as TS would complain that event doesn't have online field
if (event.online) {
console.log(event.online);
}
// the correct way
if (event.type === 'connection.changed') {
console.log(event.online)
}
}
Size Change: +1.31 kB (0%)
Total Size: 309 kB
| Filename | Size | Change |
|---|---|---|
dist/browser.es.js |
67.5 kB | +248 B (0%) |
dist/browser.full-bundle.min.js |
36.9 kB | +122 B (0%) |
dist/browser.js |
68.5 kB | +445 B (+1%) |
dist/index.es.js |
67.6 kB | +250 B (0%) |
dist/index.js |
68.3 kB | +249 B (0%) |
We will pick this up later!