Fork me on GitHub

I'm trying to import an es6 javascript module using the instructions here: When I did I got the following error: Uncaught SyntaxError: 'super' keyword unexpected here I reduced it to a simple test case with the following:

export class Greeter {
  constructor(subject, salutation) {
    this.subject = subject;
    this.salutation = salutation;

  greet() {
    console.log(`${this.subject} ${this.salutation}!`);

export class HelloWorld extends Greeter {
  constructor() {
    super("Hello", "world");
I couldn't find anything on the Google Closure GitHub issues about issues with super so I thought I'd post it here to see if anyone could help.


parsing some text loaded by a web page. After 2 days I figured out that the strings are NOT java strings but javascript strings and so lots of clojure stuff I do isn't working.


Is it safe to say that clojure.string/xxxxx is going to behave correctly?


@llsouder clojure.string is completely cross-platform. there’s occasionally little idiosyncracies but it’s very much corner cases


:thinking_face: @colinkahn are you getting that error at compile time or in the browser?


in the browser, from what I can tell the compiled code turns the constructor of the class into a normal function and the super call is no longer valid within it


let HelloWorld$$module$src$js$hello = function() {
    super("Hello", "world")
I shortened the variable it outputs, but that's what the compiled result where the syntax error occurs


and you have the :module-type set as :es6?


:foreign-libs [{:file "src" :module-type :es6}]


anyone using Datascript with function bindings? I can't get it working


ah, got it, gotta pass them in query inputs


@colinkahn I haven’t looked at what is going on above, but ClojureScript master has a revision to update to the latest released Closure Compiler. Also, you can specify that version by explicitly overriding that dep in your project.


@mfikes awesome, overriding worked, thanks!


Apologies for the noob question: In ClojureScript, what's the correct pattern for defining two functions that call each other? I'm trying to do this now but getting a compiler error that the second function is not defined when it is called in the first function because the compiler hasn't reached that point in the file yet


The context here is that I'm writing a tree component with Reagent where there can be different types of tree nodes, using a render-node function to decide which actual render function to use based on the tree node type


you can declare the function-name before you defn it


Thanks @lilactown! That seems to have worked 🙂

👍 4

By the way @daviwil, this is called “mutual recursion”; it might make it easier to search for it 🙂

mario-star 4

Thanks! I'm aware of the terminology and searched for that but didn't find any answers, thus I came here 😉


@daviwil if you don’t find any answers for a question like this in clojurescript, try clojure; afaik all of these things should behave similarly, and so have the same solution


Yeah, I wasn't sure if this was one of the subtle differences between Clojure and ClojureScript but I'll try that next time


Not trying to discourage you to ask here mind you; I do so all the time. Just a tip in case you want a quicker solution 🙂


Much appreciated!


Hey folks, I've got some example code over in #architecture about managing memory over SharedArrayBuffers in CLJS. It's sort of a garbage collection problem. Anybody built a slab allocator before?


Hi, I am thinking about make small module (100 lines?) to simplify use form validation messages for user. Like error should appear after user touch / lost focus the required field not before. It matters especially about empty fields. Errors messages based on spec validation. In this examples I use simple messages, but it could also look like:

{::sc/email "Typo? It doesn't look valid."
::sc/password "Password is required."
::sc/password-difficulty "Too easy"
::sc/password-length "Too short"}
Does it make sense? Would you like to use it? Maybe solution like this already exist? I didn’t find one.
(defn log-in []
  (let [specs->msg {::sc/email "Typo? It doesn't look valid."
                    ::sc/password "Password is required."}
        names->spec {:email ::sc/email
                     :password ::sc/password}
        names->value (r/atom {:email ""
                              :password ""})
        form (form/init-form names->value names->spec specs->msg)
        value->form (form/fn-value->form form)
        name->touched (form/fn-name->touched form)
        form-valid? (form/fn-form-valid? form)]
    (fn []
      (let [email-error? (form/show-error? form :email)
            password-error? (form/show-error? form :password)]
           {:on-change value->form
            :on-blur name->touched
            :error email-error?
            :helper-text (if email-error?
                           (form/get-error form :email)
                           " ")
            :name "email"
            :label "Email"}]
           {:on-change value->form
            :on-blur name->touched
            :error password-error?
            :helper-text (if password-error?
                           (form/get-error form :password)
                           " ")
            :type "password"
            :name "password"
            :label "Password"}]
            {:variant "raised"
             :color "primary"
             :on-click #(when (form-valid?)
                          (re-frame/dispatch [:log-user @names->value]))}
            "Log in"]]]]))))


I’m embarrassed about this newbie question — but I just upgraded to ClojureScript 1.10.339 (to try out Ghostwheel by!) and now I’m get a bunch of type inference errors for functions like GetElementByID and preventDefault. What is the best way to get definitions of all these functions? (or maybe I should broaden the question to: “how do I make all these warnings go away?” 🙂 Thanks in advance!!!

Cannot resolve property getElementById for inferred type js/HTMLDocument in expression

Ex: (.getElementById js/document "app")

Cannot infer target type in expression (. event preventDefault)

Ex: (.preventDefault event)


Hello everyone 👋 I’m trying to get a Clojure linter into VSCode and am using Calva. Has anyone encountered this error (or know how to interpret it?)

Caused by: java.lang.IllegalStateException: Attempting to call unbound fn: #'nrepl.middleware/set-descriptor!
I followed these directions and encountered the error upon adding [cider/cider-nrepl] to my dependencies.


my best guess: I didn’t have my server running (I restarted it to add this dependency) and it looks like the middleware trips because it expects the nrepl to be up already.


@UC2FSP5KK cider-nrepl is in a weird spot currently due to some breaking changes in the upgrade to nrepl 0.4


which version of cider-nrepl are you using?


is there a place I can look for the “last working version”?


you can downgrade shadow-cljs to 2.4.24 which should still work with the old cider release

💯 4

I don't think a new cider-nrepl release was released just yet


awesome thank you @U05224H0W I’ll try it out


Whoa my shadow-cljs version is 2.3.30. Looks pretty behind.


That did it!


Many moons ago, I added to certain namespaces (set! *warn-on-infer* true) to detect extern errors (things that would get minimized away by the Closure compiler). Getting warnings on getElementById and preventDefault didn’t happen with ClojureScript 1.9.946. Thanks!


@genekim you need to typehint event. in shadow you’d just do ^js event — i’m not sure how it works with the standard compiler


Alas, @lee.justin.m, adding ^js event typehint does not make the warnings go away in the standard CLJS compiler. 😞 Thanks, though!


Sorry @genekim this is much easier in shadow-cljs


I think you need to give it a real type like ^js/Object event or something


you should probably post on stackoverflow. someone will definitely have an answer for you


the other warning is new to me


Ooh... got it! I’ll give it a try tonight! Thanks @lee.justin.m !!!