pigeon
pigeon copied to clipboard
Dialyzer error FCM Notification
Environment
- Elixir & Erlang/OTP versions (
elixir --version
):
Erlang/OTP 24 [erts-12.0.3] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]
Elixir 1.12.2 (compiled with Erlang/OTP 22)
- Operating system: Arch Linux
Current behavior
I'm implementing a module to use Pigeon FCM Notification but dialyzer complains. I'm using the example provided in the readme (2.0.0-rc.0)
Expected behavior
Dialyzer not complaining
Code
@spec send_push_notification(String.t(), %{String.t() => String.t()}) :: :ok
def send_push_notification(token, payload) do
Pigeon.FCM.Notification.new({:token, token}, payload)
|> Okani.FCM.push()
:ok
end
Dialyzer error
The function call will not succeed.
Okani.FCM.push(%Pigeon.FCM.Notification{
:__meta__ => %Pigeon.Metadata{:on_response => nil},
:android => nil,
:apns => nil,
:data => _,
:error => nil,
:fcm_options => nil,
:name => nil,
:notification => _,
:response => nil,
:target => {:condition, _} | {:token, _} | {:topic, _},
:validate_only => nil,
:webpush => nil
})
will never return since the 1st arguments differ
from the success typing arguments:
(
[
%{
:__meta__ => %Pigeon.Metadata{:on_response => nil | (_ -> any()) | {_, _} | {_, _, _}}
},
...
]
| %{
:__meta__ => %Pigeon.Metadata{
:on_response =>
nil | (map() -> no_return()) | {atom(), atom()} | {atom(), atom(), [any()]}
}
}
)
I'm seeing the same error with "2.0.0-rc.0". Btw, thank you for the amazing library! 🙏
I'm seeing the same error with 2.0.0-rc.0
using Pigeon.push
Seeing same issue on "2.0.0-rc.0".