Git Product home page Git Product logo

Comments (4)

jkrasnay avatar jkrasnay commented on June 11, 2024 1

@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.

from clj-kondo.

jkrasnay avatar jkrasnay commented on June 11, 2024

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:

(defn quux
  {:malli/schema [:=> [:cat
                       [:altn
                        [:map [:map {:closed true}
                               [:foo {:optional true} boolean?]
                               [:bar {:optional true} boolean?]]]
                        [:args [:*
                                [:alt
                                 [:cat [:= :foo] boolean?]
                                 [:cat [:= :bar] boolean?]]]]]]
                  :any]}
  [& {:keys [foo bar]}]
  ,,,)

(quux :foo true)

But the Malli instrumentation generates just the following :type-mismatch config:

quux {:arities {:varargs {:args [:any],
                          :ret :any,
                          :min-arity 0}}}

from clj-kondo.

fosskers avatar fosskers commented on June 11, 2024

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).

from clj-kondo.

borkdude avatar borkdude commented on June 11, 2024

It would be super cool if clj-kondo could actually use Malli itself for the type checking.

This is probably not feasible in the short term but we could extend the type checking mechanism with a closed check.

from clj-kondo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.