preactjs / signals

Manage state with style in every framework
https://preactjs.com/blog/introducing-signals/
MIT License
3.81k stars 95 forks source link

fix(core): Restore stricter effect callback & cleanup function types #558

Closed jviide closed 7 months ago

jviide commented 7 months ago

This pull request restores the stricter types for effect callbacks and effect cleanup functions introduced in #249. Core tests needed to be modified slightly to accommodate these typing changes.

These stricter types were later changed back to allowing both effect callbacks and effect cleanup functions return unknown. It is convenient to allow anything to be returned, especially when writing tests like effect(() => s.value++). On the other hand stricter types can be useful for catching e.g. attempts to have asynchronous effect handlers, which the core does not support (effect(async () => { ... })).

It's debatable whether this change would warrant a patch or major release. I've tentatively chosen a patch changeset, as the previous related changes were also patch changes.

changeset-bot[bot] commented 7 months ago

🦋 Changeset detected

Latest commit: c8c95ac7dcbbfe8e97b251a4c3efdec82e72944b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | -------------------- | ----- | | @preact/signals-core | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

netlify[bot] commented 7 months ago

Deploy Preview for preact-signals-demo ready!

Name Link
Latest commit c8c95ac7dcbbfe8e97b251a4c3efdec82e72944b
Latest deploy log https://app.netlify.com/sites/preact-signals-demo/deploys/661aea4b40bfc100087e0cc4
Deploy Preview https://deploy-preview-558--preact-signals-demo.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.