This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-12-03
Channels
- # adventofcode (151)
- # asami (34)
- # babashka (43)
- # beginners (111)
- # cider (2)
- # clj-kondo (6)
- # cljdoc (12)
- # clojure (140)
- # clojure-australia (10)
- # clojure-europe (14)
- # clojure-france (5)
- # clojure-gamedev (5)
- # clojure-nl (4)
- # clojure-uk (10)
- # clojurescript (20)
- # community-development (9)
- # conjure (1)
- # core-async (4)
- # cryogen (3)
- # cursive (2)
- # datomic (17)
- # emacs (9)
- # events (1)
- # fulcro (27)
- # juxt (8)
- # kaocha (2)
- # lambdaisland (14)
- # off-topic (23)
- # pathom (37)
- # pedestal (2)
- # re-frame (8)
- # reagent (8)
- # reclojure (9)
- # reitit (5)
- # reveal (34)
- # shadow-cljs (27)
- # spacemacs (10)
- # tools-deps (123)
- # vim (28)
- # xtdb (17)
thanks! I now noticed that when requiring some of my namespaces in the node repl I get lots of infer-warnings and - if I remember correctly - this previously impacted async evaluations at the REPL
I only get those warnings when requiring the namespace inside shadow-cljs node-repl
— when evaluating via Conjure/Vim they are not shown
is there a way to type hint the return value of a function at the place where the function is defined? I have some functions that return JS objects and hinting those in every place I use them is a little tedious/noisy.
Also I’m noticing that the warnings only occur when requiring the namespace in a node-repl. The actual builds using those files don’t log any warnings
@martinklepsch I think (defn foo ^ReturnType [a b] ...)
Interestingly a large chunk also seems to be undeclared-var
warnings from something like this:
(:require #?(:node
["@sentry/node" :as sentry]
:browser
["@sentry/browser" :as sentry])
(.configureScope sentry (fn [^sentry.Scope scope] ....
^sentry.Scope
has no meaning in shadow-cljs whatsoever. just make your life easier and use ^js
you might not get be inference warnings because shadow-cljs processes the JS for browser builds, so it collects more externs infos
I do get the inference warnings when starting the node repl via shadow node-repl
, just not when evaluating through my editor (so probably not shadow’s fault)
that said the example above was more about the undeclared-var
warning and less about inference
Use of undeclared Var icebreaker.util.sentry/sentry
thats the ^sentry.Scope
probably. should be either ^js
or sentry/Scope
given that its an alias not a var
I also get it on lines that don’t have the sentry.Scope hint and it persists after removing the sentry.Scope hints
one thing though. if you have :as something
you should probably always be treating that as a proper namespace alias
while (.configureScope sentry ...)
is valid (sentry/configureScope ...)
would be better
oh I see, maybe I’ll just try that
hm, that still gives me
No such namespace: sentry, could not locate sentry.cljs, sentry.cljc, or JavaScript source providing "sentry"
here’s the full source for this namespace: https://gist.github.com/martinklepsch/0a146f46dfc7a304eaec0f348e5a5d36
@martinklepsch now I see. you don't have a :cljs
default branch for sentry
. node-repl
doesn't use any custom reader conditionals so it only uses :cljs
which is missing.
oh, true, I do mostly start my node-repl like this (shadow/node-repl {:config-merge [{:compiler-options {:reader-features #{:node}}}]})
but you’re right that when I tried to reduce the repro I skipped that