Fork me on GitHub
#core-typed
<
2022-07-03
>
J16:07:42

Hi! It’s normal that typedclojure don’t throw error in this code:

(def Pokemon
  [:map
    [:pokemon/name :string]
    [:pokemon/level :int]])

(m/=> display-pokemon [:=> [:cat Pokemon] :string])
(defn display-pokemon [pokemon]
  (format "%s is at level %s" (:foo pokemon) (:baz pokemon)))
foo and baz are not in the pokemon definition. I don’t know if it’s possible to do this kind of check.

emccue18:07:00

So the malli schema there is "open" - meaning you are allowed to have keys that are not in there

emccue18:07:18

and even if you made it closed, you would then just know that the lookup would give nil

J18:07:04

Even if the map is closed, there is no error.

ambrosebs01:07:13

Yes this is normal. (:foo pokemon) should be inferred as nil.