Fork me on GitHub
Kelly Innes02:01:05

Is there a good tutorial for using spec in ClojureScript?

Kelly Innes02:01:00

I'm trying to use it in a Reagent/Figwheel/Expo application and would like to see some examples of other uses.


@kinnes In general, the ClojureScript implementation of Spec adheres very closely to that of Clojure, so any Clojure tutorial should apply as well.

Kelly Innes02:01:14

Okay, cool -- is sort of the best source of truth for how to use it?




before i bother filing a bug…is it a known issue that protocol method names cannot clash with javascript reserved words like delete? it’s understandable that it doesn’t work but the error only happens when you try calling the method, and all it says is Cannot read property 'object' of undefined. no me gusta.


@sekao I don't recall a JIRA like that. I tried, but can't repro:


i should’ve mentioned i’m using extend-type. (extend-type default IFoo (delete [_]))



cljs.user=> (extend-type default IFoo (delete [_] 1))
cljs.user=> (delete #js {})


are you sure that isn’t a behavior difference with whatever repl you’re using? here’s what my file looks like:


Ahh... oops. For that last test I was using something off either master or a patch... I can repro with 1.10.439. So there's hope. 🙂 Let me see if things works master.


Yeah, master appears to be fixed.


ah! good to know, thanks


Interestingly, the fix was evidently a side effect of this patch (according to git bisect):


There was some discussion about #reitit yesterday - I updated the example reagent app to use clojure.spec coercion instead of schema, found here: The example also has the documented how to switch to use HistoryAPI. For backend... reitit has built-in modules for ring, pedestal and sieppari. It could be used with #yada too, but the coercion is part of the endpoint data model, which overlaps with yada resources, so the spec coercion with yada would need some extra integration to work.

👍 5

I wonder if there is a way to limit the amount of dates available in reagent-forms datepicker? Use case: date range selection, one should not be able to select end date which is before the start date. I can of course prevent this via checking the selected value afterwards but it would be more user friendly if those dates were not selectable in the first place. Can't see a way to do this, ideas?


hello, I'm going insane trying to get atom (proto repl) + lein-figwheel or figheel-main working, are there any guides for this? I've tried all I could find by googling


It's a hot mess right now. Save yourself the headaches and check out shadow-cljs


okay, thanks for the tip. I'll check it out


I was happy that atom seemed like a good editor to recommend to newcomers, but not being able to develop clojurescript is kind of bad 😞


@saikyun fwiw, I mostly rely on hot reloading instead of a REPL for CLJS


@borkdude but don't you miss being able to eval-last-sexp etc?


and inspecting data etc


@saikyun for some things you would probably be faster with a REPL but the feedback loop of instant reloads is so quick that in many situations it's not much different than using a REPL. Also consider that you might often work on something more visual that would be hard to inspect in a REPL as well.


@saikyun not really. I sometimes def something so I can inspect in in the browser console with cljs-dev-tools


I also use a lot of (.log js/console the-thing)


and re-frame-10x or re-frisk also helps


all right, good to know. thanks for your input


I use the repl a lot to look at maps, but using js/console makes sense


With cljs-devtools it's nicer than in a REPL (for plain "looking at things" at least)


sounds great 🙂 does it work with internet explorer 😉


working in a pretty locked down environment


It only works in Chrome I'm afraid


@saikyun no. but you can also do [:pre (with-out-str (clojure.pprint/pprint the-map))] if you’re using reagent


okay thanks 🙂 we plan on trying out reagent


Yeah, I just use atom with a console repl. Hot reload on save and then do any repling stuff I want to in the console.

Jacob Haag18:01:56

Would anyone know how I achieve modules.export with clojurescript?

// tools.js
// ========
module.exports = {
  foo: function () {
    // whatever
  bar: function () {
    // whatever

var zemba = function () {
Essentially I have a function that I am exporting in clojurescript
(defn ^:export add-numbers [a b]
  (+ a b))
And I'd like to wrap it with modules.exports


@jacobhaag17 some build tools handle this for you. what build tool are you using?


it sounds like you're in a Node.js environment?

Jacob Haag18:01:12

Yup, I am using node.js as my environment

Jacob Haag18:01:32

Essentially I want to access an exported function in another js file


are you using shadow-cljs?

Jacob Haag18:01:49

leiningen and cljsbuild


even if you're not using figwheel, that's how you'll do it

Jacob Haag18:01:45

Cooleo, thanks much @lilactown

Pavel Klavík18:01:11

Hi, I am building a full stack web app and currently using lein and cljsbuild for compilation. (Based on reframe lein template.) I am thinking of switching to shadowcljs for npm support. What is the workflow for web server compilation, to produce uberjar?

Christian Johansen21:01:39

does anyone have any pointers to deploying ClojureScript libraries to clojars with tools.deps? I did clojure -Spom and mvn deploy, but it only put an ~empty jar in clojars (no sources)

Alex Miller (Clojure team)21:01:26

there are some packaging/deployment tools in although they are mostly oriented toward clojure code, not sure if they will do what you need for cljs

Christian Johansen21:01:02

yeah, I was looking at pack, but honestly I don't even know what it takes to publish a cljs package to clojars 😕 always used lein in the past, and now I know nothing of what it really did

Christian Johansen21:01:10

looks like I can generate a pom and jar, and then try mvn deploy. I'll tinker around a little 🙂