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

fix: handle empty env object type #21

Merged
merged 8 commits into from
Apr 28, 2023
Merged

fix: handle empty env object type #21

merged 8 commits into from
Apr 28, 2023

Conversation

chungweileong94
Copy link
Contributor

@chungweileong94 chungweileong94 commented Apr 27, 2023

fix #17

Before:

image

After:

image

@vercel
Copy link

vercel bot commented Apr 27, 2023

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 Apr 28, 2023 6:03am

@@ -91,8 +91,8 @@ export interface StrictOptions<

export function createEnv<
TPrefix extends string,
TServer extends Record<string, ZodType>,
TClient extends Record<string, ZodType>
TServer extends Record<string, ZodType> = NonNullable<unknown>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is my first time using NonNullable<unknown>, an alternative to {}, as the ESLint rule doesn't allow me to use it🤷

Copy link
Member

Choose a reason for hiding this comment

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

Record<string, never> is the type for {} that eslint allows fyi

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I was using that originally, but unfortunately it didn't work in this case.

Copy link
Member

@juliusmarminge juliusmarminge left a comment

Choose a reason for hiding this comment

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

can you add a regression test that validates this actually works?

EDIT: I just added one on main - let's see it turn green here :)

@juliusmarminge
Copy link
Member

whopps - looks like i broke it and i can't seem to push to your branch to fix it back up :/

@chungweileong94
Copy link
Contributor Author

whopps - looks like i broke it and i can't seem to push to your branch to fix it back up :/

No worries, I will fix it once I'm available to do so.

@chungweileong94
Copy link
Contributor Author

chungweileong94 commented Apr 28, 2023

@juliusmarminge I'm a bit lost here, is it something wrong with the test on CI? It looks like it was trying to typecheck against /dist/**, and I can't seem to reproduce the same error on my local.

@juliusmarminge
Copy link
Member

Try pushing that to the tsconfig exclude maybe?

@chungweileong94
Copy link
Contributor Author

Try pushing that to the tsconfig exclude maybe?

Yeah, seems to work. Just weird that it didn't happen to my local environment. Thx for the help!

@juliusmarminge juliusmarminge added this pull request to the merge queue Apr 28, 2023
@juliusmarminge juliusmarminge removed this pull request from the merge queue due to a manual request Apr 28, 2023
@juliusmarminge
Copy link
Member

Oh we need a changeset too

@chungweileong94
Copy link
Contributor Author

Oh we need a changeset too

Done.

@chungweileong94
Copy link
Contributor Author

chungweileong94 commented Apr 28, 2023

Same type error happening again, probably something wrong with the CI.
(EDIT) I literally just push the .md file

@juliusmarminge
Copy link
Member

Same type error happening again, probably something wrong with the CI.

Yea might be a bad turbo config so it's pulling a bad cache or something... i'll take a look! let's get this released :)

@juliusmarminge juliusmarminge added this pull request to the merge queue Apr 28, 2023
Merged via the queue into t3-oss:main with commit fcf6851 Apr 28, 2023
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.

[Next.js] When not using client env variables, an & { [x: string]: any } union type appears
2 participants