Managing Side Effects: A JavaScript Effect System in 30 Lines or Less
(lackofimagination.org)
from Aijan@programming.dev to programming@programming.dev on 25 Nov 2025 18:43
https://programming.dev/post/41337240
from Aijan@programming.dev to programming@programming.dev on 25 Nov 2025 18:43
https://programming.dev/post/41337240
#programming
threaded - newest
This is a super interesting approach to JS. Conceptually, it’s really cool. In practice, I don’t think I’d do it (at least for any projects I can think of) because explaining it to others would be difficult and representing complex logic as “commands” sounds a bit difficult.
In a weird way, it reminds me of actor frameworks though. The difference is of course the separation of effects.
One thing I wish the author would have done, though, is add some type hints. I know it’s about JS, but even some jsdoc types would have helped. It was a bit hard to know at first what the input types were to these functions.
Author here. In my experience, AI coding tools like Claude Code can write code in the Effect system style, and that could be a great starting point for getting developers not familiar with this approach on board.
I considered adding JSDoc type annotations, but that would make the code a bit verbose.
Do you have a version with type annotations, perhaps in a gist?
I’ve added JSDoc type annotations to the library.