Fork me on GitHub
#cljs-dev
<
2020-07-14
>
Roman Liutikov08:07:31

@dnolen Seems like a bug in externs inference, is this a known issue? I can file JIRA ticket given this cljs code

(ns app.core)

(def obj (.-obj js/window))

(-> (.method obj)
    js/console.log)

(-> ^js/Promise (.promise obj)
    (.then js/console.log))
inferred externs are
var setTimeout;
var process;
process.hrtime;
Java.type;
Object.out;
Object.out.println;
Object.error;
Object.error.println;
Object.then;
Window.prototype.obj;
Window.prototype.obj.method;
notice that Window.prototype.obj.promise; is missing here compiled output is broken as expected, because of missing extern
var y=window.obj;console.log(y.method());y.h().then(console.log);
Looks like a type hint messed up with externs inference