Skip to content

Commit f84e678

Browse files
committed
🔧 fix: type
1 parent 1a3ecad commit f84e678

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

src/adapter/web-standard/handler.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,20 @@ const handleStream = async (
124124
if (typeof init.value === 'object')
125125
try {
126126
controller.enqueue(
127+
// @ts-expect-error this is a valid operation
127128
Buffer.from(JSON.stringify(init.value))
128129
)
129130
} catch {
130131
controller.enqueue(
132+
// @ts-expect-error this is a valid operation
131133
Buffer.from(init.value.toString())
132134
)
133135
}
134-
else controller.enqueue(Buffer.from(init.value.toString()))
136+
else
137+
controller.enqueue(
138+
// @ts-expect-error this is a valid operation
139+
Buffer.from(init.value.toString())
140+
)
135141
}
136142

137143
for await (const chunk of generator) {
@@ -141,12 +147,20 @@ const handleStream = async (
141147
if (typeof chunk === 'object')
142148
try {
143149
controller.enqueue(
150+
// @ts-expect-error this is a valid operation
144151
Buffer.from(JSON.stringify(chunk))
145152
)
146153
} catch {
147-
controller.enqueue(Buffer.from(chunk.toString()))
154+
controller.enqueue(
155+
// @ts-expect-error this is a valid operation
156+
Buffer.from(chunk.toString())
157+
)
148158
}
149-
else controller.enqueue(Buffer.from(chunk.toString()))
159+
else
160+
controller.enqueue(
161+
// @ts-expect-error this is a valid operation
162+
Buffer.from(chunk.toString())
163+
)
150164

151165
// Wait for the next event loop
152166
// Otherwise the data will be mixed up

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5515,8 +5515,9 @@ export default class Elysia<
55155515
if (!(key in this.definitions.type))
55165516
this.definitions.type[key] = value as TSchema
55175517
})
5518+
// @ts-expect-error
55185519
this.definitions.typebox = t.Module({
5519-
...this.definitions.typebox['$defs'],
5520+
...this.definitions.typebox['$defs'] as TModule<{}>,
55205521
...name
55215522
} as any)
55225523

src/ws/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ export const createHandleWSResponse = (
237237
if (data instanceof Promise)
238238
return data.then((data) => handleWSResponse(ws, data))
239239

240-
if (Buffer.isBuffer(data)) return ws.send(data)
240+
if (Buffer.isBuffer(data)) return ws.send(data.toString())
241241

242242
if (data === undefined) return
243243

0 commit comments

Comments
 (0)