mayu-live / framework

Mayu is a live updating server-side component-based VDOM rendering framework written in Ruby
https://mayu.live
GNU Affero General Public License v3.0
135 stars 4 forks source link

Prop type validation #46

Open aalin opened 1 year ago

aalin commented 1 year ago

It would be nice if it was possible to specify prop types.

Something like T::Struct in Sorbet maybe.

:ruby
  prop :description, String, nil?: true
  prop :count, Integer
  prop :onclick, HandlerRef
%div
  = if $description
    %p= $description
  %p Count: #{$count}
  %div
    %button{onclick: $onclick}