-
-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request: support the concept of "closedness" for Maps #2237
Comments
It would be super cool if clj-kondo could actually use Malli itself for the type checking.
But the Malli instrumentation generates just the following
|
I wonder if that's a Malli issue, since type checking does occur for "normally" shaped maps, as shown above in |
This is probably not feasible in the short term but we could extend the type checking mechanism with a closed check. |
@fosskers The problem is that the arguments can be a single map or a sequence of specific keyword/value pairs. |
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: