Skip to content

Commit

Permalink
chore: move option to baseoption (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusmarminge committed Oct 16, 2023
1 parent c3b2e7b commit cb72fa9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .changeset/green-terms-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@t3-oss/env-core": patch
---

move emptyStringAsOptional to base options
30 changes: 15 additions & 15 deletions packages/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,21 @@ export interface BaseOptions<TShared extends Record<string, ZodType>> {
* @default false
*/
skipValidation?: boolean;

/**
* By default, this library will feed the environment variables directly to
* the Zod validator.
*
* This means that if you have an empty string for a value that is supposed
* to be a number (e.g. `PORT=` in a ".env" file), Zod will incorrectly flag
* it as a type mismatch violation. Additionally, if you have an empty string
* for a value that is supposed to be a string with a default value (e.g.
* `DOMAIN=` in an ".env" file), the default value will never be applied.
*
* In order to solve these issues, we recommend that all new projects
* explicitly specify this option as true.
*/
emptyStringAsUndefined?: boolean;
}

export interface LooseOptions<TShared extends Record<string, ZodType>>
Expand Down Expand Up @@ -128,21 +143,6 @@ export interface ServerOptions<
: never} should not prefixed with ${TPrefix}.`>
: TServer[TKey];
}>;

/**
* By default, this library will feed the environment variables directly to
* the Zod validator.
*
* This means that if you have an empty string for a value that is supposed
* to be a number (e.g. `PORT=` in a ".env" file), Zod will incorrectly flag
* it as a type mismatch violation. Additionally, if you have an empty string
* for a value that is supposed to be a string with a default value (e.g.
* `DOMAIN=` in an ".env" file), the default value will never be applied.
*
* In order to solve these issues, we recommend that all new projects
* explicitly specify this option as true.
*/
emptyStringAsUndefined?: boolean;
}

export type ServerClientOptions<
Expand Down

2 comments on commit cb72fa9

@vercel
Copy link

@vercel vercel bot commented on cb72fa9 Oct 16, 2023

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

@vercel
Copy link

@vercel vercel bot commented on cb72fa9 Oct 16, 2023

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-t3-oss.vercel.app
env.t3.gg
t3-env-git-main-t3-oss.vercel.app
env.t3.wtf

Please sign in to comment.