Repository navigation
fix: narrow channel.state.typing to typing.start events - #1960
Merged
Merged
Conversation
Only typing.start events are stored in the typing slice (typing.stop removes the entry), so type it as Record<string, EventPayload<'typing.start'>> instead of the Event union. Typing indicators can read event.user and event.parent_id without a hand-written guard. Also fixes v10-breaking-changes.md: the ChannelState entry now says stream-chat-react's TypingIndicator reads channel.state, and the stale TextComposerState.typing entry (removed in #1920) is dropped.
MartinCupela
approved these changes
Oct 29, 2026
oliverlaz
requested review from
MartinCupela,
NikolaGoranNaumovski,
isekovanic and
szuperaz
October 29, 2026 09:44
github-actions Bot
pushed a commit
that referenced
this pull request
Oct 30, 2026
## [10.0.0-rc.27](v10.0.0-rc.26...v10.0.0-rc.27) (2026-10-30) ### Bug Fixes * consolidate master and v10 ([#1957](#1957)) ([802a956](802a956)) * handle tokenProvider rejection during reconnect token refresh ([#1963](#1963)) ([e22d218](e22d218)) * narrow channel.state.typing to typing.start events ([#1960](#1960)) ([acb2345](acb2345)), closes [#1920](#1920) * odd edge cases for channel list recovery ([#1966](#1966)) ([dbc2468](dbc2468)) * pass full request options to hydration query ([#1959](#1959)) ([489774b](489774b)) ### Features * regenerate from latest api spec; docs sync ([#1969](#1969)) ([ae1e86a](ae1e86a))
|
🎉 This PR is included in version 10.0.0-rc.27 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket: https://linear.app/stream/issue/REACT-1466
CLA
Description of the changes, What, Why and How?
In v10
Eventis a discriminated union, butchannel.state.typingwas still typedRecord<string, Event>. Any custom typing indicator that readsevent.userorevent.parent_idstopped compiling and needed a hand-written(e): e is EventPayload<'typing.start'> => e.type === 'typing.start'guard. Found while migrating the stream-chat-react demo apps to v15 rc (stream-chat 10.0.0-rc.26).Only
typing.startevents are ever stored in that slice. The one writer is thetyping.startcase inChannel._handleChannelEvent(guarded onevent.user?.id),typing.stoponly removes an entry, andclean()only readsreceived_at. So the type is narrowed to match what is stored:TypingUsersState.typing(and soChannelStateData['typing']), thechannel.state.typingsetter andsetTypingEventnow useRecord<string, EventPayload<'typing.start'>>/EventPayload<'typing.start'>. No new exported alias.test/types/typing-state.ts(runs inyarn typesandtypes:dist):Object.values(channel.state.typing)[0].user?.idand.parent_idcompile with no guard, the slice type is pinned, and passing atyping.stoptosetTypingEventis rejected. Against the old types it fails with 6 errors.ai-docs/v10-breaking-changes.md:ChannelStateis aStateStore<ChannelStateData>): the parenthetical said stream-chat-react'sTypingIndicator"reads the composer copy", which contradicted the same sentence (channel.stateis the only owner) and the React v15 guide. It now says the indicator readschannel.state, and documents the narrowed type.TextComposerState.typingadded as required" entry and thetyping/setTyping/setTypingEvent/removeTypingEventmembers from theTextComposerrow of the added-members table. That composer copy was removed in fix: v10 in depth review hotfixes #1920, so both described an API that no longer exists and contradicted §7.Compatibility: this is narrower than before, so code that assigned non-
typing.startevents intochannel.state.typingorsetTypingEventno longer compiles. Nothing in the SDK does that, and readers only gain.Test results
yarn types: pass (includestypes:scriptsandtypes:tests)yarn lint: clean, zero warningsyarn test: 135 files, 4820 tests passedChangelog
channel.state.typingandChannelState.setTypingEventare typed astyping.startevents, soevent.userreads without a type guard.