Details
Assignee
David NolenDavid NolenReporter
David NolenDavid NolenPriority
Minor
Details
Details
Assignee
David Nolen
David NolenReporter
David Nolen
David NolenPriority
Created February 17, 2025 at 5:06 PM
Updated March 19, 2025 at 3:33 PM
Work on https://clojure.atlassian.net/jira/software/c/projects/CLJS/issues/CLJS-3425?jql=project%20%3D%20%22CLJS%22%20ORDER%20BY%20created%20DESC has revealed deeper issues with externs inference. Inference on singletons in the global namespace simply doesn’t work. The currently algorithm is instance-centric in the sense that it mostly works when users instantiate some type, or gets an instance of a type from some API and uses it. But it completely fails in cases like
crypto.subtle
. In order to know that this has an extern we have to see thatcrypto
has type{!webCrypto.Crypto|undefined}
(note this is not parsed correctly at the moment). Then we need to look at the prototype to find thesubtle
property, then we need to look up the type ofsubtle
for externs inference to proceed correctly.The
Number.isNaN
case is related in that we inferNumber
to be of typeFunction
and this is why we don’t correctly infer the return type ofisNaN
calls.