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

Improve accuracy of the isAsync type guard #1719

Merged
merged 2 commits into from
Dec 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions deno/lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ There are a growing number of tools that are built atop or support Zod natively!
- [`zodix`](https://github.com/rileytomasek/zodix): Zod utilities for FormData and URLSearchParams in Remix loaders and actions.
- [`formik-validator-zod`](https://github.com/glazy/formik-validator-zod): Formik-compliant validator library that simplifies using Zod with Formik.
- [`zod-i18n-map`](https://github.com/aiji42/zod-i18n): Useful for translating Zod error messages.
- [`@modular-forms/solid`](https://github.com/fabian-hiller/modular-forms): Modular form library for SolidJS that supports Zod for validation.

#### Zod to X

Expand Down
2 changes: 1 addition & 1 deletion deno/lib/helpers/parseUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,4 @@ export const isValid = <T>(x: ParseReturnType<T>): x is OK<T> | DIRTY<T> =>
export const isAsync = <T>(
x: ParseReturnType<T>
): x is AsyncParseReturnType<T> =>
typeof Promise !== undefined && x instanceof Promise;
typeof Promise !== "undefined" && x instanceof Promise;
2 changes: 1 addition & 1 deletion src/helpers/parseUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,4 @@ export const isValid = <T>(x: ParseReturnType<T>): x is OK<T> | DIRTY<T> =>
export const isAsync = <T>(
x: ParseReturnType<T>
): x is AsyncParseReturnType<T> =>
typeof Promise !== undefined && x instanceof Promise;
typeof Promise !== "undefined" && x instanceof Promise;
colinhacks marked this conversation as resolved.
Show resolved Hide resolved