mayu-live/framework

Prop type validation

aalin opened this issue · 0 comments

aalin commented

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

Something like T::Struct in Sorbet maybe.
Could use sorbet-runtime to validate the types to not reinvent the wheel.

:ruby
  prop :description, T.nilable(String)
  prop :count, Integer
  prop :onclick, HandlerRef
%div
  %p Count: #{props[:count]}
  %p
    %button{onclick: props[:onclick]}