This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (1)
- # aws (17)
- # babashka (2)
- # beginners (14)
- # calva (1)
- # cider (16)
- # clara (1)
- # clj-kondo (68)
- # cljdoc (2)
- # clojure (51)
- # clojure-dev (1)
- # clojure-italy (2)
- # clojure-spec (1)
- # clojure-uk (19)
- # clojurescript (34)
- # cursive (4)
- # fulcro (1)
- # heroku (3)
- # leiningen (36)
- # lumo (28)
- # music (2)
- # off-topic (16)
- # reagent (22)
- # specter (7)
- # sql (7)
> Every day I deal with 2-3 items from that queue and add 5-10 new items. The game is rigged from the start... oh… for me 1 thing take around a few months. I am even not counting small things which I can learn during the day 🙂
What is the correct usage of
UtcDateTime.fromTimestamp? Many projects seem to use it just like that, with an accompanying
(:import [goog.date UtcDateTime]). However,
clj-kondo thinks that's its invalid.
Using it as in
(:require [goog.date.UtcDateTime :as udt]) with
(udt/fromTimestamp) doesn't produce any errors. But I'm not sure whether the initial usage is still wrong.
thats a bit of an undefined area I guess. both variants end up emitting the same code
Yeah, I was afraid so.
FWIW the page at https://clojurescript.org/reference/google-closure-library mentions
cljs-time and says "Their source code also serves as good examples of how to use Closure directly." And
@p-himik Please file an issue with a complete repro (full .cljs file that produces the error)
Since this is kind of undefined behavior in CLJS, maybe it's better if people started to adopt the require form?
(:require [goog.date.UtcDateTime :as udt])
(udt. ...) isn't allowed (calling as constructor)
:as is only "callable" for JS deps, but this is a closure dep so it is kinda special
this is supported by clj-kondo if you use a string require there, since people do this with npm libs
is the gist of this example that there is no clear way of how people should do this in a current version of CLJS?
some time ago I was strictly against supporting
anything.foo and would have made that an error and forced
it is a surprisingly difficult subject in the compiler. I tried coming up with a clean way to handle this but failed