Requires DOM lib
What version of Effect is running?
3.3.0
What steps can reproduce the bug?
{
"compilerOptions": {
"lib": ["esnext"] // missing "dom"
}
}
What is the expected behavior?
The library should typecheck in server environments without DOM lib.
What do you see instead?
Various type errors pertaining to:
ReadableStreamQueuingStrategyAddEventListenerOptions
Additional information
No response
Effect depends on Web APIs that are commonly implemented by Node and the other most common runtimes such as edge runtimes, deno, bun. To have Effect typecheck you will need a set of global types that include those functionalities, note that those are also required at runtime so if your runtime doesn't have them you'll need to polyfill
Here's a small repro: https://git.sr.ht/~samhh/effect-lib-dom-repro/
@types/node isn't enough to typecheck Effect, though Node as a platform does support Stream. Possibly this is an upstream issue as the package does include Stream types, in which case guidance would be welcome for projects that don't want to pollute their server environment with largely inapplicable DOM typings.
Having said that, AddEventListenerOptions is still an issue. Its inclusion in Stream.fromEventListener infects all consumers of Effect to require DOM lib. I believe RxJS manages to bypass this issue with its fromEvent.