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

Emoji regex is not supported in some environments #132

Closed
jacoblee93 opened this issue Jul 28, 2024 · 2 comments · Fixed by #133
Closed

Emoji regex is not supported in some environments #132

jacoblee93 opened this issue Jul 28, 2024 · 2 comments · Fixed by #133

Comments

@jacoblee93
Copy link
Contributor

Unicode regexes are not supported in all environments - React Native in particular. One is used here:

https://github.com/StefanTerdell/zod-to-json-schema/blob/master/src/parsers/string.ts#L26

This is problematic because even if we don't use a schema containing z.string().emoji(), the regex is instantiated immediately as the object is imported. The fix in Zod was to lazily instantiate the regex:

colinhacks/zod@9340fd5

With this, the rest of the library is usable in such environments (though .emoji() still won't be).

I'll open a PR with a similar fix.

@StefanTerdell
Copy link
Owner

@jacoblee93 Out now in 3.23.2. Thanks for the fix!

@jacoblee93
Copy link
Contributor Author

Thank you @StefanTerdell!

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 a pull request may close this issue.

2 participants