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

suggestions for effect plugin #3449

Merged

Conversation

tim-smart
Copy link

No description provided.

@@ -1,21 +1,20 @@
import { Effect } from "effect";
import * as Effect from "effect/Effect";
Copy link
Author

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(
Copy link
Author

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(() => {
Copy link
Author

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.

@tim-smart tim-smart mentioned this pull request Apr 27, 2024
@colinhacks colinhacks merged commit 6f56869 into colinhacks:effect-plugin Apr 27, 2024
@colinhacks
Copy link
Owner

Thanks!!

colinhacks added a commit that referenced this pull request May 3, 2024
* 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>
colinhacks added a commit to ytsunekawa/zod that referenced this pull request May 3, 2024
* 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>
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.

None yet

2 participants