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 BaseValidator typings #198

Merged
merged 1 commit into from
Dec 4, 2022
Merged

Fix BaseValidator typings #198

merged 1 commit into from
Dec 4, 2022

Conversation

jsamr
Copy link
Contributor

@jsamr jsamr commented Dec 4, 2022

@af This is a small follow-up PR on #194. After testing in our codebase, I noticed that this:

const result = cleanEnv(process.env, {
  FOO: str({
    default: undefined,
    desc: "",
  }),
});

Would resolve to:
image

After this patch, it resolves to:

image

The order of BaseValidator overrides was wrong; the optional spec should come first.

The order was erroneous; the optional spec should come
first, otherwise adding "desc" field would return a
RequiredValidatorSpec.
@jsamr jsamr marked this pull request as ready for review December 4, 2022 13:30
@af af merged commit df6abf3 into af:main Dec 4, 2022
@af
Copy link
Owner

af commented Dec 4, 2022

Thanks, published [email protected] with this change 👍

@jsamr
Copy link
Contributor Author

jsamr commented Dec 4, 2022

@af Appreciated! Will let you know how it goes.

tuannm151 pushed a commit to BSSCommerce/shopify-envalid that referenced this pull request Jul 1, 2024
The order was erroneous; the optional spec should come
first, otherwise adding "desc" field would return a
RequiredValidatorSpec.
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.

2 participants