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:
parent
7b9fc01fba
commit
a298fa22f6
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user