Skip to content

Commit

Permalink
refactor: support TypeScript 5.7 for Deno 2.2 (#3939)
Browse files Browse the repository at this point in the history
* refactor: support TypeScript 5.7 for Deno 2.2

* remove `Buffer` test
  • Loading branch information
yusukebe authored Feb 21, 2025
1 parent 5e1f54c commit c9bd830
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
10 changes: 0 additions & 10 deletions runtime-tests/deno/hono.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,3 @@ Deno.test('environment variables', () => {
const { NAME } = env<{ NAME: string }>(c)
assertEquals(NAME, 'Deno')
})

Deno.test('Buffers', async () => {
const app = new Hono().get('/', async (c) => {
return c.body(Buffer.from('hello'))
})

const res = await app.request('/')
assertEquals(res.status, 200)
assertEquals(await res.text(), 'hello')
})
2 changes: 1 addition & 1 deletion src/helper/websocket/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export type WSReadyState = 0 | 1 | 2 | 3
* An argument for WSContext class
*/
export interface WSContextInit<T = unknown> {
send(data: string | ArrayBuffer, options: SendOptions): void
send(data: string | ArrayBuffer | Uint8Array, options: SendOptions): void
close(code?: number, reason?: string): void

raw?: T
Expand Down
3 changes: 2 additions & 1 deletion src/utils/jwt/jwt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import type { JWTPayload } from './types'
import { utf8Decoder, utf8Encoder } from './utf8'

const encodeJwtPart = (part: unknown): string =>
encodeBase64Url(utf8Encoder.encode(JSON.stringify(part))).replace(/=/g, '')
encodeBase64Url(utf8Encoder.encode(JSON.stringify(part)).buffer).replace(/=/g, '')

const encodeSignaturePart = (buf: ArrayBufferLike): string => encodeBase64Url(buf).replace(/=/g, '')

const decodeJwtPart = (part: string): TokenHeader | JWTPayload | undefined =>
Expand Down

0 comments on commit c9bd830

Please sign in to comment.