Closed jacoblee93 closed 2 months ago
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:
z.string().emoji()
https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
With this, the rest of the library is usable in such environments (though .emoji() still won't be).
.emoji()
I'll open a PR with a similar fix.
@jacoblee93 Out now in 3.23.2. Thanks for the fix!
Thank you @StefanTerdell!
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:https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
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.