-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
suggestions for effect plugin #3449
suggestions for effect plugin #3449
Conversation
@@ -1,21 +1,20 @@ | |||
import { Effect } from "effect"; | |||
import * as Effect from "effect/Effect"; |
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.
alias imports are better for library code, as they cause less issues with bundlers
return error as z.ZodError; | ||
}, | ||
}); | ||
return Effect.flatMap( |
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.
Effect.promise + flatMap allows us to use the safe apis
catch(error) { | ||
return error as z.ZodError; | ||
}, | ||
return Effect.suspend(() => { |
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.
Effect.suspend allows us to wrap a side effect that returns an Effect, perfect for the sync api.
Thanks!! |
* Update README_ZH.md (#3433) fix Demo -> Deno * Clean up code, fix build/test * Write docs * Fix rollup build * Fix setup-deno * Add types field * Fix types * Use globalThis check * Add _tag to ZodError * Comments * Add better tests * suggestions for effect plugin (#3449) * Updates * Move to .effect.parse() * Bind this in getter * Clean up --------- Co-authored-by: sdshaoda <21106848+sdshaoda@users.noreply.github.com> Co-authored-by: Tim <hello@timsmart.co>
* Update README_ZH.md (colinhacks#3433) fix Demo -> Deno * Clean up code, fix build/test * Write docs * Fix rollup build * Fix setup-deno * Add types field * Fix types * Use globalThis check * Add _tag to ZodError * Comments * Add better tests * suggestions for effect plugin (colinhacks#3449) * Updates * Move to .effect.parse() * Bind this in getter * Clean up --------- Co-authored-by: sdshaoda <21106848+sdshaoda@users.noreply.github.com> Co-authored-by: Tim <hello@timsmart.co>
No description provided.