Welcome! Please see the About page for a little more info on how this works.

0 votes
in ClojureScript by

If you have code like

(let [^string x 3] )

we would generally prefer the type hint over the inferred type. But in cases where we have inferred a type and the type is inconsistent with the type hint, it may be useful to emit a diagnostic in that case.

If the inferred type is a superset of the hint, then we shouldn't warn. For example, if we infer {{any}} then no warning should be emitted. Also, if, for example we infer 1. }} and we have a hint of {{string}} we can take the stance that the developer is essentially saying that {{clj-nil}} can't happen.

But, on the other hand, if we infer {{number}} and there is a hint of {{string}} then clearly something is amiss.

1 Answer

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJS-2902 (reported by mfikes)
Welcome to Clojure Q&A, where you can ask questions and receive answers from members of the Clojure community.
...