This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-16
Channels
- # beginners (7)
- # cider (128)
- # clara (9)
- # clojure (7)
- # clojure-norway (3)
- # clojure-spec (2)
- # clojure-uk (16)
- # clojurescript (79)
- # css (1)
- # datomic (2)
- # devcards (1)
- # editors (39)
- # euroclojure (4)
- # events (1)
- # figwheel (25)
- # fulcro (1)
- # luminus (3)
- # off-topic (15)
- # om (3)
- # onyx (10)
- # protorepl (8)
- # reagent (5)
- # reitit (1)
- # shadow-cljs (95)
- # tools-deps (6)
Has anybody ever seen this ClojureScript error?
Unable to construct gen at: [:context] for: object?
Error: Unable to construct gen at: [:context] for: object?
at Object.cljs$spec$alpha$gensub [as gensub] (/home/arichiardi/git/laputa/lambda-cqrs/out/cljs/spec/alpha.cljs:278:14)
at Object.cljs$spec$alpha$re_gen [as re_gen] (/home/arichiardi/git/laputa/lambda-cqrs/out/cljs/spec/alpha.cljs:1187:32)
at /home/arichiardi/git/laputa/lambda-cqrs/out/cljs/spec/alpha.cljs:1174:34
at /home/arichiardi/git/laputa/lambda-cqrs/out/cljs/core.cljs:4691:16
at cljs.core.map.cljs$core$IFn$_invoke$arity$4 (/home/arichiardi/git/laputa/lambda-cqrs/out/cljs/core.js:17634:3)
at cljs.core.LazySeq.sval (/home/arichiardi/git/laputa/lambda-cqrs/out/cljs/core.cljs:3394:18)
at cljs.core.LazySeq.cljs$core$ISeqable$_seq$arity$1 (/home/arichiardi/git/laputa/lambda-cqrs/out/cljs/core.cljs:3384:1)
at Object.cljs$core$seq [as seq] (/home/arichiardi/git/laputa/lambda-cqrs/out/cljs/core.cljs:1210:25)
at Object.cljs$core$every_QMARK_ [as every_QMARK_] (/home/arichiardi/git/laputa/lambda-cqrs/out/cljs/core.cljs:4183:10)
at Object.cljs$spec$alpha$re_gen [as re_gen] (/home/arichiardi/git/laputa/lambda-cqrs/out/cljs/spec/alpha.cljs:1191:30)
It seems to be coming from this fspec
(s/def :http/callback
(s/fspec :args (s/cat :context object?
:error #(instance? js/Error %)
:response object?)))
I guess I cannot fspec
a higher order function that accepts a JS object yet?
@richiardiandrea Right—`object?` is not present here https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/spec/gen/alpha.cljs#L87-L141
Thanks for the new CLJS release.
Question about extern inference improving. How much should we trust it and what should we watch out for?
@olivergeorge hrm I guess report stuff that doesn’t work?
Fair enough. Thanks David. Is there anywhere that describes how things improved?
goog.history has helpers
@olivergeorge hrm not outside of tickets and commit history
I am trying to adapt David Nolen's recent article about using webpack with cljs to include the prosemirror package in a small project, but I am having some challenges getting the mapping right. I have provided a gist here https://gist.github.com/maacl/3af5c646e5139b4fc9eacc46f2eb1218 with the relevant files. The output I get is "undefined". It appears from my testing that prosemirror-state is mapped directly to the EditorState object, whereas I would like for prosemirror-state just to be mapped to the prosemirror-state ns and access EditorState using prosemirror-state/EditorState.
@dnolen Sorry for the confusion, I did not mean to imply that js has nss. If I do above how would then access EditorState from core.cljs?
you can determine the structure of the library yourself in index.js
is all I was trying to say
I get Uncaught TypeError: Cannot read property 'EditorState' of undefined - but I can access EditorState from the console via ProseMirrorState.EditorState
I’ve created an issue to validate :global-exports
to avoid this kind of misunderstanding https://dev.clojure.org/jira/browse/CLJS-2781
@mac another thing I recommend is trying to get one import / export to work for now - remove all the other stuff
if you can’t get that to work then I’ll look at it - it’s minimal enough to show me if there’s an issue
@dnolen Ok I updated the gist to reflect the current code, that still produces the same result.
@dnolen I get a warning re using production mode when doing yarn webpack. Can that be the culprit?
@dnolen This is very strange. I thought I might be missing a "-" somewhere or something silly like that. My current error is "Uncaught TypeError: Cannot read property 'EditorState' of undefined at core.cljs:4"
@dnolen I did not, but I did now and that fixed the problem. Sorry, I had no I idea that deleting out was necessary.
@dnolen Ah, got it. And I see now, how to achieve what I wanted using index.js. Thanks a lot.
It sounds like a common cause for problems is just forgetting to clear out old bad state when getting this stuff working.
well in this case we need to validate since :global-exports
leads to code gen and bad input will produce bad output
Yeah. Just almost think a FAQ could suggest cleaning old build artifacts as a troubleshooting step. Hah. Then again that may be just a common step for many build related things.
How to require libs like material-ui on clojurescript?
I added "@material-ui/core" "1.2.1"
in my :npm-deps
But I dont know how to require. (on js doc is: import Button from '@material-ui/core/Button';
)
When I try ["@material-ui/core/Button" :as button]
I get Error: Undefined nameToPath for _CIRCA_material_ui.core.Button
on browser (but no error/warning on build)
@souenzzo you’re probably better served by a different approach anyway see https://clojurescript.org/guides/webpack
Now working! But some doubts: On this setting
{:file "dist/index_bundle.js"
:provides ["react" "react-dom" "button"]
:global-exports {react React
button Button
react-dom ReactDOM}}
1- provides
is about the package name? It should match with some other name?
2- global-exports
is a map from "what I require in cljs" to "the name inside window"?:global-export
is a map from provide to the global JS variable assigned to the library
webpack method is just awesome! Now it's way easier to add npm deps But on this method, there is SOME dead code elimitation?
when you are setting a project up it is often helpful to just include a clean step while you are iterating your configuration i.e. rm -rf out; clj -m cljs.main -c example.core
Now working! But some doubts: On this setting
{:file "dist/index_bundle.js"
:provides ["react" "react-dom" "button"]
:global-exports {react React
button Button
react-dom ReactDOM}}
1- provides
is about the package name? It should match with some other name?
2- global-exports
is a map from "what I require in cljs" to "the name inside window"?is it possible to rebind value of a var (e.g. clojure.core/deref), but only for the immediate syntactic scope? e.g. I want to capture deref
inside of a function body, but not within any functions called inside of the body
@lilactown Maybe you could let
a local to shadow clojure.core/deref
(let [deref (fn [_] ,,,)] (deref 1) ,,,)