Not sure if this is possible but is there a way to use the ^js type hint in a clojurescript macro? This is using non self hosted clojurescript. So the macro is written in clojure so doesn’t have access to cljs as far as I can tell.
(defmacro texture-for "Throws compile time error if k is not a valid sprite key." [app k] (let [resolved-k (if (symbol? k) @(resolve 'k) k)] (assert (sprite-keys resolved-k) (str resolved-k " is not a valid sprite key."))) (let [k-string (-> k name str)] `(let [^js r# (-> ~app .-loader .-resources (aget "resources/spritesheet.json"))] (-> r# .-textures (aget ~k-string)))))
The type hint does get added, it just resolves it to the macro namespace so ends up as ^foo/js rather than staying as ^js. Not sure if there’s away round this as I’m new to clojurescript. If I could find a way to keep the type hint as ^js then is might work is my current reasoning?
Any help would be greatly appreciated.