-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -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>, |
There was a problem hiding this comment.
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🤷
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this 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 :)
2df8c5b
to
7e192c7
Compare
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. |
@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 |
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! |
Oh we need a changeset too |
Done. |
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 :) |
fix #17
Before:
After: