mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-26 17:32:16 +00:00
fix(slack-stream): use Object.assign instead of spread for nullable payload
tsc strict mode refuses to narrow mutable let variables through spreads even with const binding, !== null guards, and non-null assertions. Object.assign avoids the TS2698 issue entirely since it accepts any source arguments.
This commit is contained in:
@@ -553,13 +553,9 @@ 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.
|
||||
// Use a nested const + if so TypeScript can narrow the type of the
|
||||
// captured const (not the outer mutable let) before the spread.
|
||||
if (orphanDeleted && streamedText) {
|
||||
const fallback = lastStreamPayload;
|
||||
if (fallback !== null) {
|
||||
await deliverNormally({ ...fallback, text: streamedText }, finalStream.threadTs);
|
||||
}
|
||||
if (orphanDeleted && lastStreamPayload && streamedText) {
|
||||
const fallback: ReplyPayload = Object.assign({}, lastStreamPayload, { text: streamedText });
|
||||
await deliverNormally(fallback, finalStream.threadTs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user