Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose internal value for isServer #259

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Guria
Copy link

@Guria Guria commented Aug 13, 2024

Fixes #258

Added recipe to docs:
image

Copy link

vercel bot commented Aug 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
t3-env ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 1, 2024 11:14am

Copy link

vercel bot commented Aug 13, 2024

@Guria is attempting to deploy a commit to the t3-oss Team on Vercel.

A member of the Team first needs to authorize it.

@juliusmarminge
Copy link
Member

I'd probably do it more explicit like this:

// env.ts
import { createEnv } from "@t3-oss/env-core";

export const isServer = typeof window === "undefined";

export const env = createEnv({
  isServer,
  server: { ... }
});

// somewhere.ts
import { isServer } from "~/env";

if (isServer) { ... }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose internal value for isServer
2 participants