This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-28
Channels
- # announcements (1)
- # babashka (28)
- # beginners (228)
- # cider (9)
- # clara (6)
- # clojure (66)
- # clojure-uk (13)
- # clojuredesign-podcast (5)
- # clojurescript (9)
- # core-typed (1)
- # cursive (1)
- # duct (2)
- # emacs (8)
- # fulcro (18)
- # graalvm (11)
- # hyperfiddle (1)
- # malli (2)
- # off-topic (33)
- # re-frame (9)
- # reagent (3)
- # reitit (15)
- # shadow-cljs (6)
- # tools-deps (1)
Messing with typehinting and the aws sdk. I'm trying to instantiate an SES thingy like this
(def ^js aws (js/require "aws-sdk"))
(defn my-handler ...
(let [ses (aws.SES.)]
...
which on runtime errors out with "TypeError: wn.ld is not a constructor"
.
Using shadow-cljs' simple externs, I can get it to work by simply adding the string "`SES`" to externs/my-build.txt
, but I'd really like to get it working using typehinting.
So far, I've tried:
(let [ses ^js (aws.SES.) ...
and
(let [ses (new ^js aws.SES)
but to no availhello, is it possible to use nrepl-refactor or any kind of refactoring with shadow-cljs? (iām using emacs)
Yes! Here's an example setup if you're using tools-cli:
;; ~/.clojure/deps.edn
{:deps {nrepl/nrepl {:mvn/version "0.7.0-alpha3"}
cider/cider-nrepl {:mvn/version "0.23.0-SNAPSHOT"}
refactor-nrepl {:mvn/version "2.5.0-SNAPSHOT"}}}
;; ~/.nrepl
{:middleware [refactor-nrepl.middleware/wrap-refactor]}
@grav use (:require ["aws-sdk" :as aws])
in your ns
and then (aws/SES.)
that should take care of it
@U05224H0W Thanks a bunch. Externs inference is black magic to me ... good to have a wizard at hand š
@martin.hablak no clue. I don't use emacs but I'd guess that adding the dependency+middleware should make it work.
š 4