Fork me on GitHub
#clojurescript
<
2021-03-27
>
quadron08:03:24

how do i do the following in clojurescript:

import {
  InitialStates,
  SECPTransferOutput
} from "avalanche/dist/apis/avm"

quadron08:03:26

i'm using shadow-cljs

quadron08:03:59

the aforementioned folder exists in the node_modules folder

quadron08:03:21

it is a js package

quadron08:03:53

the following works:

(js/require "avalanche/dist/apis/avm")
but is it the idiomatic way of working with npm modules?

quadron08:03:16

what happens if i don't alias like following?

(require '["avalanche/dist/apis/avm" :as foo]) 

quadron08:03:24

the following doesn't work for instance:

avalanche.dist.apis.avm/SECPTransferOutput

quadron08:03:41

i assume i should always either refer or alias then?

thheller08:03:16

because thats not the namespace that is generated for the string. not all strings can be translated to proper namespaces like that since the npm world does not follow the CLJ naming conventions

✔️ 3
thheller08:03:48

so yeah, you need the alias

quadron08:03:51

i suspected so