mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 01:40:21 +00:00
fix(slack-stream): bind lastStreamPayload to local const before spread
TypeScript cannot narrow a mutable let variable through a null-check guard when it is used in a spread expression (TS2698: Spread types may only be created from object types). Binding to a local const lets the compiler narrow the type correctly.
This commit is contained in:
@@ -546,9 +546,11 @@ export async function dispatchPreparedSlackMessage(prepared: PreparedSlackMessag
|
|||||||
}
|
}
|
||||||
// Fall back to normal delivery with the full accumulated streamed text
|
// Fall back to normal delivery with the full accumulated streamed text
|
||||||
// so the user receives the complete answer even when stop() fails.
|
// so the user receives the complete answer even when stop() fails.
|
||||||
if (orphanDeleted && lastStreamPayload && streamedText) {
|
// Bind to a local const so TypeScript narrows away null before spread.
|
||||||
|
const fallbackPayload = lastStreamPayload;
|
||||||
|
if (orphanDeleted && fallbackPayload && streamedText) {
|
||||||
await deliverNormally(
|
await deliverNormally(
|
||||||
{ ...lastStreamPayload, text: streamedText },
|
{ ...fallbackPayload, text: streamedText },
|
||||||
finalStream.threadTs,
|
finalStream.threadTs,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user