Skip to content

Commit

Permalink
fix: handle undefined clientPrefix for server env and not throw error (
Browse files Browse the repository at this point in the history
…#160)

Co-authored-by: juliusmarminge <julius0216@outlook.com>
  • Loading branch information
Just-Moh-it and juliusmarminge committed Jan 12, 2024
1 parent dde527e commit f4d5aeb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/tidy-students-admire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@t3-oss/env-core": patch
---

fix: handle undefined clientPrefix for server env and not throw error
4 changes: 3 additions & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ export interface ServerOptions<
* built with invalid env vars.
*/
server: Partial<{
[TKey in keyof TServer]: TPrefix extends ""
[TKey in keyof TServer]: TPrefix extends undefined
? TServer[TKey]
: TPrefix extends ""
? TServer[TKey]
: TKey extends `${TPrefix}${string}`
? ErrorMessage<`${TKey extends `${TPrefix}${string}`
Expand Down

2 comments on commit f4d5aeb

@vercel
Copy link

@vercel vercel bot commented on f4d5aeb Jan 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

t3-env – ./docs

t3-env.vercel.app
t3-env-git-main-t3-oss.vercel.app
t3-env-t3-oss.vercel.app
env.t3.wtf
env.t3.gg

@vercel
Copy link

@vercel vercel bot commented on f4d5aeb Jan 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

t3-env-nextjs – ./examples/nextjs

t3-env-nextjs.vercel.app
t3-env-nextjs-t3-oss.vercel.app
t3-env-nextjs-git-main-t3-oss.vercel.app

Please sign in to comment.