I've got a project that uses EventStore, and takes advantage of the dynamic naming for tests. When I run dialyzer on the project, it fails if there is a call to subscribe/2 that passes in a name: name option (ex: FooEventStore.subscribe("stream_id", name: :foo):
The function call will not succeed.
FooEventStore.subscribe(_stream :: any(), [{:name, _}, ...])
will never return since the 2nd arguments differ
from the success typing arguments:
(binary(), [{:mapper, (map() -> any())} | {:selector, (map() -> any())}])
Here's the relevant bit of source code from EventStore:
I think the issue is that transient_subscribe_options typespec allows name in the opts list , but the underlying call to PubSub.subscribe/3 does not. To fix this, we could either delete name from opts before passing it to PubSub.subscribe/3, or we could amend the @spec definition for PubSub.subscribe/3 to include the name option.
I've got a project that uses EventStore, and takes advantage of the dynamic naming for tests. When I run
dialyzer
on the project, it fails if there is a call to subscribe/2 that passes in aname: name
option (ex:FooEventStore.subscribe("stream_id", name: :foo)
:Here's the relevant bit of source code from EventStore:
I think the issue is that
transient_subscribe_options
typespec allowsname
in theopts
list , but the underlying call toPubSub.subscribe/3
does not. To fix this, we could either deletename
fromopts
before passing it toPubSub.subscribe/3
, or we could amend the@spec
definition forPubSub.subscribe/3
to include thename
option.