fix(slack-stream): use !== null narrowing for lastStreamPayload spread
tsgo (native TypeScript compiler) does not narrow a let variable through a truthy check in a compound && condition when it appears in a spread expression. Replace the intermediate const + truthy check with an explicit !== null guard which tsgo reliably narrows.
This commit is contained in:
parent
d1653b7750
commit
7b9fc01fba
@ -553,10 +553,8 @@ 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.
|
||||
// Bind to a local const so TypeScript narrows away null before spread.
|
||||
const fallbackPayload = lastStreamPayload;
|
||||
if (orphanDeleted && fallbackPayload && streamedText) {
|
||||
await deliverNormally({ ...fallbackPayload, text: streamedText }, finalStream.threadTs);
|
||||
if (orphanDeleted && lastStreamPayload !== null && streamedText) {
|
||||
await deliverNormally({ ...lastStreamPayload, text: streamedText }, finalStream.threadTs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user