Skip to content
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

refactor: support TypeScript 5.7 for Deno 2.2 #3939

Merged
merged 2 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions runtime-tests/deno/hono.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assertEquals } from '@std/assert'
import { Buffer } from 'node:buffer'

Check warning on line 2 in runtime-tests/deno/hono.test.ts

View workflow job for this annotation

GitHub Actions / Main

'Buffer' is defined but never used

import { Context } from '../../src/context.ts'
import { env, getRuntimeKey } from '../../src/helper/adapter/index.ts'
Expand Down Expand Up @@ -34,13 +34,3 @@
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
Loading