Repository navigation
refactor(open-sse): JS → TS migration + v0.8.5 #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
256e443
6a54b84
7b37a3c
688aa6c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| declare var EdgeRuntime: any; | ||
| /** | ||
| * CursorExecutor — Handles communication with the Cursor IDE API. | ||
| * | ||
|
|
@@ -226,7 +227,7 @@ export class CursorExecutor extends BaseExecutor { | |
|
|
||
| return { | ||
| status: response.status, | ||
| headers: Object.fromEntries(response.headers.entries()), | ||
| headers: Object.fromEntries((response.headers as any).entries()), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The headers: Object.fromEntries(response.headers.entries()), |
||
| body: Buffer.from(await response.arrayBuffer()), | ||
| }; | ||
| } | ||
|
|
@@ -290,7 +291,7 @@ export class CursorExecutor extends BaseExecutor { | |
| const transformedBody = this.transformRequest(model, body, stream, credentials); | ||
|
|
||
| try { | ||
| const response = http2 | ||
| const response: any = http2 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using For example: interface CustomResponse {
status: number;
headers: Record<string, string | number | string[]>;
body: Buffer;
}
// ...
const response: CustomResponse = http2
? await this.makeHttp2Request(url, headers, transformedBody, signal)
: await this.makeFetchRequest(url, headers, transformedBody, signal); |
||
| ? await this.makeHttp2Request(url, headers, transformedBody, signal) | ||
| : await this.makeFetchRequest(url, headers, transformedBody, signal); | ||
|
|
||
|
|
@@ -458,8 +459,7 @@ export class CursorExecutor extends BaseExecutor { | |
|
|
||
| console.log(`[CURSOR BUFFER] Final toolCalls count: ${toolCalls.length}`); | ||
|
|
||
| const message = { | ||
| role: "assistant", | ||
| const message: Record<string, any> = { role: "assistant", | ||
| content: totalContent || null, | ||
| }; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While using
anyis a quick way to migrate to TypeScript, it sacrifices type safety. Consider defining base interfaces forproviderandconfigand using generics to allow subclasses to provide more specific types. This would improve type safety and autocompletion throughout the codebase.For example: