Tue 26 Sep 2017 — Tue 26 Sep 2017


def makes a JavaScript variable.

Keywords are not identical?.


Externs are needed by the Closure Compiler. ClojureScript produces them by default.

For 3rd party JS libraries, we need to create them.

http://cljsjs.github.io/ provides some pre-bundled stuff, including externs:

  • React
  • leaflet
  • react-leaflet

There is also an :infer-externs true compiler flag. This is black magic and may not work.

We also need to set (set! *warn-on-infer* true) in the files where we use a 3rd party JS library.

Then, if we see any warnings, we can provide a type hint to finish off.

If this gets complicated, we should write out own externs file.

js Namespace

This contains globals like js/Infinity and js/undefined.


Uses JavaScript equality.

Ratio, BigDecimal, BigInteger not supported.


Different in complicated ways.

Every namespace matches a file.


There is a separate macro expansion phase.


FigWheel is a nice debugging in the browser thing for ClojureScript.

It starts a web server, and automatically hot-reloads the browser page as your modify your ClojureScript.

You need to add the lein-figwheel plugin in your project.clj.

Then you can run lein figwheel to start the server.

It depends on you writing your ClojureScript files such that they can be reloaded.

Emacs Integration

M-x cider-jack-in-clojurescript

Also, maybe it can work with Figwheel? Not sure if any integration is actually needed there?