Fork me on GitHub
#clojure-spec
<
2021-06-04
>
Frank Henard21:06:37

How do I do an ::Anything spec in Clojurescript? In Clojure I have (s/def ::Anything #(instance? Object %))

borkdude21:06:15

note that your ::Anything spec will not tolerate nil

Frank Henard21:06:27

Thanks, Yeah, I'll have to do a parity match on those

borkdude21:06:13

just to be clear: the answer in both dialects is any?.

Frank Henard21:06:04

right, thanks, here's what I changed it to for my cljc file: (s/def ::Anything #(s/and some? any?)) This way I can specify s/nilable in the specs that reference ::Anything. Seem like an ok solution to you?

borkdude21:06:50

it seems a little weird to me. why not just use some? and any? directly?

Frank Henard21:06:42

Yes, that's it! Something seemed wrong to me too, thanks again!

Joshua Suskalo23:06:19

s/and with any? as an item is exactly equivalent to just the rest of the items