fix: generated Env declaration not extending HonoEnv
This commit is contained in:
@@ -22,13 +22,14 @@ const secretNames = await logStep(
|
||||
|
||||
const project = new Project({});
|
||||
|
||||
const envFile = project.addSourceFileAtPath("src/types/env.d.ts");
|
||||
envFile.insertImportDeclaration(2, {
|
||||
const envSourceFile = project.addSourceFileAtPath("src/types/env.d.ts");
|
||||
envSourceFile.insertImportDeclaration(2, {
|
||||
isTypeOnly: true,
|
||||
moduleSpecifier: "hono",
|
||||
namedImports: ["Env as HonoEnv"],
|
||||
});
|
||||
envFile.getInterfaceOrThrow("Env").addProperties(
|
||||
envSourceFile.getInterfaceOrThrow("Env").addExtends("HonoEnv");
|
||||
envSourceFile.getInterfaceOrThrow("Env").addProperties(
|
||||
secretNames.map((name) => ({
|
||||
name,
|
||||
type: `string`,
|
||||
|
||||
7
src/types/env.d.ts
vendored
7
src/types/env.d.ts
vendored
@@ -1,10 +1,11 @@
|
||||
// Generated by Wrangler on Tue Jun 04 2024 08:51:21 GMT-0400 (Eastern Daylight Time)
|
||||
// Generated by Wrangler on Sun Jun 09 2024 10:47:45 GMT-0400 (Eastern Daylight Time)
|
||||
// by running `wrangler types src/types/env.d.ts`
|
||||
import type { Env as HonoEnv } from "hono";
|
||||
|
||||
interface Env {
|
||||
interface Env extends HonoEnv {
|
||||
TURSO_URL: "libsql://humble-argent-silverandroid.turso.io";
|
||||
QSTASH_URL: "https://qstash.upstash.io/v2/publish";
|
||||
ENABLE_ANIFY: boolean;
|
||||
ENABLE_ANIFY: false;
|
||||
ADMIN_SDK_JSON: string;
|
||||
TURSO_AUTH_TOKEN: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user