user4148098
user4148098

Reputation:

Clojurescript advanced compilation unreachable-code

I have just added a new library(https://github.com/ptaoussanis/tempura/blob/master/README.md ) to my Clojurescript project.

WARNING: /matter/titan/source/titan-ui/out/taoensso/tempura/impl.js:96: WARNING - unreachable code}catch (e20422){if((e20422 instanceof Error)){

I also get this error :

Use of undeclared Var goog.structs/Map
(def ^:private coerce-xhr-params "Returns [<uri> <?data>]"
(let [url-encode
(fn url-encode
([params]
(when (seq params)
(-> params clj->js gstructs/Map. gquery-data/createFromMap .toString)))
                   ^---
([uri params]
(let [qstr (url-encode params)
          uri-with-query (if (str/blank? qstr) uri (str uri "?" qstr))]
          [uri-with-query nil])))

Do I need to write an 'extern' for this? What does that look like?

Upvotes: 1

Views: 106

Answers (1)

stsdflw
stsdflw

Reputation: 66

It's hard to tell from your code and question details, but I assume you're having trouble with library call in advanced compilation mode.

The modern simple way is to skip externs thing altogether and just write calls/gets not in interop form, but by using https://github.com/binaryage/cljs-oops library.

You won't have to do anything else then - all your code will survive advanced compilation by default, no externs needed!

e.g. (.-nativeProp obj) would look like (oget obj "nativeProp"), and ocall is used for function calls correspondingly.

Upvotes: 2

Related Questions