From ab0790e95194291cab65dee458982a2b637a4d15 Mon Sep 17 00:00:00 2001 From: Basti Buck Date: Sun, 29 Jan 2023 11:00:33 +0100 Subject: [PATCH] fix: fix type of serverEnv and clientEnv (#1131) --- .changeset/quiet-carrots-push.md | 5 +++++ cli/template/base/src/env/schema.mjs | 4 ++-- cli/template/extras/src/env/schema/with-auth-prisma.mjs | 4 ++-- cli/template/extras/src/env/schema/with-auth.mjs | 4 ++-- cli/template/extras/src/env/schema/with-prisma.mjs | 4 ++-- 5 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 .changeset/quiet-carrots-push.md diff --git a/.changeset/quiet-carrots-push.md b/.changeset/quiet-carrots-push.md new file mode 100644 index 0000000000..4da29f7baa --- /dev/null +++ b/.changeset/quiet-carrots-push.md @@ -0,0 +1,5 @@ +--- +"create-t3-app": patch +--- + +fix: fix types of serverEnv and clientEnv diff --git a/cli/template/base/src/env/schema.mjs b/cli/template/base/src/env/schema.mjs index eee6cdfcd4..13a5763d54 100644 --- a/cli/template/base/src/env/schema.mjs +++ b/cli/template/base/src/env/schema.mjs @@ -12,7 +12,7 @@ export const serverSchema = z.object({ /** * You can't destruct `process.env` as a regular object in the Next.js * middleware, so you have to do it manually here. - * @type {{ [k in keyof z.infer]: z.infer[k] | undefined }} + * @type {{ [k in keyof z.input]: string | undefined }} */ export const serverEnv = { NODE_ENV: process.env.NODE_ENV, @@ -31,7 +31,7 @@ export const clientSchema = z.object({ * You can't destruct `process.env` as a regular object, so you have to do * it manually here. This is because Next.js evaluates this at build time, * and only used environment variables are included in the build. - * @type {{ [k in keyof z.infer]: z.infer[k] | undefined }} + * @type {{ [k in keyof z.input]: string | undefined }} */ export const clientEnv = { // NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR, diff --git a/cli/template/extras/src/env/schema/with-auth-prisma.mjs b/cli/template/extras/src/env/schema/with-auth-prisma.mjs index 3e5bd6c47b..efe477b114 100644 --- a/cli/template/extras/src/env/schema/with-auth-prisma.mjs +++ b/cli/template/extras/src/env/schema/with-auth-prisma.mjs @@ -26,7 +26,7 @@ export const serverSchema = z.object({ /** * You can't destruct `process.env` as a regular object in the Next.js * middleware, so you have to do it manually here. - * @type {{ [k in keyof z.infer]: z.infer[k] | undefined }} + * @type {{ [k in keyof z.input]: string | undefined }} */ export const serverEnv = { DATABASE_URL: process.env.DATABASE_URL, @@ -50,7 +50,7 @@ export const clientSchema = z.object({ * You can't destruct `process.env` as a regular object, so you have to do * it manually here. This is because Next.js evaluates this at build time, * and only used environment variables are included in the build. - * @type {{ [k in keyof z.infer]: z.infer[k] | undefined }} + * @type {{ [k in keyof z.input]: string | undefined }} */ export const clientEnv = { // NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR, diff --git a/cli/template/extras/src/env/schema/with-auth.mjs b/cli/template/extras/src/env/schema/with-auth.mjs index 1068e79918..f6e1c7208b 100644 --- a/cli/template/extras/src/env/schema/with-auth.mjs +++ b/cli/template/extras/src/env/schema/with-auth.mjs @@ -25,7 +25,7 @@ export const serverSchema = z.object({ /** * You can't destruct `process.env` as a regular object in the Next.js * middleware, so you have to do it manually here. - * @type {{ [k in keyof z.infer]: z.infer[k] | undefined }} + * @type {{ [k in keyof z.input]: string | undefined }} */ export const serverEnv = { NODE_ENV: process.env.NODE_ENV, @@ -48,7 +48,7 @@ export const clientSchema = z.object({ * You can't destruct `process.env` as a regular object, so you have to do * it manually here. This is because Next.js evaluates this at build time, * and only used environment variables are included in the build. - * @type {{ [k in keyof z.infer]: z.infer[k] | undefined }} + * @type {{ [k in keyof z.input]: string | undefined }} */ export const clientEnv = { // NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR, diff --git a/cli/template/extras/src/env/schema/with-prisma.mjs b/cli/template/extras/src/env/schema/with-prisma.mjs index f2a36da932..d883adeea3 100644 --- a/cli/template/extras/src/env/schema/with-prisma.mjs +++ b/cli/template/extras/src/env/schema/with-prisma.mjs @@ -13,7 +13,7 @@ export const serverSchema = z.object({ /** * You can't destruct `process.env` as a regular object in the Next.js * middleware, so you have to do it manually here. - * @type {{ [k in keyof z.infer]: z.infer[k] | undefined }} + * @type {{ [k in keyof z.input]: string | undefined }} */ export const serverEnv = { DATABASE_URL: process.env.DATABASE_URL, @@ -33,7 +33,7 @@ export const clientSchema = z.object({ * You can't destruct `process.env` as a regular object, so you have to do * it manually here. This is because Next.js evaluates this at build time, * and only used environment variables are included in the build. - * @type {{ [k in keyof z.infer]: z.infer[k] | undefined }} + * @type {{ [k in keyof z.input]: string | undefined }} */ export const clientEnv = { // NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR,