refactor(web): 去冗余 cast(idx.valueOf / dict[error] as string)

stream/sse.ts SseFrameBuffer 去 idx.valueOf()(idx 本就是 number);jobs/job.ts 去 dict["error"] as string(typeof 守卫后 TS 自动收窄)。typecheck 绿。
This commit is contained in:
Yaojia Wang
2026-07-08 13:27:45 +02:00
parent 16f2eae2d3
commit 64145422eb
2 changed files with 2 additions and 2 deletions

View File

@@ -85,7 +85,7 @@ export class SseFrameBuffer {
let idx: number;
// 块之间以空行(\n\n兼容 \r\n\r\n分隔。
while ((idx = this.findBoundary(this.buf)) !== -1) {
const block = this.buf.slice(0, idx.valueOf());
const block = this.buf.slice(0, idx);
this.buf = this.buf.slice(this.boundaryEnd(this.buf, idx));
const evt = parseSseBlock(block);
if (evt) events.push(evt);