Skip to content

Commit

Permalink
fix: fix type of serverEnv and clientEnv (#1131)
Browse files Browse the repository at this point in the history
  • Loading branch information
bastibuck authored Jan 29, 2023
1 parent f367b20 commit ab0790e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/quiet-carrots-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-t3-app": patch
---

fix: fix types of serverEnv and clientEnv
4 changes: 2 additions & 2 deletions cli/template/base/src/env/schema.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof serverSchema>]: z.infer<typeof serverSchema>[k] | undefined }}
* @type {{ [k in keyof z.input<typeof serverSchema>]: string | undefined }}
*/
export const serverEnv = {
NODE_ENV: process.env.NODE_ENV,
Expand All @@ -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<typeof clientSchema>]: z.infer<typeof clientSchema>[k] | undefined }}
* @type {{ [k in keyof z.input<typeof clientSchema>]: string | undefined }}
*/
export const clientEnv = {
// NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR,
Expand Down
4 changes: 2 additions & 2 deletions cli/template/extras/src/env/schema/with-auth-prisma.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof serverSchema>]: z.infer<typeof serverSchema>[k] | undefined }}
* @type {{ [k in keyof z.input<typeof serverSchema>]: string | undefined }}
*/
export const serverEnv = {
DATABASE_URL: process.env.DATABASE_URL,
Expand All @@ -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<typeof clientSchema>]: z.infer<typeof clientSchema>[k] | undefined }}
* @type {{ [k in keyof z.input<typeof clientSchema>]: string | undefined }}
*/
export const clientEnv = {
// NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR,
Expand Down
4 changes: 2 additions & 2 deletions cli/template/extras/src/env/schema/with-auth.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof serverSchema>]: z.infer<typeof serverSchema>[k] | undefined }}
* @type {{ [k in keyof z.input<typeof serverSchema>]: string | undefined }}
*/
export const serverEnv = {
NODE_ENV: process.env.NODE_ENV,
Expand All @@ -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<typeof clientSchema>]: z.infer<typeof clientSchema>[k] | undefined }}
* @type {{ [k in keyof z.input<typeof clientSchema>]: string | undefined }}
*/
export const clientEnv = {
// NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR,
Expand Down
4 changes: 2 additions & 2 deletions cli/template/extras/src/env/schema/with-prisma.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof serverSchema>]: z.infer<typeof serverSchema>[k] | undefined }}
* @type {{ [k in keyof z.input<typeof serverSchema>]: string | undefined }}
*/
export const serverEnv = {
DATABASE_URL: process.env.DATABASE_URL,
Expand All @@ -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<typeof clientSchema>]: z.infer<typeof clientSchema>[k] | undefined }}
* @type {{ [k in keyof z.input<typeof clientSchema>]: string | undefined }}
*/
export const clientEnv = {
// NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR,
Expand Down

0 comments on commit ab0790e

Please sign in to comment.