core-typed

2024-12-05T12:54:28.102509Z

Good morning again. I am trying to understand whats the best way to type functions with keyword args. For example, I am trying to type component’s system-map. Something like below.

2024-12-05T12:54:37.142459Z

(defn system
  []
  (component/system-map
    :db-info     (db-info/db-info)
    :ring-app    (ring-app/ring-app)
    :http-server (http-server/http-server)))

2024-12-05T12:55:08.673889Z

I read through most of the documentation, and I see a couple of references to how to do keyword args, but I am a little confused.

2024-12-05T12:55:48.416539Z

This is where I got, (t/ann component/system-map [-> & :optional-kws {}]) but its clearly wrong. Thanks!

2024-12-05T16:58:52.152589Z

Try [& :optional {} -> ]

2024-12-05T16:59:14.451099Z

oh Shoot

2024-12-05T16:59:15.696319Z

lol

2024-12-05T16:59:17.218629Z

thank you

2024-12-05T16:59:45.147709Z

np. also supported: & :mandatory {... :default d} :optional {... :priority (U nil true)}

1