exec_js return type unmatched when using dialyzer
calvin-kargo opened this issue · comments
Dialyzer show warning when run over this code
case exec_js(socket, "confirm('Are you sure?')") do
{:ok, true} -> true
_ -> false
end
Looking over documetation (https://hexdocs.pm/drab/Drab.Core.html#t:return/0), it seems that return
type is missing bool()
Indeed! exec_js
was missing the boolean as a possible browser return type! Fixed. ^.^
And as for peek, hmm, it can return whatever the assign is, which can be literally anything. It looks like the typespec of peek is wrong in general as it only returns {:ok, any()}
or it raises. Fixed it too. :-)
I ran dialyzer on the project again just now but it didn't pick up anything new, but it's not very comprehensive. ^.^;
New release coming out shortly as 0.10.3, corresponding to this issue being auto-closed by github.
If there is any other typespec issues, please report them! Getting them correct now will be significantly useful for a later gradualizer run over the code when it's complete. :-)