tonsky / rum

Simple, decomplected, isomorphic HTML UI library for Clojure and ClojureScript
Eclipse Public License 1.0
1.8k stars 126 forks source link

bind-context produces unfixable infer warnings #251

Closed martinklepsch closed 2 years ago

martinklepsch commented 2 years ago
  85 |     (->> (rum/bind-context [rctx/*popover-seq-machine* popover-seq-machine]
----------------^---------------------------------------------------------------
 Cannot infer target type in expression (. rctx/*popover-seq-machine* -Provider)
--------------------------------------------------------------------------------

The infer warning seems to come out of the internals of bind-context and how it retrieves the Provider property. I'm not entirely sure but maybe this could be fixed by adding a ^js type hint to the ~context var below?

https://github.com/tonsky/rum/blob/9feb2a1781e3ef716361f9788150a01ea7f791b6/src/rum/core.clj#L361-L370

tonsky commented 2 years ago

Would you submit a PR?

martinklepsch commented 2 years ago

i'd like to but my macro-fu isn't quite strong enough to add ^js to ~context. With the obvious approach of (.-Provider ^js ~context) I got compiler errors that ^js isn't a thing in Clojure.

martinklepsch commented 2 years ago

I could try to create a PR that adds a repro to an existing example maybe 🤔