mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-27 01:41:40 +00:00
fix(slack-stream): non-null assertion for lastStreamPayload spread
tsc does not narrow mutable let variables through spread type expressions even when an explicit !== null guard precedes the spread. The assertion is safe — lastStreamPayload !== null is checked in the same condition.
This commit is contained in:
@@ -553,8 +553,11 @@ export async function dispatchPreparedSlackMessage(prepared: PreparedSlackMessag
|
||||
}
|
||||
// Fall back to normal delivery with the full accumulated streamed text
|
||||
// so the user receives the complete answer even when stop() fails.
|
||||
// lastStreamPayload is guarded by !== null above; the ! assertion is
|
||||
// required because tsc does not narrow mutable let variables through
|
||||
// spread expressions even with an explicit null guard.
|
||||
if (orphanDeleted && lastStreamPayload !== null && streamedText) {
|
||||
await deliverNormally({ ...lastStreamPayload, text: streamedText }, finalStream.threadTs);
|
||||
await deliverNormally({ ...lastStreamPayload!, text: streamedText }, finalStream.threadTs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user