`^js` tag
shaunlebron opened this issue · 0 comments
shaunlebron commented
question came up here: lilactown/helix#104 (comment)
discussed with @thheller here: https://clojurians.slack.com/archives/C03S1L9DN/p1664298527478269
^js
can effectively be used instead of ^js/React.Element
. The extra type info is for readability, but shadow-cljs for example actually throws it away. I think Closure conservatively refuses to mangle recognized property names regardless of the object type.
Looking at both cljs and shadow-cljs codebases, here’s how the ^js
tag affects externs. I’ll probably put this on cljs api site soon since there’s much confusion about what actually happens:
added to cljs externs | added to shadow-cljs externs | |
---|---|---|
^js => |
Object.* |
ShadowJS.prototype.* |
^js/React.Element => |
React.Element.prototype.* |
ShadowJS.prototype.* |