Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sdk/ts fix type and import errors
Browse files Browse the repository at this point in the history
Superpat committed Jan 14, 2025
1 parent 21c978d commit 65da425
Showing 6 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion sdk/ts/src/abstractServerSentEventGenerator.ts
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ import {

import { DefaultSseRetryDurationMs } from "./consts.ts";

import { Jsonifiable } from "type-fest";
import type { Jsonifiable } from "npm:type-fest";

/**
* Abstract ServerSentEventGenerator class, responsible for initializing and handling
2 changes: 1 addition & 1 deletion sdk/ts/src/node/node.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createServer } from "node:http";
import { ServerSentEventGenerator } from "./serverSentEventGenerator.ts";
import { Jsonifiable } from "type-fest";
import type { Jsonifiable } from "npm:type-fest";

const hostname = "127.0.0.1";
const port = 3000;
3 changes: 2 additions & 1 deletion sdk/ts/src/node/serverSentEventGenerator.ts
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ import { ServerSentEventGenerator as AbstractSSEGenerator } from "../abstractSer

import { IncomingMessage, ServerResponse } from "node:http";
import process from "node:process";
import type { Jsonifiable } from "npm:type-fest";

function isRecord(obj: unknown): obj is Record<string, unknown> {
return typeof obj === "object" && obj !== null;
@@ -69,7 +70,7 @@ export class ServerSentEventGenerator extends AbstractSSEGenerator {
* @returns An object containing a success boolean and either the client's signals or an error message.
*/
static async readSignals(request: IncomingMessage): Promise<
| { success: true; signals: Record<string, unknown> }
| { success: true; signals: Record<string, Jsonifiable> }
| { success: false; error: string }
> {
if (request.method === "GET") {
2 changes: 1 addition & 1 deletion sdk/ts/src/types.ts
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ import {
EventTypes,
FragmentMergeModes,
} from "./consts.ts";
import { Jsonifiable } from "type-fest";
import type { Jsonifiable } from "npm:type-fest";

export type FragmentMergeMode = typeof FragmentMergeModes[number];
export type EventType = typeof EventTypes[number];
2 changes: 1 addition & 1 deletion sdk/ts/src/web/deno.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { serve } from "https://deno.land/std@0.140.0/http/server.ts";
import { ServerSentEventGenerator } from "./serverSentEventGenerator.ts";
import { Jsonifiable } from "type-fest";
import type { Jsonifiable } from "npm:type-fest";

serve(async (req: Request) => {
const url = new URL(req.url);
2 changes: 1 addition & 1 deletion sdk/ts/src/web/serverSentEventGenerator.ts
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@ export class ServerSentEventGenerator extends AbstractSSEGenerator {
* @returns An object containing a success boolean and either the client's signals or an error message.
*/
static async readSignals(request: Request): Promise<
| { success: true; signals: Record<string, unknown> }
| { success: true; signals: Record<string, Jsonifiable> }
| { success: false; error: string }
> {
try {

0 comments on commit 65da425

Please sign in to comment.