chore: update Env declaration to extend Record<string, unknown>

This commit is contained in:
2024-06-09 11:01:03 -04:00
parent 04bd6c29cc
commit 5843dfdeb2
2 changed files with 5 additions and 3 deletions

View File

@@ -28,7 +28,9 @@ envSourceFile.insertImportDeclaration(2, {
moduleSpecifier: "hono", moduleSpecifier: "hono",
namedImports: ["Env as HonoEnv"], namedImports: ["Env as HonoEnv"],
}); });
envSourceFile.getInterfaceOrThrow("Env").addExtends("HonoEnv"); envSourceFile
.getInterfaceOrThrow("Env")
.addExtends(["HonoEnv", "Record<string, unknown>"]);
envSourceFile.getInterfaceOrThrow("Env").addProperties( envSourceFile.getInterfaceOrThrow("Env").addProperties(
secretNames.map((name) => ({ secretNames.map((name) => ({
name, name,

4
src/types/env.d.ts vendored
View File

@@ -1,8 +1,8 @@
// Generated by Wrangler on Sun Jun 09 2024 10:47:45 GMT-0400 (Eastern Daylight Time) // Generated by Wrangler on Sun Jun 09 2024 11:00:16 GMT-0400 (Eastern Daylight Time)
// by running `wrangler types src/types/env.d.ts` // by running `wrangler types src/types/env.d.ts`
import type { Env as HonoEnv } from "hono"; import type { Env as HonoEnv } from "hono";
interface Env extends HonoEnv { interface Env extends HonoEnv, Record<string, unknown> {
TURSO_URL: "libsql://humble-argent-silverandroid.turso.io"; TURSO_URL: "libsql://humble-argent-silverandroid.turso.io";
QSTASH_URL: "https://qstash.upstash.io/v2/publish"; QSTASH_URL: "https://qstash.upstash.io/v2/publish";
ENABLE_ANIFY: false; ENABLE_ANIFY: false;