Uploaded image for project: 'ClojureScript'
  1. CLJS-2954

Externs inference on Number properties

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects versions: None
    • Fix versions: None
    • Labels:
      None
    • Environment:

      {:deps {org.clojure/clojurescript {:mvn/version "1.10.339"}}}

      Description

      Observe the warning triggered here:

      $ clj -m cljs.main -co '{:infer-externs true}' -r
      ClojureScript 1.10.339
      cljs.user=> (defn foo? [x y] (< x (or y (.-MAX_VALUE js/Number))))
      WARNING: cljs.core/<, all arguments must be numbers, got [nil #{nil js/Number}] instead at line 1 <cljs repl>
      

      This warning doesn't appear if you don't enable :infer-externs (in which case (.-MAX_VALUE js/Number) inferred to be of type js).

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mfikes Mike Fikes
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: