Fork me on GitHub

Q: I have a typescript project which can expose react prop types. I’m wondering if there’s a way to convert these types to Malli using some kind of tooling? I don’t mind building the tool and submitting a PR if there is a way. Any typescript experts have ideas for this?


background: I have a contractor building react components in Storybook/typescript which I use in a re-frame app. This workflow is huge win


if I can figure out types -> Malli, I can enhance the testing story as well


I’m a typescript/babel noob so I need to figure out how to expose the types and then interop to generate Malli

Tiago Dall'Oca14:03:10

I need to show up here more often haha

Tiago Dall'Oca14:03:40

yess, I'm working on it 🙂 (slowly)

Ivan Fedorov14:12:52

Is this normal that :e.order/shipping doesn’t resolve into a schema here? Or maybe I lost some understanding

(def registry:case
   [:map [:address string?]]
     [:vector [:ref :e.order/shipping]]]]})

(def schema:customer-order-case
     {:registry registry:case}

  (-> (m/deref-all schema:customer-order-case)
      (last) (last)
      (m/children) first ; -> [:ref :e.order/shipping]
      (m/children) first type))

;; comment block evals to a keyword

Ivan Fedorov14:12:29

ok, I got it, I have to m/deref a [:ref :x] block, not :x itself