 (defn- validate-fields
   [case name fields]
   (when-not (vector? fields)
-    (throw (AssertionError. (core/str case " " name ", no fields vector given.")))))
+    (throw
+      #?(:clj (AssertionError. (core/str case " " name ", no fields vector given."))
+         :cljs (js/Error. (core/str case " " name ", no fields vector given."))))))
 
 (core/defmacro deftype
   "(deftype name [fields*]  options* specs*)

         ;; Note: Cannot delegate this check to def because of the call to (with-meta name ..)
         (if (core/instance? clojure.lang.Symbol name)
           nil
           (throw (IllegalArgumentException. "First argument to defn must be a symbol")))
         (core/let [m (if (core/string? (first fdecl))
                        {:doc (first fdecl)}
                        {})

          (fn [fdecl]
            (core/let [arglist (first fdecl)
                  ;elide implicit macro args
                  arglist (if #?(:clj (clojure.lang.Util/equals '&form (first arglist))
                                 :cljs (= '&form (first arglist)))
                            #?(:clj (clojure.lang.RT/subvec arglist 2 (clojure.lang.RT/count arglist))
                               :cljs (subvec arglist 2 (count arglist)))
                            arglist)
                  body (next fdecl)]
              (if (map? (first body))
