You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In other words, when we expect there to be only the exact keys specified and no more. Using the integration provided by malli, clj-kondo warns when required keys are missing, but not when closedness is being violated.
If clj-kondo could be altered to understand some marker for closedness here, then malli could be updated to emit that. Then, the illegal usage of :Name would be flagged at both call sites.
It would be super cool if clj-kondo could actually use Malli itself for the type checking.
I have a function that uses keyword varargs that looks like this:
I wonder if that's a Malli issue, since type checking does occur for "normally" shaped maps, as shown above in Pkg (i.e. passing :Description an int would report an error).
@fosskers The problem is that the arguments can be a single map or a sequence of specific keyword/value pairs.
I'd be pretty happy with just closed maps, though.
Is your feature request related to a problem? Please describe.
The "typing" library https://github.com/metosin/malli supports the concept of "closedness" for Maps:
In other words, when we expect there to be only the exact keys specified and no more. Using the integration provided by malli,
clj-kondo
warns when required keys are missing, but not when closedness is being violated.Describe the solution you'd like
For the following Clojure:
the following
clj-kondo
config is generated by Malli:If
clj-kondo
could be altered to understand some marker for closedness here, thenmalli
could be updated to emit that. Then, the illegal usage of:Name
would be flagged at both call sites.Please and thank you!
Describe alternatives you've considered
N/A
Additional context
Original discussion on the Clojure Slack: https://clojurians.slack.com/archives/CHY97NXE2/p1701764317891619
The text was updated successfully, but these errors were encountered: