Open jjangga0214 opened 1 week ago
Latest commit: d0e04d153cf082ee7b5aefa878e813031488d8b9
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
Hi!
Type inference is not made smartly when using the type
RealtimeResponse
.Let's take this snippet as a usage.
https://github.com/livekit-examples/realtime-playground/blob/989a7cb0edb517e4915e21305a041fa7da2aac37/agent/playground_agent.ts#L172-L209
For example, when
response.status === "incomplete"
,response.statusDetails.reason
should be asserted to'turn_detected' | 'client_cancelled' | string;
. But as you can see, it's not.The error message is like this.
The same applies to other statuses such as
"failed"
.This PR exports new types including
KnownRealtimeResponse
, which resolves the issue.