refactor(cloudflare-access): enable isolated declarations (#1195)

pull/1206/head
Jonathan Haines 2025-06-09 19:12:04 +10:00 committed by GitHub
parent 683455895d
commit b6f3bc674b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
'@hono/cloudflare-access': patch
---
Add explicit `MiddlewareHandler` return type

View File

@ -1,4 +1,4 @@
import type { Context } from 'hono'
import type { Context, MiddlewareHandler } from 'hono'
import { getCookie } from 'hono/cookie'
import { createMiddleware } from 'hono/factory'
import { HTTPException } from 'hono/http-exception'
@ -33,7 +33,7 @@ declare module 'hono' {
}
}
export const cloudflareAccess = (accessTeamName: string) => {
export const cloudflareAccess = (accessTeamName: string): MiddlewareHandler => {
// This var will hold already imported jwt keys, this reduces the load of importing the key on every request
let cacheKeys: Record<string, CryptoKey> = {}
let cacheExpiration = 0

View File

@ -5,6 +5,7 @@
"outDir": "dist",
"tsBuildInfoFile": "dist/tsconfig.build.tsbuildinfo",
"emitDeclarationOnly": false,
"isolatedDeclarations": true,
"types": ["@cloudflare/workers-types"]
},
"include": ["src/**/*.ts"],