chore: enforce erasable TypeScript syntax

This commit is contained in:
Mario Zechner
2026-05-19 23:15:39 +02:00
parent 48b6510c18
commit 06c6c324d7
17 changed files with 122 additions and 74 deletions

View File

@@ -2,6 +2,10 @@
## [Unreleased]
### Changed
- Changed source syntax to avoid TypeScript constructs that require JavaScript emit, keeping the package compatible with Node.js strip-only TypeScript checks.
### Fixed
- Fixed OpenAI-compatible `streamSimple()` requests to stop sending model-derived default output token caps, avoiding context-window reservation failures on servers such as vLLM while preserving explicit `maxTokens` and required Anthropic `max_tokens` handling ([#4675](https://github.com/earendil-works/pi/issues/4675)).

View File

@@ -7,11 +7,12 @@ export class EventStream<T, R = T> implements AsyncIterable<T> {
private done = false;
private finalResultPromise: Promise<R>;
private resolveFinalResult!: (result: R) => void;
private isComplete: (event: T) => boolean;
private extractResult: (event: T) => R;
constructor(
private isComplete: (event: T) => boolean,
private extractResult: (event: T) => R,
) {
constructor(isComplete: (event: T) => boolean, extractResult: (event: T) => R) {
this.isComplete = isComplete;
this.extractResult = extractResult;
this.finalResultPromise = new Promise((resolve) => {
this.resolveFinalResult = resolve;
});