File tree Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Original file line number Diff line number Diff line change 1220
1220
:node {:name (symbol (str current-ns)
1221
1221
(munge-node-lib (resolve-ns-alias env ns )))
1222
1222
:op :js-var
1223
- :ns current-ns}
1223
+ :ns current-ns
1224
+ :tag 'js}
1224
1225
:global {:name (symbol (str current-ns)
1225
1226
(munge-global-export (resolve-ns-alias env ns )))
1226
1227
:op :js-var
1227
- :ns current-ns})))
1228
+ :ns current-ns
1229
+ :tag 'js})))
1228
1230
1229
1231
(defn resolve-import
1230
1232
" goog.modules are deterministically assigned to a property of the namespace,
Original file line number Diff line number Diff line change 51
51
(is (= 'js/Foo (ana/js-tag '[baz] :ret-tag externs)))))
52
52
53
53
(defn infer-test-helper
54
- [{:keys [forms externs warnings warn js-dependency-index with-core? opts]}]
54
+ [{:keys [forms externs warnings warn js-dependency-index node-module-index with-core? opts]}]
55
55
(let [test-cenv (atom
56
56
(cond->
57
57
(if with-core?
60
60
{::ana/externs
61
61
(externs/externs-map
62
62
(closure/load-externs {:externs (or externs [])}))})
63
- js-dependency-index (assoc :js-dependency-index js-dependency-index)))
63
+ js-dependency-index (assoc :js-dependency-index js-dependency-index)
64
+ node-module-index (assoc :node-module-index node-module-index)))
64
65
wrap (if with-core?
65
66
#(comp/with-core-cljs nil %)
66
67
#(do (% )))]
453
454
" Object.someProperty;" ])
454
455
res)))))
455
456
457
+ (deftest test-cljs-3381
458
+ (testing " invokeable js namespaces not hinted properly"
459
+ (let [ws (atom [])
460
+ res (infer-test-helper
461
+ {:node-module-index #{" markdown-it" }
462
+ :forms '[(ns foo.core
463
+ (:require [markdown-it]))
464
+ (defonce mdi
465
+ (doto (new markdown-it
466
+ (js-obj
467
+ " linkify" true
468
+ " typographer" true ))
469
+ (.renderInline mdi " hi" )))]
470
+ :warnings ws
471
+ :warn true
472
+ :with-core? false
473
+ :target :nodejs })]
474
+ (is (= (unsplit-lines
475
+ [" Object.renderInline;" ])
476
+ res)))))
477
+
456
478
(comment
457
479
(binding [ana/*cljs-ns* ana/*cljs-ns*]
458
480
(ana/no-warn
You can’t perform that action at this time.
0 commit comments