Fork me on GitHub
#clojurescript
<
2021-07-23
>
Takis_00:07:35

hello is it possible to use npm modules from clojurescript and have autocomplete ?

Takis_00:07:14

like we have when we use clojure with java libraries (for example cursive does that for java but not for npm i think),is there some ide/plugin that does that?

Chandru01:07:55

Hi. This is a noob question but how can I compile CLJS to JS but ask the cli command to use options from my deps.edn file? The ClojureScript official documentation does not mention using deps.end in the compiler help doc and only gives examples of CLI commands where we have to provide all options inline?

Chandru01:07:23

one answer suggests using -co <path to deps.edn> so I'll try that in a bit.

thheller06:07:51

deps.edn is not meant for this, you should create your own edn files

thheller06:07:16

inline opts are fine in deps.edn, other build config is not

dnolen12:07:00

@chandru89new you can use tools-deps aliases for this, pretty standard practice - like a :repl alias a :release alias etc. and these gather up the :main-opts

dnolen12:07:32

we don't get into it in the docs because those are generic details about tools-deps

Chandru12:07:11

Thank you, David. I will explore this.

dnolen13:07:54

@takis_ Cursive does it for Google Closure libs - I don't see why it couldn't work for NPM deps too

cfleming21:07:33

The main problem is that the Closure code is written in a Java-y style that’s easy to statically analyse. I’ve made various attempts to do the same for random NPM libs and it’s much harder. I’m considering basing the analysis off TypeScript types, so users would just install the @types/react or whatever and get support from those.

Takis_22:07:50

thank you, it will be very nice to have this, autocomplete helps alot.

Takis_22:07:33

i am using MongoDB nodejs driver,and it shows them as un-resolved symbols and no autocomplete for now.

zendevil.eth15:07:55

I have a public solidity contract variable: uint public bidEnd, and I’m getting its value using web3js like so:

83  (go                           
 84    (.call                           
 85     (.bidEnd                          
 86      (.-methods                
 87       (web3.eth.Contract. (:contract-json db)
 88                 (-> db :creation :creation/contract-address))))                    
 89     (clj->js {:from (->                     
 90              (<p!          
 91               (.request          
 92               (:ethereum db) (clj->js {:method "eth_request  Accounts"})))    
 93              (get 0))})
 94     (fn [err result]   
 95      (js/console.log "error- " err)   
 96      (js/console.log "result- " result))))
And it’s printing the following in the console:
err is  Error: Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced.
    at require.decodeParametersWith (index.js:299)
    at require.decodeParameters (index.js:286)
    at Contract.global._decodeMethodReturn (index.js:471)
    at Method.outputFormatter (index.js:761)
    at Method.formatOutput (index.js:148)
    at sendTxCallback (index.js:524)
    at cb (util.js:703)
    at Item.run (browser.js:154)
    at drainQueue (browser.js:124)
What am I doing wrong and how to fix this?

zendevil.eth15:07:06

since it’s a call function which doesn’t use gas, it’s weird that it’s asking if I ran out of gas. I’m not sure about the other reasons for the error that it lists

sova-soars-the-sora16:07:04

What are the inputs and what are the outputs supposed to look like?

fbielejec16:07:57

Hi! How to express this syntax in reagent:

<Button
  classes={{
    root: classes.root, // class name, e.g. `classes-nesting-root-x`
    label: classes.label, // class name, e.g. `classes-nesting-label-x`
  }}
>
  classes nesting
</Button>
What are these double curly braces? (taken from https://material-ui.com/customization/components/#overriding-styles-with-classes), is it just
[button {:classes {:root     (-> classes :root)
                   :label (-> classes :label)}]

thheller17:07:14

@fbielejec the first tells JSX that the classes attribute expects an object (ie. not converted to a string). so your translation is correct assuming whatever wrapper you use translates that to a JS object

🙌 3
dnolen17:07:54

@ps looks like possibly a bad JS method invoke due to using .call ? Would you use .call from JS?